Lagrange
Loading...
Searching...
No Matches
SweepPath< _Scalar > Class Template Referenceabstract

Abstract base class for sweep path. More...

#include <lagrange/primitive/legacy/SweepPath.h>

Inheritance diagram for SweepPath< _Scalar >:
CircularArcSweepPath< _Scalar > LinearSweepPath< _Scalar >

Public Types

using Scalar = _Scalar
 
using TransformType = Eigen::Transform<Scalar, 3, Eigen::AffineCompact>
 
using PointType = Eigen::Matrix<Scalar, 1, 3>
 

Public Member Functions

virtual std::unique_ptr< SweepPath< Scalar > > clone () const =0
 Create a deep copy of itself.
 
virtual void initialize ()=0
 Generate transformation matrices based on the setting provided.
 
virtual bool is_closed () const =0
 Whether the sweep path is closed.
 
size_t get_num_samples () const
 The number of samples used to sample along the sweeping path.
 
void set_num_samples (size_t n)
 Set the number of samples for uniform sampling of the sweeping path.
 
const std::vector< Scalar > & get_samples () const
 Samples are always in ascending order going from 0 to 1.
 
void set_samples (std::vector< Scalar > samples)
 Set the sample points.
 
void add_samples (const std::vector< Scalar > &samples)
 Add samples to the existing samples.
 
const std::vector< TransformType > & get_transforms () const
 Retrieve the transforms generated using initialize().
 
std::vector< TransformType > & get_transforms ()
 
std::vector< Scalar > get_offsets () const
 Retrieve the sampled normal offsets.
 
Scalar get_depth_begin () const
 Start sweeping at certain depth along the path.
 
void set_depth_begin (Scalar depth)
 
Scalar get_depth_end () const
 Stop sweeping at certain depth along the path.
 
void set_depth_end (Scalar depth)
 
Scalar get_twist_begin () const
 Twisting angle at the beginning of the sweep path.
 
void set_twist_begin (Scalar twist)
 
Scalar get_twist_end () const
 Twisting angle at the end of the sweep path.
 
void set_twist_end (Scalar twist)
 
Scalar get_taper_begin () const
 Scaling factor at the beginning of the sweep path.
 
void set_taper_begin (Scalar taper)
 
Scalar get_taper_end () const
 Scaling factor at the beginning of the sweep path.
 
void set_taper_end (Scalar taper)
 
const PointType & get_pivot () const
 Twisting and tapering are all with respect to a pivot point.
 
void set_pivot (const PointType &p)
 
void set_offset_fn (std::function< Scalar(Scalar)> fn)
 Offset function provides a mapping from the relative depth (from 0 to 1) to a normal offset amount (measured in 3D Euclidean distance).
 
bool has_offsets () const
 
void set_normalization_transform (const TransformType &transform)
 Sometimes one may want to sweep a normalized profile curve, and update normalization from time to time.
 
const TransformType & get_normalization_transform () const
 
virtual bool operator== (const SweepPath< Scalar > &other) const
 Check if two sweep paths are the same.
 

Protected Member Functions

void clone_settings (SweepPath< Scalar > &other) const
 

Protected Attributes

std::vector< TransformType > m_transforms
 
std::vector< Scalar > m_samples
 should be sorted in ascending order from 0 to 1.
 
TransformType m_normalization = TransformType::Identity()
 
Scalar m_depth_begin = 0
 
Scalar m_depth_end = 1
 
Scalar m_twist_begin = 0
 
Scalar m_twist_end = 0
 
Scalar m_taper_begin = 1
 
Scalar m_taper_end = 1
 
PointType m_pivot {0, 0, 0}
 
std::function< Scalar(Scalar)> m_offset_fn
 

Detailed Description

template<typename _Scalar>
class lagrange::primitive::legacy::SweepPath< _Scalar >

Abstract base class for sweep path.

Usage:

