SplineMapperInterface Class Reference

#include <splinemapper.h>

Detailed Description

This is the interface for the SplineMapper data type. The data is reference-counted and a copy will automatically be created if a non-const function is called.

Public Member Functions

MAXON_METHOD Vector2d GetPoint (Float positionX) const
 
MAXON_METHOD void GetRange (Vector2d &min, Vector2d &max) const
 
MAXON_METHOD void SetRange (const Vector2d &min, const Vector2d &max)
 
MAXON_METHOD void AdaptRange (const Vector2d &min, const Vector2d &max)
 
MAXON_METHOD Float GetTension () const
 
MAXON_METHOD void SetTension (Float tension)
 
MAXON_METHOD Int GetKnotCount () const
 
MAXON_METHOD SplineMapperKnotGetKnot (Int knotIndex)
 
MAXON_METHOD Bool SetKnot (Int knotIndex, const SplineMapperKnot &knot)
 
MAXON_METHOD Bool IsEqual (const SplineMapperInterface *other, EQUALITY equality) const
 
MAXON_METHOD HashInt GetHashCode () const
 
MAXON_METHOD Result< void > InsertKnot (Int knotIndex, const SplineMapperKnot &knot)
 
MAXON_METHOD Result< IntInsertKnot (Float x, Float y, SPLINEMAPPER_KNOT_FLAGS flags, Bool adaptTangents)
 
MAXON_METHOD Result< void > DeleteKnot (Int knotIndex)
 
MAXON_METHOD void DeleteAllKnots ()
 
MAXON_METHOD const BaseArray< SplineMapperKnot > & GetKnots () const
 
MAXON_METHOD BaseArray< SplineMapperKnot > * GetKnotsRW ()
 
MAXON_METHOD void SortKnots ()
 
MAXON_METHOD Vector2d ClampPosition (const Vector2d &position) const
 

Static Public Member Functions

static MAXON_METHOD Result< void > DescribeIO (const DataSerializeInterface &stream)
 

Private Member Functions

 MAXON_INTERFACE_NONVIRTUAL (SplineMapperInterface, MAXON_REFERENCE_COPY_ON_WRITE, "net.maxon.interface.splinemapper")
 

Member Function Documentation

◆ MAXON_INTERFACE_NONVIRTUAL()

MAXON_INTERFACE_NONVIRTUAL ( SplineMapperInterface  ,
MAXON_REFERENCE_COPY_ON_WRITE  ,
"net.maxon.interface.splinemapper"   
)
private

◆ GetPoint()

MAXON_METHOD Vector2d GetPoint ( Float  positionX) const

Gets a point from its X coordinate. If out of range, the first or last spline knots will be returned.

Note
Make sure knots are sorted before calling this (
See also
SortKnots)
Parameters
[in]positionXThe X coordinate.
Returns
The retrieved position.

◆ GetRange()

MAXON_METHOD void GetRange ( Vector2d min,
Vector2d max 
) const

◆ SetRange()

MAXON_METHOD void SetRange ( const Vector2d min,
const Vector2d max 
)

◆ AdaptRange()

MAXON_METHOD void AdaptRange ( const Vector2d min,
const Vector2d max 
)

◆ GetTension()

MAXON_METHOD Float GetTension ( ) const

◆ SetTension()

MAXON_METHOD void SetTension ( Float  tension)

◆ GetKnotCount()

MAXON_METHOD Int GetKnotCount ( ) const

◆ GetKnot()

MAXON_METHOD SplineMapperKnot* GetKnot ( Int  knotIndex)

◆ SetKnot()

MAXON_METHOD Bool SetKnot ( Int  knotIndex,
const SplineMapperKnot knot 
)

◆ IsEqual()

MAXON_METHOD Bool IsEqual ( const SplineMapperInterface other,
EQUALITY  equality 
) const

Compares this SplineMapper with another if both are identical.

Parameters
[in]otherThe other SplineMapper to compare this object with.
Returns
True if the object is identical.

◆ GetHashCode()

MAXON_METHOD HashInt GetHashCode ( ) const

Returns a hash code for this SplineMapper which depends on the content.

Returns
Hash code for the SplineMapper.

◆ InsertKnot() [1/2]

MAXON_METHOD Result<void> InsertKnot ( Int  knotIndex,
const SplineMapperKnot knot 
)

Inserts a new knot at index position (0 <= position <= GetCount()).

Parameters
[in]knotIndexInsert index (the internal array size will increase and if (0 <= position < GetCount()), the existing elements are moved, but if (position == GetCount()), then element is appended to the end).
[in]knotThe knot to insert

◆ InsertKnot() [2/2]

MAXON_METHOD Result<Int> InsertKnot ( Float  x,
Float  y,
SPLINEMAPPER_KNOT_FLAGS  flags,
Bool  adaptTangents 
)

◆ DeleteKnot()

MAXON_METHOD Result<void> DeleteKnot ( Int  knotIndex)

◆ DeleteAllKnots()

MAXON_METHOD void DeleteAllKnots ( )

◆ GetKnots()

MAXON_METHOD const BaseArray<SplineMapperKnot>& GetKnots ( ) const

Gets the internal array for read-only operations.

Returns
Reference to internal array.

◆ GetKnotsRW()

Gets the internal array for read/write operations.

Returns
Pointer to internal array. It's guaranteed to be valid.

◆ SortKnots()

MAXON_METHOD void SortKnots ( )

Sorts the knots by its position X. Call this when an new knot is added or if a knot postion X has been modified.

◆ ClampPosition()

MAXON_METHOD Vector2d ClampPosition ( const Vector2d position) const

Clamps a position to the defined range (

See also
GetRange(), SetRange()).
Parameters
[in]positionThe position.
Returns
The clamped position.

◆ DescribeIO()

static MAXON_METHOD Result<void> DescribeIO ( const DataSerializeInterface stream)
static

Describe all elements of this class for I/O operations.

Parameters
[in]streamThe stream that is used to register the class members.
Returns
OK on success.