fibomat.site module¶
Provides the Site class.
- class fibomat.site.Site(dim_center: Union[fibomat.linalg.vectors.dim_vector.DimVector, pint.quantity.Quantity], dim_fov: Optional[Union[fibomat.linalg.vectors.dim_vector.DimVector, pint.quantity.Quantity]] = None, *, description: Optional[str] = None)[source]¶
Bases:
fibomat.linalg.transformables.transformable_base.TransformableBase[fibomat.linalg.vectors.dim_vector.DimVector,pint.quantity.Quantity,fibomat.linalg.boundingboxes.dim_boundingbox.DimBoundingBox],abc.ABCThe Site class is used to collect shapes with its patterning settings.
Note
All shape positions added to each site are interpreted relative to the site’s position!
Note
If fov is not passed, it will be determined by the bounding box of the added patterns. But if a fixed FOV is given, it is not checked if the added shapes fit inside the fov.
- __init__(dim_center: Union[fibomat.linalg.vectors.dim_vector.DimVector, pint.quantity.Quantity], dim_fov: Optional[Union[fibomat.linalg.vectors.dim_vector.DimVector, pint.quantity.Quantity]] = None, *, description: Optional[str] = None)[source]¶
- Args:
dim_center (DimVectorLike): Center coordinate of the site. dim_fov (DimVectorLike, optional): The fov (field of view) to be used. If not given, the fov will be
calculated automatically.
description (str, optional): description
- property fov: fibomat.linalg.vectors.dim_vector.DimVector¶
Field-of-view of the site.
- Access:
get
- Returns:
DimVector
- property square_fov: fibomat.linalg.vectors.dim_vector.DimVector¶
Squared field-of-view of the site.
- Access:
get
- Returns:
DimVector
- property fov_bounding_box: fibomat.linalg.boundingboxes.dim_boundingbox.DimBoundingBox¶
Bounding box given by fov and center rather from the contained patterns.
- Returns:
DimBoundingBox
- property empty: bool¶
If True, site does not contain any shapes
- Access:
get
- Returns:
bool
- property bounding_box: fibomat.linalg.boundingboxes.dim_boundingbox.DimBoundingBox¶
Bounding box of the added patterns.
- Access:
get
- Returns:
DimBoundingBox
- property patterns¶
Contained patterns in site
- Access:
get
- Returns:
List[Pattern]
- property patterns_absolute¶
Return a list of all patterns contained in the side which are shifted by the side’s center. Hence, these patterns’ positions are not relative to the site’s center anymore but absolute to the coordinate origin.
- Access:
get
- Returns:
List[Pattern]
- create_pattern(dim_shape: fibomat.shapes.dim_shape.DimShape, mill: fibomat.mill.mill.MillBase, raster_style: fibomat.raster_styles.rasterstyle.RasterStyle, description: Optional[str] = None, **kwargs) fibomat.pattern.Pattern[source]¶
Creates a pattern in-place (returned pattern is automatically added to the site). The parameters are identical to the __init__method of the
fibomat.pattern.Patternclass.- Args:
dim_shape: mill: raster_style: description: **kwargs:
- Returns:
Pattern
- add_pattern(ptn: Union[fibomat.pattern.Pattern, fibomat.layout.layoutbase.LayoutBase]) None[source]¶
Adds a
fibomat.pattern.Patternor Layoutbase[Pattern] to the site.- Args:
ptn (Pattern): new pattern
- Returns:
None
- property center: fibomat.linalg.vectors.dim_vector.DimVector¶
Center of the site.
- Access:
get
- Returns:
DimVector
- clone() fibomat.describable.T¶
Create a deepcopy of the object.
- Returns:
Describable
- property description: Optional[str]¶
Description str.
- Access:
get
- Returns:
Optional[str]
- mirrored(mirror_plane: fibomat.linalg.transformables.transformable_base.VectorT) fibomat.linalg.transformables.transformable_base.SelfT¶
Return a mirrored object mirrored about mirror_plane.
- Args:
mirror_plane (VectorLike): mirror plane to be used.
- Returns:
TransformableBase
- property pivot: fibomat.linalg.transformables.transformable_base.VectorT¶
Origin of the (geometric) object. If origin is set to None,
Transformable.centerwill be returned.Pivot must be set to a callable function without parameters.
transformable_obj = ... transformable_obj.pivot = lambda: return Vector(1, 2) print(transformable_obj.pivot) # will print Vector(1, 2)
- Access:
get/set
- Returns:
Vector
- rotated(theta: float, origin: Optional[Union[fibomat.linalg.transformables.transformable_base.VectorT, str]] = None) fibomat.linalg.transformables.transformable_base.SelfT¶
Return a rotated copy around origin with angle theta in math. positive direction (counterclockwise).
- Args:
theta (float): rotation angle in rad origin (Optional[Union[linalg.VectorLike, str]], optional):
origin of rotation. If not set, (0,0) is used as origin. If origin == ‘center’, the
Transformable.centerof the object will be used. The same applies for the case that origin == ‘origin’ with theTransformable.originproperty. Default to None.- Returns:
TransformableBase
- scaled(fac: float, origin: Optional[Union[fibomat.linalg.transformables.transformable_base.VectorT, str]] = None) fibomat.linalg.transformables.transformable_base.SelfT¶
Return a scale object homogeneously about origin with factor s.
- Args:
fac (float): rotation angle in rad origin (Optional[Union[linalg.VectorLike, str]], optional):
origin of rotation. If not set, (0,0) is used as origin. If origin == ‘center’, the
Transformable.centerof the object will be used. The same applies for the case that origin == ‘origin’ with theTransformable.originproperty. Default to None.- Returns:
TransformableBase
- transformed(transformations: fibomat.linalg.transformables.transformation_builder._TransformationBuilder[fibomat.linalg.transformables.transformable_base.VectorT]) fibomat.linalg.transformables.transformable_base.SelfT¶
- Return a transformed object. the transformation can be build by the following functions:
translate()rotate()scale()mirror()
E.g.
transformable_obj.transform(translate([1, 2]) | rotate(np.pi/3) | mirror([3,4])
- Args:
transformations (_TransformationBuilder): transformation
- Returns:
TransformableBase
- translated(trans_vec: fibomat.linalg.transformables.transformable_base.VectorT) fibomat.linalg.transformables.transformable_base.SelfT¶
Return a translated copy of the object by trans_vec.
- Args:
trans_vec (VectorLike): translation vector
- Returns:
TransformableBase
- translated_to(pos: fibomat.linalg.transformables.transformable_base.VectorT) fibomat.linalg.transformables.transformable_base.SelfT¶
Return a translated copy of the object so that self.pivot == pos
- Args:
pos: new position of object
- Returns:
TransformableBase