14#include <lagrange/internal/constants.h>
15#include <lagrange/utils/assert.h>
17#include <Eigen/Geometry>
23namespace lagrange::primitive {
38template <
typename Scalar>
42 using Point = Eigen::Matrix<Scalar, 1, 3>;
43 using Frame = Eigen::Matrix<Scalar, 3, 3>;
44 using Transform = Eigen::Transform<Scalar, 3, Eigen::AffineCompact>;
56 linear_sweep(
const Point& from,
const Point& to,
bool follow_tangent =
true);
82 Scalar angle =
static_cast<Scalar>(2 * lagrange::internal::pi),
83 bool follow_tangent =
true);
207 domain[0] < domain[1],
208 "Invalid domain: the end value must be greater than the start value.");
Configuration class for sweep operations on 3D geometry.
Definition SweepOptions.h:40
bool has_tapers() const
Checks if a taper function has been set.
Definition SweepOptions.h:296
std::function< Scalar(Scalar)> m_twist_fn
Function defining twist angles along the sweep path.
Definition SweepOptions.h:329
Transform sample_transform(Scalar t) const
Samples the transformation matrix at a specific parameter t.
Definition SweepOptions.cpp:68
const Point & get_pivot() const
Gets the current pivot point.
Definition SweepOptions.h:135
void set_twist_function(std::function< Scalar(Scalar)> fn)
Sets the twist function that defines rotation around the sweep path.
Definition SweepOptions.h:272
bool has_twists() const
Checks if a twist function has been set.
Definition SweepOptions.h:279
size_t get_num_samples() const
Gets the current number of samples.
Definition SweepOptions.h:176
void set_periodic(bool periodic)
Sets whether the sweep should be treated as periodic.
Definition SweepOptions.h:188
void set_offset_function(std::function< Scalar(Scalar)> fn)
Sets the offset function that defines offsets along the sweep path.
Definition SweepOptions.h:303
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.
Definition SweepOptions.cpp:129
std::function< Scalar(Scalar)> m_taper_fn
Function defining taper scale factors along the sweep path.
Definition SweepOptions.h:331
void set_normalization(const Transform &normalization)
Sets the normalization transformation applied to the sweep.
Definition SweepOptions.h:148
bool has_offsets() const
Checks if an offset function has been set.
Definition SweepOptions.h:310
bool has_frames() const
Checks if a frame function has been set.
Definition SweepOptions.h:262
std::function< Scalar(Scalar)> m_offset_fn
Function defining offsets along the sweep path.
Definition SweepOptions.h:333
std::function< Point(Scalar)> m_position_fn
Function defining positions along the sweep path.
Definition SweepOptions.h:325
void set_frame_function(std::function< Frame(Scalar)> fn)
Sets the frame function that defines orientation along the sweep path.
Definition SweepOptions.h:255
void set_num_samples(size_t num_samples)
Sets the number of samples to use along the sweep path.
Definition SweepOptions.h:165
bool is_periodic() const
Checks if the sweep is configured as periodic.
Definition SweepOptions.h:195
bool is_closed() const
Checks if the sweep is closed.
Definition SweepOptions.h:227
size_t m_num_samples
The number of samples along the sweep path.
Definition SweepOptions.h:318
std::function< Frame(Scalar)> m_frame_fn
Function defining frame orientations along the sweep path.
Definition SweepOptions.h:327
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.
Definition SweepOptions.cpp:149
bool m_periodic
Whether the sweep is periodic (closed loop)
Definition SweepOptions.h:320
std::vector< Scalar > sample_offsets() const
Samples offset values along the sweep path.
Definition SweepOptions.cpp:100
bool has_positions() const
Checks if a position function has been set.
Definition SweepOptions.h:244
const std::array< Scalar, 2 > & get_domain() const
Gets the current parameter domain for sampling transformations.
Definition SweepOptions.h:217
void set_domain(std::array< Scalar, 2 > domain)
Sets the parameter domain for sampling transformations.
Definition SweepOptions.h:204
void set_pivot(const Point &pivot)
Sets the pivot point for the sweep transformation.
Definition SweepOptions.h:128
const Transform & get_normalization() const
Gets the current normalization transformation.
Definition SweepOptions.h:155
void set_position_function(std::function< Point(Scalar)> fn)
Sets the position function that defines the sweep path.
Definition SweepOptions.h:237
Transform m_normalization
The normalization transformation applied to the sweep.
Definition SweepOptions.h:316
Scalar sample_offset(Scalar t) const
Samples the offset value at a specific parameter t.
Definition SweepOptions.cpp:121
std::vector< Transform > sample_transforms() const
Samples transformation matrices along the sweep path.
Definition SweepOptions.cpp:26
std::array< Scalar, 2 > m_domain
The parameter domain for sampling transformations.
Definition SweepOptions.h:322
Point m_pivot
The pivot point for sweep transformations.
Definition SweepOptions.h:314
void set_taper_function(std::function< Scalar(Scalar)> fn)
Sets the taper function that defines scaling along the sweep path.
Definition SweepOptions.h:289
@ Scalar
Mesh attribute must have exactly 1 channel.
Definition AttributeFwd.h:56
#define la_runtime_assert(...)
Runtime assertion check.
Definition assert.h:174