Loading...
Searching...
No Matches
Ts_Segment Struct Reference

Ts_Segment represents one section of a spline. More...

#include <segment.h>

Public Member Functions

void SetInterp (TsInterpMode interpMode, TsCurveType curveType)
 Set interp from a TsInterpMode and TsCurveType.
 
Ts_Segmentoperator+= (const GfVec2d &delta)
 Add the (timeDelta, valueDelta) contained in the GfVec2d argument to the segment's time and value.
 
Ts_Segmentoperator+= (const double timeDelta)
 Add the timeDelta argument to the segment's time.
 
Ts_Segmentoperator-= (const GfVec2d &delta)
 Subtract the (timeDelta, valueDelta) contained in the GfVec2d argument from the segment's time and value.
 
Ts_Segmentoperator-= (const double timeDelta)
 Subtract the timeDelta argument from the segment's time.
 
template<typename T >
Ts_Segment operator+ (const T &delta) const
 Addition operator.
 
template<typename T >
Ts_Segment operator- (const T &delta) const
 
Ts_Segment operator- () const
 
bool operator== (const Ts_Segment &rhs) const
 Compare for equivalence.
 
bool operator!= (const Ts_Segment &rhs) const
 Not equivalent.
 
bool IsClose (const Ts_Segment &other, const double tolerance) const
 
TS_API double _ComputeDerivative (double u) const
 Compute dv/dt at the value u in the interval [0..1].
 

Public Attributes

GfVec2d p0 = GfVec2d(0)
 
GfVec2d t0 = GfVec2d(0)
 
GfVec2d t1 = GfVec2d(0)
 
GfVec2d p1 = GfVec2d(0)
 
Ts_SegmentInterp interp = Ts_SegmentInterp::ValueBlock
 

Detailed Description

Ts_Segment represents one section of a spline.

It generally contains the "post" side values of one knot (time, value, tangent, and interpolation) and the "pre" side of the next knot (preValue and tangent). There are special case interpolation types for pre- and post-extrapolation and the curve interpolation of TsKnot has been split into separate Bezier and Hermite values.

The data is stored as 4 GfVec2d values that represent (time, value) points that are the knot points and the tangent end points. Note that the tangents are stored as their end points rather than as width and slope as they are in the knots. Also note that held interpolation segments still store the value of the post-side knot even though that value is not used for segment interpolation. This allows the knots to be reconstructed from the segment data.

If the interpolation is PreExtrap or PostExtrap then the starting or ending point (respectively) contains (+/- infinity, slope) rather than (time, value). The straight line is extrapolated to infinity from the other end point of the segment with the given slope.

Definition at line 56 of file segment.h.

Member Function Documentation

◆ _ComputeDerivative()

TS_API double _ComputeDerivative ( double  u) const

Compute dv/dt at the value u in the interval [0..1].

Note: This currently only supports u == 0.0 or u == 1.0.

◆ IsClose()

bool IsClose ( const Ts_Segment other,
const double  tolerance 
) const
inline

Definition at line 165 of file segment.h.

◆ operator!=()

bool operator!= ( const Ts_Segment rhs) const
inline

Not equivalent.

Definition at line 160 of file segment.h.

◆ operator+()

Ts_Segment operator+ ( const T &  delta) const
inline

Addition operator.

Definition at line 115 of file segment.h.

◆ operator+=() [1/2]

Ts_Segment & operator+= ( const double  timeDelta)
inline

Add the timeDelta argument to the segment's time.

Definition at line 80 of file segment.h.

◆ operator+=() [2/2]

Ts_Segment & operator+= ( const GfVec2d delta)
inline

Add the (timeDelta, valueDelta) contained in the GfVec2d argument to the segment's time and value.

Definition at line 69 of file segment.h.

◆ operator-() [1/2]

Ts_Segment operator- ( ) const
inline

Definition at line 132 of file segment.h.

◆ operator-() [2/2]

Ts_Segment operator- ( const T &  delta) const
inline

Definition at line 124 of file segment.h.

◆ operator-=() [1/2]

Ts_Segment & operator-= ( const double  timeDelta)
inline

Subtract the timeDelta argument from the segment's time.

Definition at line 103 of file segment.h.

◆ operator-=() [2/2]

Ts_Segment & operator-= ( const GfVec2d delta)
inline

Subtract the (timeDelta, valueDelta) contained in the GfVec2d argument from the segment's time and value.

Definition at line 92 of file segment.h.

◆ operator==()

bool operator== ( const Ts_Segment rhs) const
inline

Compare for equivalence.

Definition at line 150 of file segment.h.

◆ SetInterp()

void SetInterp ( TsInterpMode  interpMode,
TsCurveType  curveType 
)

Set interp from a TsInterpMode and TsCurveType.

Member Data Documentation

◆ interp

Ts_SegmentInterp interp = Ts_SegmentInterp::ValueBlock

Definition at line 62 of file segment.h.

◆ p0

GfVec2d p0 = GfVec2d(0)

Definition at line 58 of file segment.h.

◆ p1

GfVec2d p1 = GfVec2d(0)

Definition at line 61 of file segment.h.

◆ t0

GfVec2d t0 = GfVec2d(0)

Definition at line 59 of file segment.h.

◆ t1

GfVec2d t1 = GfVec2d(0)

Definition at line 60 of file segment.h.


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