fibomat.curve_tools.offset module#
Provide the offsetting functionality.
- fibomat.curve_tools.offset.offset(curve: ArcSpline, delta: float, direction: str | None = None) List[ArcSpline][source]#
Offset a list of curves. The offset direction depends on the orientation of the curves and the sign of delta.
| delta > 0 | delta < 0 | -----------------+-----------+-----------+ pos. orientation | inwards | outwards | -----------------+-----------+-----------+ neg. orientation | outwards | inwards | -----------------+-----------+-----------+
- Args:
curve (ArcSpline): curve to be offsetted. delta (float): offset distance direction (str, optional): offset direction. Only needed if curve is closed. Should be inwards or outwards.
- Returns:
List[ArcSplines]
- Raises:
ValueError: Raised if direction is not provided an curve is closed.
- fibomat.curve_tools.offset.offset_with_islands(islands: List[ArcSpline], delta: float, outer_curve: ArcSpline | None = None)[source]#
Offset a region with islands. The offset direction will always be outwards.
- Args:
islands (List[ArcSpline]): list of islands. All islands must be closed curves and orientation must be True. delta (float): offset distance outer_curve (ArcSpline, optional): optional outer curve, which will be offsetted inwards.
- Returns:
- Dict[str, Any]:
dict with keys ‘islands’ and ‘outer_curve’. ‘islands’ contains a list of new islands and ‘outer_curve’ contains a new outer curve if outer_curve was not None.
- fibomat.curve_tools.offset.deflate(arc_spline: ArcSpline, pitch: float, *, n_steps: int | None = None, distance: float | None = None)[source]#
Deflate a given arc spline (completely).
The original curve is not included.
- Args:
arc_spline (ArcSpline): curve to be inflated pitch (float): offset delta. n_steps (int, optional): if provided at maximum n_steps will be performed. distance (float, optional): if provided, a total distance ‘distance’ will be deflated.
- Returns:
List[ArcSpline]
- Raises:
ValueError: Raised if steps < 0. ValueError: Raised if distance < 0. ValueError: Raised if steps and distance are provided. RuntimeError: Raised if more than
SAFETYsteps are performed.
- fibomat.curve_tools.offset.inflate(arc_spline: ArcSpline, pitch: float, *, n_steps: int | None = None, distance: float | None = None)[source]#
Inflate a given arc spline (completely).
The original curve is not included.
Note, any one of n_steps and distance must be provided.
- Args:
arc_spline (ArcSpline): curve to be inflated pitch (float): offset delta. n_steps (int, optional): if provided at maximum n_steps will be performed. distance (float, optional): if provided, a total distance ‘distance’ will be deflated.
- Returns:
List[ArcSpline]
- Raises:
ValueError: Raised if steps < 0. ValueError: Raised if distance < 0. ValueError: Raised if none of steps and distance are provided.