splinepy.helpme.create.swept#

splinepy.helpme.create.swept(cross_section, trajectory, cross_section_normal=None, anchor='auto', set_on_trajectory=False, rotation_adaption=None)[source]#

Sweeps a cross-section along a trajectory. The cross-section receives rotation into the direction of the trajectory tangent vector and is then placed either at the evaluation points of the trajectory’s knots or at the trajectory’s control points. This depends on the value of the set_on_trajectory parameter. It can create both a surface or a solid, depending on the dimension of the cross-section.

The sweeping process has some limitations, since the cross-section cannot be preserved exactly along the whole trajectory.

This implementation follows the skinning-based swept surface construction described in The NURBS Book, Piegl & Tiller, 2nd edition, chapter 10.4, where cross-section instances are placed along the trajectory and skinned afterwards.

The cross-section orientation is determined using the projection normal method of Siltanen and Woodward, as described in chapter 10.4, Eq. (10.27). For closed trajectories, the orientation is corrected as described on p. 483.

Parameters:
  • cross_section (Spline) – Cross-section to be swept. Requires parametric dimension 1 or 2

  • trajectory (Spline) – Trajectory along which the cross-section is swept. Requires parametric dimension 1

  • cross_section_normal (np.array) – Normal vector of the cross-section Default is [0, 0, 1]

  • anchor (str) – Defines which reference point of the cross-section is placed on the trajectory during sweeping. "parametric" uses the point evaluated at the center of the parametric bounds. "control_box" uses the center of the control-point bounding box. "geometry_box" uses the center of the bounding box of sampled geometric points on the cross-section. "auto" uses "geometry_box" for curve cross-sections and "parametric" for surface cross-sections.

  • set_on_trajectory (bool) – If True, the cross-section will be placed at the evaluation points of the trajectory. If False, the cross-section will be placed at the control points of the trajectory. Default is False.

  • rotation_adaption (float) – Angle in radians by which the cross-section is rotated around the trajectory tangent vector. This is an additional rotation if the user wants to adapt the cross-section rotation. Example with rectangular cross-section: . x . x x x x x x x . x x x x . x x –> rotation around pi/4 –> x x . x x x x . x x x x x x x . x

Returns:

swept_spline – Spline resulting from the sweep

Return type:

Spline

Examples

See examples/show_swept.py for example usages of swept().