|
Lagrange
|
Configuration class for sweep operations on 3D geometry. More...
#include <lagrange/primitive/SweepOptions.h>
Public Types | |
| using | Point = Eigen::Matrix<Scalar, 1, 3> |
| using | Frame = Eigen::Matrix<Scalar, 3, 3> |
| using | Transform = Eigen::Transform<Scalar, 3, Eigen::AffineCompact> |
Public Member Functions | |
| std::vector< Transform > | sample_transforms () const |
| Samples transformation matrices along the sweep path. | |
| Transform | sample_transform (Scalar t) const |
| Samples the transformation matrix at a specific parameter t. | |
| std::vector< Scalar > | sample_offsets () const |
| Samples offset values along the sweep path. | |
| Scalar | sample_offset (Scalar t) const |
| Samples the offset value at a specific parameter t. | |
| void | set_pivot (const Point &pivot) |
| Sets the pivot point for the sweep transformation. | |
| const Point & | get_pivot () const |
| Gets the current pivot point. | |
| void | set_normalization (const Transform &normalization) |
| Sets the normalization transformation applied to the sweep. | |
| const Transform & | get_normalization () const |
| Gets the current normalization transformation. | |
| void | set_num_samples (size_t num_samples) |
| Sets the number of samples to use along the sweep path. | |
| size_t | get_num_samples () const |
| Gets the current number of samples. | |
| void | set_periodic (bool periodic) |
| Sets whether the sweep should be treated as periodic. | |
| bool | is_periodic () const |
| Checks if the sweep is configured as periodic. | |
| void | set_domain (std::array< Scalar, 2 > domain) |
| Sets the parameter domain for sampling transformations. | |
| const std::array< Scalar, 2 > & | get_domain () const |
| Gets the current parameter domain for sampling transformations. | |
| bool | is_closed () const |
| Checks if the sweep is closed. | |
| void | set_position_function (std::function< Point(Scalar)> fn) |
| Sets the position function that defines the sweep path. | |
| bool | has_positions () const |
| Checks if a position function has been set. | |
| void | set_frame_function (std::function< Frame(Scalar)> fn) |
| Sets the frame function that defines orientation along the sweep path. | |
| bool | has_frames () const |
| Checks if a frame function has been set. | |
| void | set_twist_function (std::function< Scalar(Scalar)> fn) |
| Sets the twist function that defines rotation around the sweep path. | |
| bool | has_twists () const |
| Checks if a twist function has been set. | |
| void | set_taper_function (std::function< Scalar(Scalar)> fn) |
| Sets the taper function that defines scaling along the sweep path. | |
| bool | has_tapers () const |
| Checks if a taper function has been set. | |
| void | set_offset_function (std::function< Scalar(Scalar)> fn) |
| Sets the offset function that defines offsets along the sweep path. | |
| bool | has_offsets () const |
| Checks if an offset function has been set. | |
Static Public Member Functions | |
| static SweepOptions< Scalar > | linear_sweep (const Point &from, const Point &to, bool follow_tangent=true) |
| Creates a linear sweep configuration from one point to another. | |
| static SweepOptions< Scalar > | circular_sweep (const Point &p, const Point &axis, Scalar angle=static_cast< Scalar >(2 *lagrange::internal::pi), bool follow_tangent=true) |
| Creates a circular sweep configuration around a specified axis. | |
Protected Attributes | |
| Point | m_pivot = Point::Zero() |
| The pivot point for sweep transformations. | |
| Transform | m_normalization = Transform::Identity() |
| The normalization transformation applied to the sweep. | |
| size_t | m_num_samples = 16 |
| The number of samples along the sweep path. | |
| bool | m_periodic = false |
| Whether the sweep is periodic (closed loop) | |
| std::array< Scalar, 2 > | m_domain = {0, 1} |
| The parameter domain for sampling transformations. | |
| std::function< Point(Scalar)> | m_position_fn |
| Function defining positions along the sweep path. | |
| std::function< Frame(Scalar)> | m_frame_fn |
| Function defining frame orientations along the sweep path. | |
| std::function< Scalar(Scalar)> | m_twist_fn |
| Function defining twist angles along the sweep path. | |
| std::function< Scalar(Scalar)> | m_taper_fn |
| Function defining taper scale factors along the sweep path. | |
| std::function< Scalar(Scalar)> | m_offset_fn |
| Function defining offsets along the sweep path. | |
Configuration class for sweep operations on 3D geometry.
SweepOptions provides a flexible framework for defining sweep transformations that can be applied to 2D profiles to generate 3D geometry. It supports various types of sweeps including linear and circular sweeps, with additional control over frame orientation, twist, taper, and offset along the sweep path.
| Scalar | The scalar type used for computations (e.g., float, double). |
|
static |
Creates a linear sweep configuration from one point to another.
| from | The starting point of the linear sweep relative to the pivot. |
| to | The ending point of the linear sweep relative to the pivot. |
| follow_tangent | Whether the sweep frame should follow the tangent direction. |
|
static |
Creates a circular sweep configuration around a specified axis.
| p | A point defining a point on the circular sweep path relative to the pivot. |
| axis | The axis of rotation for the circular sweep (should be normalized). |
| angle | The angle of the circular sweep in radians (default is 2 * pi for a full circle). |
| follow_tangent | Whether the sweep frame should follow the tangent direction. |
Example:
| std::vector< typename SweepOptions< Scalar >::Transform > sample_transforms | ( | ) | const |
Samples transformation matrices along the sweep path.
| SweepOptions< Scalar >::Transform sample_transform | ( | Scalar | t | ) | const |
Samples the transformation matrix at a specific parameter t.
| t | The parameter value in the domain. |
Samples offset values along the sweep path.
Samples the offset value at a specific parameter t.
| t | The parameter value in the domain. |
|
inline |
Sets the pivot point for the sweep transformation.
Pivot point is the relative origin for the sweep transformations. It is typically set at the center of the profile being swept. By default, it is set to the origin (0, 0, 0).
| pivot | The pivot point to use for transformations. |
|
inline |
Gets the current pivot point.
|
inline |
Sets the normalization transformation applied to the sweep.
Normalization is typically used to normalize the profile curve to fit in a unit box centered at the origin. All sweep transformations will be relative to this normalized space. The default normalization is the identity transformation, meaning no normalization is applied.
| normalization | The normalization transformation to apply. |
|
inline |
Gets the current normalization transformation.
|
inline |
Sets the number of samples to use along the sweep path.
The default number of samples is 16.
| num_samples | The number of samples (must be at least 2). |
| std::runtime_error | if num_samples is less than 2. |
|
inline |
Gets the current number of samples.
|
inline |
Sets whether the sweep should be treated as periodic.
A sweep is periodic (with period 1) if all transformation functions satisfy: f(t) = f(t + 1) for any t, where f represents position, frame, twist, taper, or offset functions. This is useful for closed sweep paths like circles or loops.
| periodic | True if the sweep is periodic (e.g., closed loops). |
|
inline |
Checks if the sweep is configured as periodic.
Sets the parameter domain for sampling transformations.
| domain | A 2-element array defining the start and end of the parameter domain. |
Gets the current parameter domain for sampling transformations.
|
inline |
Checks if the sweep is closed.
A sweep is considered closed if it is periodic and the total length of the sweep path is equal to 1 up to floating point error.
Sets the position function that defines the sweep path.
| fn | A function that maps parameter values to 3D positions along the sweep path. |
|
inline |
Checks if a position function has been set.
Sets the frame function that defines orientation along the sweep path.
The frame function defines a local coordinate system at each point along the sweep path. Each frame should be orthonormal with determinant +1. The last column/basis of the frame matrix should represent the tangent vector of the sweep path at that point.
| fn | A function that maps parameter values in [0,1] to 3x3 orthonormal matrices. |
|
inline |
Checks if a frame function has been set.
Sets the twist function that defines rotation around the sweep path.
The twist function applies additional rotation around the sweep path tangent vector. Twist values are interpreted as radians of rotation.
| fn | A function that maps parameter values in [0,1] to twist angles in radians. |
|
inline |
Checks if a twist function has been set.
Sets the taper function that defines scaling along the sweep path.
The taper function applies uniform scaling to the profile at each point along the sweep. A taper value of 1.0 means no scaling, values > 1.0 expand, values < 1.0 contract.
| fn | A function that maps parameter values in [0,1] to positive scale factors. |
|
inline |
Checks if a taper function has been set.
Sets the offset function that defines offsets along the sweep path.
| fn | A function that maps parameter values to offset distances. |
|
inline |
Checks if an offset function has been set.