Loading...
Searching...
No Matches
TsKnotMap Class Reference

The knots in a spline. More...

#include <knotMap.h>

Public Types

using KnotVec = std::vector< TsKnot >
 
using iterator = KnotVec::iterator
 
using const_iterator = KnotVec::const_iterator
 
using reverse_iterator = KnotVec::reverse_iterator
 
using const_reverse_iterator = KnotVec::const_reverse_iterator
 

Public Member Functions

Construction and value semantics
TS_API TsKnotMap ()
 
TS_API TsKnotMap (std::initializer_list< TsKnot > knots)
 
TS_API bool operator== (const TsKnotMap &other) const
 
TS_API bool operator!= (const TsKnotMap &other) const
 
Iteration

These methods are std::vector-like.

TS_API iterator begin ()
 
TS_API const_iterator begin () const
 
TS_API const_iterator cbegin () const
 
TS_API iterator end ()
 
TS_API const_iterator end () const
 
TS_API const_iterator cend () const
 
TS_API reverse_iterator rbegin ()
 
TS_API const_reverse_iterator rbegin () const
 
TS_API const_reverse_iterator crbegin () const
 
TS_API reverse_iterator rend ()
 
TS_API const_reverse_iterator rend () const
 
TS_API const_reverse_iterator crend () const
 
Size

These methods are std::vector-like.

TS_API size_t size () const
 
TS_API bool empty () const
 
TS_API void reserve (size_t size)
 
Modification

These methods are std::set-like.

TS_API void clear ()
 
TS_API void swap (TsKnotMap &other)
 
TS_API std::pair< iterator, bool > insert (const TsKnot &knot)
 Inserts a knot.
 
TS_API size_t erase (TsTime time)
 Removes the knot at the specified time, if it exists.
 
TS_API iterator erase (iterator i)
 Removes a knot. Returns the iterator after it.
 
TS_API iterator erase (iterator first, iterator last)
 Removes a range of knots. Returns the iterator after the last removed.
 
Searching

These methods are std::map-like.

TS_API iterator find (TsTime time)
 Exact matches only; returns end() if not found.
 
TS_API const_iterator find (TsTime time) const
 Const version of find().
 
TS_API iterator lower_bound (TsTime time)
 If there is a knot at the specified time, returns that.
 
TS_API const_iterator lower_bound (TsTime time) const
 Const version of lower_bound().
 
Non-STL Methods
TS_API iterator FindClosest (TsTime time)
 Returns the knot whose time most closely (or exactly) matches the specified time.
 
TS_API const_iterator FindClosest (TsTime time) const
 Const version of FindClosest().
 
TS_API TfType GetValueType () const
 Returns the value type of the knots, or Unknown if empty.
 
TS_API GfInterval GetTimeSpan () const
 Returns the time interval containing the first and last knot.
 
TS_API bool HasCurveSegments () const
 Returns whether there are any segments with curve interpolation.
 

Friends

class TsSpline
 

Detailed Description

The knots in a spline.

Stored as a vector, but unique and sorted like a map. A knot's time is stored within the knot itself, but is also sometimes used as a key. Some methods are vector-like, some are map-like, and some are set-like.

Separate from TsSpline in order to provide identical operations on different collections of knots. The most straightforward collection is the authored knots, provided by GetKnots, but collections included baked loop knots can also be obtained.

Definition at line 36 of file knotMap.h.

Member Typedef Documentation

◆ const_iterator

using const_iterator = KnotVec::const_iterator

Definition at line 42 of file knotMap.h.

◆ const_reverse_iterator

using const_reverse_iterator = KnotVec::const_reverse_iterator

Definition at line 44 of file knotMap.h.

◆ iterator

using iterator = KnotVec::iterator

Definition at line 41 of file knotMap.h.

◆ KnotVec

using KnotVec = std::vector<TsKnot>

Definition at line 39 of file knotMap.h.

◆ reverse_iterator

using reverse_iterator = KnotVec::reverse_iterator

Definition at line 43 of file knotMap.h.

Member Function Documentation

◆ erase() [1/3]

TS_API iterator erase ( iterator  first,
iterator  last 
)

Removes a range of knots. Returns the iterator after the last removed.

◆ erase() [2/3]

TS_API iterator erase ( iterator  i)

Removes a knot. Returns the iterator after it.

◆ erase() [3/3]

TS_API size_t erase ( TsTime  time)

Removes the knot at the specified time, if it exists.

Returns the number of knots erased (0 or 1).

◆ find() [1/2]

TS_API iterator find ( TsTime  time)

Exact matches only; returns end() if not found.

◆ find() [2/2]

TS_API const_iterator find ( TsTime  time) const

Const version of find().

◆ FindClosest() [1/2]

TS_API iterator FindClosest ( TsTime  time)

Returns the knot whose time most closely (or exactly) matches the specified time.

In case of ties, returns the later knot. If there are no knots, returns end().

◆ FindClosest() [2/2]

TS_API const_iterator FindClosest ( TsTime  time) const

Const version of FindClosest().

◆ GetTimeSpan()

TS_API GfInterval GetTimeSpan ( ) const

Returns the time interval containing the first and last knot.

Returns an empty interval if there are no knots.

◆ GetValueType()

TS_API TfType GetValueType ( ) const

Returns the value type of the knots, or Unknown if empty.

◆ HasCurveSegments()

TS_API bool HasCurveSegments ( ) const

Returns whether there are any segments with curve interpolation.

◆ insert()

TS_API std::pair< iterator, bool > insert ( const TsKnot knot)

Inserts a knot.

If there is already a knot at the same time, nothing is changed. Returns an iterator to the newly inserted knot, or the existing one at the same time. The second member of the returned pair indicates whether an insertion took place.

◆ lower_bound() [1/2]

TS_API iterator lower_bound ( TsTime  time)

If there is a knot at the specified time, returns that.

Otherwise, if there is a knot after the specified time, returns the first such knot. Otherwise returns end().

◆ lower_bound() [2/2]

TS_API const_iterator lower_bound ( TsTime  time) const

Const version of lower_bound().

Friends And Related Function Documentation

◆ TsSpline

friend class TsSpline
friend

Definition at line 209 of file knotMap.h.


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