SweepPath* path = ...;
// Optinal pivot point setting.
path->set_pivot(p);
// Optional twist setting.
path->set_twist_begin(0);
path->set_twist_end(2 * lagrange::internal::pi);
// Optional taper setting.
path->set_taper_begin(1);
path->set_taper_end(0.5);
// Optional depth setting.
path->set_depth_begin(0);
path->set_depth_end(length);
// Optional offset setting.
path->set_offset_function(...);
path->set_num_samples(N); // Uniform samples along the path. N>=2.
path->initialize(); // Required.
const auto& transforms = path->get_tranforms();
const auto& offsets = path.get_offsets();
Abstract base class for sweep path.
Definition SweepPath.h:70
void set_num_samples(size_t n)
Set the number of samples for uniform sampling of the sweeping path.
Definition SweepPath.h:105
virtual void initialize()=0
Generate transformation matrices based on the setting provided.
std::vector< Scalar > get_offsets() const
Retrieve the sampled normal offsets.
Definition SweepPath.h:160

where transforms are used to transform profile curves to cross section curves in a swept surface.

Member Function Documentation

◆ clone()

template<typename _Scalar>
virtual std::unique_ptr< SweepPath< Scalar > > clone ( ) const
pure virtual

◆ initialize()

template<typename _Scalar>
virtual void initialize ( )
pure virtual

Generate transformation matrices based on the setting provided.

The generated transforms can be retrieved using get_transforms() method.

Implemented in CircularArcSweepPath< _Scalar >, LinearSweepPath< _Scalar >, and PolylineSweepPath< _VertexArray >.

◆ is_closed()

template<typename _Scalar>
virtual bool is_closed ( ) const
pure virtual

Whether the sweep path is closed.

Implemented in CircularArcSweepPath< _Scalar >, LinearSweepPath< _Scalar >, and PolylineSweepPath< _VertexArray >.

◆ get_num_samples()

template<typename _Scalar>
size_t get_num_samples ( ) const
inline

The number of samples used to sample along the sweeping path.

Each sample corresponds to a new cross section profile curve on the swept surface.

◆ set_samples()

template<typename _Scalar>
void set_samples ( std::vector< Scalar > samples)
inline

Set the sample points.

Parameters
[in]samplesWhere to sample along the sweep path. Must be in the range [0, 1], and must be sorted in ascending order.

◆ add_samples()

template<typename _Scalar>
void add_samples ( const std::vector< Scalar > & samples)
inline

Add samples to the existing samples.

I.e. union samples and m_samples together while keeping the ascending sorted order.

Parameters
[in]samplesAdditional sampling points along the sweep path. Must be sorted in ascending order.

◆ get_depth_begin()

template<typename _Scalar>
Scalar get_depth_begin ( ) const
inline

Start sweeping at certain depth along the path.

Measured in distance unit. Default is 0.

◆ get_depth_end()

template<typename _Scalar>
Scalar get_depth_end ( ) const
inline

Stop sweeping at certain depth along the path.

Measured in distance unit. Default is 1.

◆ get_twist_begin()

template<typename _Scalar>
Scalar get_twist_begin ( ) const
inline

Twisting angle at the beginning of the sweep path.

Unit: radian, default: 0.

◆ get_twist_end()

template<typename _Scalar>
Scalar get_twist_end ( ) const
inline

Twisting angle at the end of the sweep path.

Unit: radian, default: 0.

◆ get_taper_begin()

template<typename _Scalar>
Scalar get_taper_begin ( ) const
inline

Scaling factor at the beginning of the sweep path.

Default: 1.

◆ get_taper_end()

template<typename _Scalar>
Scalar get_taper_end ( ) const
inline

Scaling factor at the beginning of the sweep path.

Default: 1.

◆ get_pivot()

template<typename _Scalar>
const PointType & get_pivot ( ) const
inline

Twisting and tapering are all with respect to a pivot point.

This method sets the pivot point. The default pivot point is the origin.

◆ set_normalization_transform()

template<typename _Scalar>
void set_normalization_transform ( const TransformType & transform)
inline

Sometimes one may want to sweep a normalized profile curve, and update normalization from time to time.

This method sets the normalization transform. By default, normalization transform is identity.

Warning
: Pivot point is a post-normalization quantity, and it will not be updated when normalization changes.

◆ operator==()

template<typename _Scalar>
virtual bool operator== ( const SweepPath< Scalar > & other) const
inlinevirtual

Check if two sweep paths are the same.

Reimplemented in CircularArcSweepPath< _Scalar >, LinearSweepPath< _Scalar >, and PolylineSweepPath< _VertexArray >.


The documentation for this class was generated from the following file: