SplineLengthData Class Reference

#include <c4d_baseobject.h>

详细描述

Helper class to obtain the length of splines and the natural position along their path.

注意
Has to be created with Alloc() and destroyed with Free() 。使用 AutoAlloc to automate the allocation and destruction based on scope.

公共成员函数

Bool   Init ( SplineObject *op, Int32 segment=0, const 向量 *padr=nullptr)
Float   UniformToNatural ( Float t)
Float   GetLength (void)
Float   GetSegmentLength ( Int32 a, Int32 b)

私有成员函数

  SplineLengthData ()
  ~SplineLengthData ()

Alloc/Free

static SplineLengthData Alloc ()
static void  Free ( SplineLengthData *&bl)

构造函数 & 析构函数文档编制

◆  SplineLengthData()

SplineLengthData () private

◆  ~SplineLengthData()

~ SplineLengthData () private

成员函数文档编制

◆  Alloc()

static SplineLengthData * Alloc ( )
static

Allocates a spline length data. Destroy the allocated spline length data with Free() 。使用 AutoAlloc to automate the allocation and destruction based on scope.

返回
The allocated spline length data, or nullptr if the allocation failed.

◆  Free()

static void Free ( SplineLengthData *&  bl )
static

Destructs spline length data allocated with Alloc() 。使用 AutoAlloc to automate the allocation and destruction based on scope.

参数
[in,out] bl The spline length data to destruct. If the pointer is nullptr nothing happens. The pointer is assigned nullptr afterwards.

◆  Init()

Bool Init ( SplineObject op ,
Int32   segment = 0 ,
const 向量 padr = nullptr  
)

Initializes the spline length data.

警告
Must be called before using UniformToNatural() , GetLength() and GetSegmentLength.
注意
Cannot be used on spline primitives. Call BaseObject::GetRealSpline() to get a real spline first.
参数
[in] op The spline object to initialize. The caller owns the pointed spline object.
[in] segment The segment to use. Decides what spline segment the calculations in SplineLengthData methods will be performed on.
[in] padr For speedup purposes pass a pointer to start of the specified segment in the point array. Otherwise the spline has to search its array manually.
返回
true if the spline length data was initialized successfully, otherwise false .

◆  UniformToNatural()

Float UniformToNatural ( Float   t )

Gets the natural position along the spline, to be used in SplineObject::GetSplinePoint() and SplineObject::GetSplineTangent() , from a uniform position.
The uniform position is with respect to the actual length of the spline, where the natural position only cares about the interpolation of the curve parameter.

警告
Call Init() before using this method.
参数
[in] t The uniform position along the spline.
返回
The natural position in the segment.

◆  GetLength()

Float GetLength ( void  )

Gets the length of the spline.

警告
Call Init() before using this method.
返回
The length of the spline.

◆  GetSegmentLength()

Float GetSegmentLength ( Int32   a ,
Int32   b  
)

Gets the length of a segment.

警告
Call Init() before using this method.
参数
[in] a Start segment.
[in] b End segment.
返回
The segment length.