AGX Dynamics 2.41.1.2
Loading...
Searching...
No Matches
agxUtil::Spline Class Referenceabstract

Base class for splines. More...

#include <Spline.h>

+ Inheritance diagram for agxUtil::Spline:

Classes

class  Point
 Point class for storing 3D point, tension, stretch and curvature. More...
 
class  Tangent
 Tangent. More...
 

Public Types

typedef agx::Vector< PointPointVector
 
typedef agx::Vector< TangentTangentVector
 

Public Member Functions

 Spline ()
 Default constructor.
 
void add (const agx::Vec3 &point, agx::Real tension=Point::DEFAULT_TENSION, agx::Real stretch=Point::DEFAULT_STRETCH, agx::Real curvature=Point::DEFAULT_CURVATURE)
 Add point to the control points given tension (1 max, 0 min) and stretch.
 
 AGXSTREAM_DECLARE_ABSTRACT_SERIALIZABLE (agxUtil::Spline)
 
virtual void clear ()
 Clears control points and tangents.
 
virtual Point evaluate (size_t index, agx::Real t) const =0
 Interpolate from point with index index a time t forward (0 <= t <= 1)
 
size_t getNumPoints () const
 
PointVectorgetPoints ()
 
const PointVectorgetPoints () const
 
virtual Tangent getTangent (size_t, agx::Real) const
 
virtual agx::Real getTension (size_t index, agx::Real time) const
 Linear interpolate of tension from point at index.
 
void restore (agxStream::InputArchive &in) override
 
void store (agxStream::OutputArchive &out) const override
 
virtual void updateTangents ()=0
 All control points are added, computes the tangents.
 
- Public Member Functions inherited from agx::Referenced
 Referenced ()
 Default constructor.
 
 Referenced (const Referenced &)
 
template<typename T >
T * as ()
 Subclass casting.
 
template<typename T >
const T * as () const
 
template<typename T >
T * asSafe ()
 Safe subclass casting, return nullptr if template type does not match.
 
template<typename T >
const T * asSafe () const
 
int getReferenceCount () const
 
template<typename T >
bool is () const
 Subclass test.
 
Referencedoperator= (const Referenced &)
 Assignment operator. Will increment the number of references to the referenced object.
 
void reference (void *ptr=nullptr) const
 Explicitly increment the reference count by one, indicating that this object has another pointer which is referencing it.
 
void unreference (void *ptr=nullptr) const
 Decrement the reference count by one, indicating that a pointer to this object is referencing it.
 
void unreference_nodelete () const
 Decrement the reference count by one, indicating that a pointer to this object is referencing it.
 
- Public Member Functions inherited from agxStream::Serializable
virtual ~Serializable ()
 Destructor for normal C++ use but hidden from SWIG bindings.
 
virtual const char * getClassName () const
 
bool getEnableSerialization () const
 
bool getEnableUuidGeneration ()
 
agx::UInt32 getIndex () const
 This index is given at creation of this object.
 
virtual StorageAgent * getStorageAgent () const =0
 
agx::Uuid getUuid () const
 
bool isFinished () const
 
void setEnableSerialization (bool flag)
 Set to false to disable serialization of this object.
 
void setFinished ()
 Tells this class that it is restored correctly and should not be deleted during destruction of an Archive.
 
void setUuid (const agx::Uuid &uuid)
 Explicitly set a Uuid on a serializable object.
 

Protected Member Functions

virtual ~Spline ()
 
- Protected Member Functions inherited from agx::Referenced
virtual ~Referenced ()
 Destructor.
 
void allocateObserverVector () const
 
void deleteUsingDeleteHandler () const
 
- Protected Member Functions inherited from agxStream::Serializable
 Serializable ()
 Default constructor.
 
 Serializable (const Serializable &other)
 Copy constructor.
 
void generateUuid ()
 

Protected Attributes

PointVector m_points
 
TangentVector m_tangents
 
- Protected Attributes inherited from agx::Referenced
Mutex m_mutex
 
ObserverContainer m_observers
 
AtomicValue m_refCount
 

Additional Inherited Members

- Static Public Member Functions inherited from agx::Referenced
template<typename T >
static bool ValidateCast (const Referenced *object)
 
- Static Public Member Functions inherited from agxStream::Serializable
static void setEnableUuidGeneration (bool flag)
 Specify if there should be UUID:s generated for each new Serializable object. By default it is enabled.
 
