InnerHatchRegion¶
-
class
pyslm.hatching.
InnerHatchRegion
¶ Bases:
abc.ABC
The InnerHatchRegion class provides a representation for a single sub-region used for efficiently generating various sub-scale hatch infills. This requires providing a boundary (
boundary
) to represent the region used. The user typically in derivedBaseHatcher
class should set viasetRequiresClipping()
if the region requires further clipping.Finally the derived class must generate a set of hatch vectors covering the boundary region, by re-implementing the abstract method
hatch()
. If the boundary requires clipping, the interior hatches are also clipped.Attributes Summary
The orientation describes the rotation of the local coordinate system with respect to the global coordinate system \((x,y)\).
The origin is the \((x',y')\) position of the local coordinate system.
Methods Summary
boundary
()The boundary of the internal region
hatch
()The hatch method should provide a list of hatch vectors, within the boundary.
Returns True if the region requires additional clipping.
Returns True if the region requires additional clipping.
Generates an affine matrix covering the transformation based on the origin and orientation based on a rotation around the local coordinate system.
Generates an affine matrix covering the transformation based on the origin and orientation based on a rotation around the local coordinate system.
setIntersecting
(intersectingState)Setting True indicates the region has been intersected
setRequiresClipping
(clippingState)Sets the internal region to require additional clipping following hatch generation.
transformCoordinates
(coords)Transforms a set of (n x 3) coordinates with a sort id using the rotation angle
InnerHatchRegion.orientation
using the 3D rotation matrix inInnerHatchRegion.rotationMatrix3D()
.transformCoordinates2D
(coords)Transforms a set of (n x 2) coordinates using the rotation angle
InnerHatchRegion.orientation
using the 2D rotation matrix inInnerHatchRegion.rotationMatrix2D()
.Attributes Documentation
-
orientation
¶ The orientation describes the rotation of the local coordinate system with respect to the global coordinate system \((x,y)\). The angle of rotation is given in rads.
- Return type:
float
-
origin
¶ The origin is the \((x',y')\) position of the local coordinate system.
Methods Documentation
-
abstract
boundary
()¶ The boundary of the internal region
- Raises:
NotImplementedError
- Return type:
Polygon
-
abstract
hatch
()¶ The hatch method should provide a list of hatch vectors, within the boundary. This must be re-implemented in the derived class. The hatch vectors should be ordered.
- Raises:
NotImplementedError
- Return type:
ndarray
-
isIntersecting
()¶ Returns True if the region requires additional clipping.
- Return type:
bool
-
requiresClipping
()¶ Returns True if the region requires additional clipping.
- Return type:
bool
-
rotationMatrix2D
()¶ Generates an affine matrix covering the transformation based on the origin and orientation based on a rotation around the local coordinate system. This should be used when only a series of x,y coordinate required to be transformed.
- Return type:
ndarray
- Returns:
Affine Transformation Matrix
-
rotationMatrix3D
()¶ Generates an affine matrix covering the transformation based on the origin and orientation based on a rotation around the local coordinate system. A pseudo third row and column is provided to retain the hatch sort id used.
- Return type:
ndarray
- Returns:
Affine Transformation Matrix
-
setIntersecting
(intersectingState)¶ Setting True indicates the region has been intersected
- Parameters:
intersectingState (
bool
) – True if the region intersects- Return type:
None
-
setRequiresClipping
(clippingState)¶ Sets the internal region to require additional clipping following hatch generation.
- Parameters:
clippingState (
bool
) – True if the region requires additional clipping- Return type:
None
-
transformCoordinates
(coords)¶ Transforms a set of (n x 3) coordinates with a sort id using the rotation angle
InnerHatchRegion.orientation
using the 3D rotation matrix inInnerHatchRegion.rotationMatrix3D()
.- Parameters:
coords (
ndarray
) – (nx3) coordinates to be transformed- Return type:
ndarray
- Returns:
The transformed coordinates
-
transformCoordinates2D
(coords)¶ Transforms a set of (n x 2) coordinates using the rotation angle
InnerHatchRegion.orientation
using the 2D rotation matrix inInnerHatchRegion.rotationMatrix2D()
.- Parameters:
coords (
ndarray
) – (nx2) coordinates to be transformed- Return type:
ndarray
- Returns:
The transformed coordinates
-