- Static Protected Member Functions inherited from agx::Referenced
static DeleteHandlergetDeleteHandler ()
 
static void setDeleteHandler (DeleteHandler *handler)
 Internal: Set a DeleteHandler to which deletion of all referenced counted objects will be delegated to.
 

Detailed Description

Base class for splines.

Definition at line 31 of file Spline.h.

Member Typedef Documentation

◆ PointVector

Definition at line 85 of file Spline.h.

◆ TangentVector

Definition at line 84 of file Spline.h.

Constructor & Destructor Documentation

◆ Spline()

agxUtil::Spline::Spline ( )

Default constructor.

◆ ~Spline()

virtual agxUtil::Spline::~Spline ( )
inlineprotectedvirtual

Definition at line 151 of file Spline.h.

Member Function Documentation

◆ add()

void agxUtil::Spline::add ( const agx::Vec3 point,
agx::Real  tension = Point::DEFAULT_TENSION,
agx::Real  stretch = Point::DEFAULT_STRETCH,
agx::Real  curvature = Point::DEFAULT_CURVATURE 
)

Add point to the control points given tension (1 max, 0 min) and stretch.

Parameters
point- point to be added
tension- tension at the specified point (clamped between 0 and 1)
stretch- specified stretch at the point
curvature- Specified curvature at the point

◆ AGXSTREAM_DECLARE_ABSTRACT_SERIALIZABLE()

agxUtil::Spline::AGXSTREAM_DECLARE_ABSTRACT_SERIALIZABLE ( agxUtil::Spline  )

◆ clear()

virtual void agxUtil::Spline::clear ( )
virtual

Clears control points and tangents.

◆ evaluate()

virtual Point agxUtil::Spline::evaluate ( size_t  index,
agx::Real  t 
) const
pure virtual

Interpolate from point with index index a time t forward (0 <= t <= 1)

Returns
Interpolated point, at a specified segment, at a specified time t.

Implemented in agxUtil::CubicSpline, agxUtil::CardinalSpline, agxUtil::NonUniformCardinalSpline, agxUtil::ParameterizedCatmullRomSpline, agxUtil::BSpline, agxUtil::CPCatmullRomBSpline, and agxUtil::HermiteSpline.

◆ getNumPoints()

size_t agxUtil::Spline::getNumPoints ( ) const
inline
Returns
number of points added

Definition at line 110 of file Spline.h.

◆ getPoints() [1/2]

PointVector & agxUtil::Spline::getPoints ( )
inline
Returns
vector containing the points added (class Spline::Point)

Definition at line 115 of file Spline.h.

◆ getPoints() [2/2]

const PointVector & agxUtil::Spline::getPoints ( ) const
inline
Returns
vector containing the points added (class Spline::Point)

Definition at line 121 of file Spline.h.

◆ getTangent()

virtual Tangent agxUtil::Spline::getTangent ( size_t  ,
agx::Real   
) const
inlinevirtual
Returns
the ith tangent computed (updated after updateTangents call, class Spline::Tangent)

Reimplemented in agxUtil::CubicSpline, agxUtil::CardinalSpline, agxUtil::NonUniformCardinalSpline, agxUtil::ParameterizedCatmullRomSpline, agxUtil::BSpline, agxUtil::CPCatmullRomBSpline, and agxUtil::HermiteSpline.

Definition at line 127 of file Spline.h.

◆ getTension()

agx::Real agxUtil::Spline::getTension ( size_t  index,
agx::Real  time 
) const
inlinevirtual

Linear interpolate of tension from point at index.

Returns
interpolated tension at a given segment, at a specified time

Definition at line 161 of file Spline.h.

References agx::Vector< T, Allocator >::back(), agx::clamp(), agx::equalsZero(), agx::equivalent(), agxUtil::Spline::Point::getTension(), m_points, agx::RealEpsilon, and agx::Container::size().

◆ restore()

void agxUtil::Spline::restore ( agxStream::InputArchive in)
override

◆ store()

void agxUtil::Spline::store ( agxStream::OutputArchive out) const
override

◆ updateTangents()

virtual void agxUtil::Spline::updateTangents ( )
pure virtual

Member Data Documentation

◆ m_points

PointVector agxUtil::Spline::m_points
protected

Definition at line 154 of file Spline.h.

Referenced by getTension().

◆ m_tangents

TangentVector agxUtil::Spline::m_tangents
protected

Definition at line 155 of file Spline.h.


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