UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
UE::Geometry::Spline::TBSpline< VALUETYPE, DEGREE > Class Template Reference

#include <BSpline.h>

+ Inheritance diagram for UE::Geometry::Spline::TBSpline< VALUETYPE, DEGREE >:

Classes

struct  FValidKnotSearchParams
 
struct  THasToString
 
struct  THasToString< T, std::void_t< decltype(std::declval< T >().ToString())> >
 

Public Types

using ValueType = typename TSplineInterface< VALUETYPE >::ValueType
 
using FWindow = TStaticArray< const ValueType *, WindowSize >
 
- Public Types inherited from UE::Geometry::Spline::TSplineInterface< VALUETYPE >
typedef VALUETYPE ValueType
 

Public Member Functions

 DECLARE_SPLINE_TYPE_ID (BSplineNameSelector< DEGREE >::Name, *TSplineValueTypeTraits< VALUETYPE >::Name)
 
 TBSpline ()=default
 
virtual ~TBSpline () override=default
 
void Dump () const
 
virtual void Clear () override
 
virtual bool IsEqual (const ISplineInterface *OtherSpline) const override
 
virtual bool Serialize (FArchive &Ar) override
 
bool operator== (const TBSpline &Other) const
 
virtual FInterval1f GetParameterSpace () const override
 
virtual void SetClosedLoop (bool bClosed) override
 
virtual bool IsClosedLoop () const override
 
virtual TUniquePtr< ISplineInterfaceClone () const override
 
virtual int32 GetNumberOfSegments () const override
 
virtual FInterval1f GetSegmentParameterRange (int32 SegmentIndex) const override
 
virtual ValueType EvaluateImpl (float Parameter) const override
 
virtual float FindNearest (const ValueType &Point, float &OutSquaredDistance) const override
 
int32 NumKeys () const
 
const ValueTypeGetValue (int32 Idx) const
 
int32 AddValue (const ValueType &NewValue)
 
bool SetValue (int32 Idx, const ValueType &NewValue)
 
int32 InsertValue (int32 Idx, const ValueType &NewValue)
 
virtual bool RemoveValue (int32 Index)
 
virtual int32 SetParameter (int32 Index, float NewParameter)
 
virtual float GetParameter (int32 Index) const
 
virtual int32 FindIndexForParameter (float Parameter, float &OutLocalParam) const
 
const TArray< FKnot > & GetKnotVector () const
 
const TArray< FKnot > & GetPairKnots () const
 
void ResetKnotVector ()
 
int32 GetKnotMultiplicity (int32 KnotIndex) const
 
bool SetCustomKnots (const TArray< FKnot > &NewKnots)
 
virtual void Reparameterize (EParameterizationPolicy ParameterizationPolicy)
 
void SetClampedEnds (bool bInClampEnds)
 
bool IsClampedEnds () const
 
FInterval1f GetKnotRange () const
 
- Public Member Functions inherited from UE::Geometry::Spline::TSplineInterface< VALUETYPE >
 TSplineInterface ()
 
virtual ~TSplineInterface () override=default
 
ValueType Evaluate (float Parameter) const
 
virtual FSplineTypeId::IdType GetTypeId () const override
 
virtual FString GetValueTypeName () const override
 
virtual void SetPreInfinityMode (EOutOfBoundsHandlingMode InMode)
 
virtual void SetPostInfinityMode (EOutOfBoundsHandlingMode InMode)
 
virtual EOutOfBoundsHandlingMode GetPreInfinityMode () const
 
virtual EOutOfBoundsHandlingMode GetPostInfinityMode () const
 
- Public Member Functions inherited from UE::Geometry::Spline::ISplineInterface
virtual ~ISplineInterface ()=default
 
virtual FString GetImplementationName () const =0
 

Static Public Attributes

static constexpr int32 Degree = DEGREE
 
static constexpr int32 WindowSize = Degree + 1
 

Protected Member Functions

void SetKnot (int32 KnotIdx, float NewValue)
 
bool RemoveKnot (int32 KnotIdx)
 
void SwapKnots (int32 KnotIdxA, int32 KnotIdxB)
 
bool InsertKnot (FKnot InKnot)
 
float GetNearestAvailableKnotValue (const FValidKnotSearchParams &InSearchParams) const
 
virtual int32 GetExpectedNumKnots () const
 
void GenerateUniformKnots (int32 KnotCount)
 
void GenerateChordLengthKnots (int32 KnotCount)
 
void GenerateCentripetalKnots (int32 KnotCount)
 
void ApplyClampedKnotsMultiplicity ()
 
void UpdateFlatKnotsCache () const
 
void MarkFlatKnotsCacheDirty () const
 
void PrintKnotVector () const
 
- Protected Member Functions inherited from UE::Geometry::Spline::TSplineInterface< VALUETYPE >
float HandleOutOfBounds (float Parameter) const
 

Protected Attributes

TArray< ValueTypeValues
 
TArray< FKnotPairKnots
 
TArray< floatFlatKnots
 
bool bFlatKnotsCacheDirty
 
bool bIsClosedLoop = false
 
bool bClampEnds = true
 
- Protected Attributes inherited from UE::Geometry::Spline::TSplineInterface< VALUETYPE >
EOutOfBoundsHandlingMode PreInfinityMode = EOutOfBoundsHandlingMode::Zero
 
EOutOfBoundsHandlingMode PostInfinityMode = EOutOfBoundsHandlingMode::Zero
 

Friends

FArchiveoperator<< (FArchive &Ar, TBSpline &BSpline)
 

Additional Inherited Members

- Static Public Member Functions inherited from UE::Geometry::Spline::TSplineInterface< VALUETYPE >
static void SetTypeName (const FString &InTypeName)
 

Member Typedef Documentation

◆ FWindow

◆ ValueType

Constructor & Destructor Documentation

◆ TBSpline()

template<typename VALUETYPE , int32 DEGREE>
UE::Geometry::Spline::TBSpline< VALUETYPE, DEGREE >::TBSpline ( )
default

◆ ~TBSpline()

template<typename VALUETYPE , int32 DEGREE>
virtual UE::Geometry::Spline::TBSpline< VALUETYPE, DEGREE >::~TBSpline ( )
overridevirtualdefault

Member Function Documentation

◆ AddValue()

template<typename VALUETYPE , int32 DEGREE>
int32 UE::Geometry::Spline::TBSpline< VALUETYPE, DEGREE >::AddValue ( const ValueType NewValue)
inline

◆ ApplyClampedKnotsMultiplicity()

template<typename VALUETYPE , int32 DEGREE>
void UE::Geometry::Spline::TBSpline< VALUETYPE, DEGREE >::ApplyClampedKnotsMultiplicity ( )
inlineprotected

Applies clamped multiplicity to the knot vector. This ensures that the first and last knots have Degree + 1 multiplicity

◆ Clear()

◆ Clone()

◆ DECLARE_SPLINE_TYPE_ID()

template<typename VALUETYPE , int32 DEGREE>
UE::Geometry::Spline::TBSpline< VALUETYPE, DEGREE >::DECLARE_SPLINE_TYPE_ID ( BSplineNameSelector< DEGREE >::Name  ,
*TSplineValueTypeTraits< VALUETYPE >::Name   
)

◆ Dump()

template<typename VALUETYPE , int32 DEGREE>
void UE::Geometry::Spline::TBSpline< VALUETYPE, DEGREE >::Dump ( ) const
inline

◆ EvaluateImpl()

template<typename VALUETYPE , int32 DEGREE>
virtual ValueType UE::Geometry::Spline::TBSpline< VALUETYPE, DEGREE >::EvaluateImpl ( float  Parameter) const
inlineoverridevirtual

Implementation of evaluate with parameter handling

Implements UE::Geometry::Spline::TSplineInterface< VALUETYPE >.

◆ FindIndexForParameter()

template<typename VALUETYPE , int32 DEGREE>
virtual int32 UE::Geometry::Spline::TBSpline< VALUETYPE, DEGREE >::FindIndexForParameter ( float  Parameter,
float OutLocalParam 
) const
inlinevirtual

◆ FindNearest()

template<typename VALUETYPE , int32 DEGREE>
virtual float UE::Geometry::Spline::TBSpline< VALUETYPE, DEGREE >::FindNearest ( const ValueType Point,
float OutSquaredDistance 
) const
inlineoverridevirtual

Finds the nearest parameter value to a point

Parameters
PointThe point to find nearest to
OutSquaredDistanceThe squared distance to the nearest point
Returns
The parameter value at the nearest point

Implements UE::Geometry::Spline::TSplineInterface< VALUETYPE >.

Reimplemented in UE::Geometry::Spline::TPolyBezierSpline< VALUETYPE >.

◆ GenerateCentripetalKnots()

template<typename VALUETYPE , int32 DEGREE>
void UE::Geometry::Spline::TBSpline< VALUETYPE, DEGREE >::GenerateCentripetalKnots ( int32  KnotCount)
inlineprotected

Generates a knot vector using centripetal parameterization Uses square root of chord lengths which helps prevent cusps and unwanted loops Often provides the most visually pleasing results for interactive curve editing

◆ GenerateChordLengthKnots()

template<typename VALUETYPE , int32 DEGREE>
void UE::Geometry::Spline::TBSpline< VALUETYPE, DEGREE >::GenerateChordLengthKnots ( int32  KnotCount)
inlineprotected

Generates a knot vector based on chord lengths between control points This gives better parameterization when control points are unevenly spaced

◆ GenerateUniformKnots()

template<typename VALUETYPE , int32 DEGREE>
void UE::Geometry::Spline::TBSpline< VALUETYPE, DEGREE >::GenerateUniformKnots ( int32  KnotCount)
inlineprotected

Generates a uniform knot vector with equal spacing For clamped ends, multiplicity of degree+1 is used at endpoints

◆ GetExpectedNumKnots()

template<typename VALUETYPE , int32 DEGREE>
virtual int32 UE::Geometry::Spline::TBSpline< VALUETYPE, DEGREE >::GetExpectedNumKnots ( ) const
inlineprotectedvirtual

◆ GetKnotMultiplicity()

template<typename VALUETYPE , int32 DEGREE>
int32 UE::Geometry::Spline::TBSpline< VALUETYPE, DEGREE >::GetKnotMultiplicity ( int32  KnotIndex) const
inline

Returns how many times a given knot value appears.

Parameters
KnotIndex- Knot value to check
Returns
Number of times the knot appears

◆ GetKnotRange()

template<typename VALUETYPE , int32 DEGREE>
FInterval1f UE::Geometry::Spline::TBSpline< VALUETYPE, DEGREE >::GetKnotRange ( ) const
inline

◆ GetKnotVector()

template<typename VALUETYPE , int32 DEGREE>
const TArray< FKnot > & UE::Geometry::Spline::TBSpline< VALUETYPE, DEGREE >::GetKnotVector ( ) const
inline

◆ GetNearestAvailableKnotValue()

template<typename VALUETYPE , int32 DEGREE>
float UE::Geometry::Spline::TBSpline< VALUETYPE, DEGREE >::GetNearestAvailableKnotValue ( const FValidKnotSearchParams InSearchParams) const
inlineprotected

Finds the nearest available knot value that does not conflict with existing knots.

Parameters
InSearchParams- Describes value to search for and how to search.
Returns
The nearest valid knot parameter that does not conflict with existing knots.

◆ GetNumberOfSegments()

template<typename VALUETYPE , int32 DEGREE>
virtual int32 UE::Geometry::Spline::TBSpline< VALUETYPE, DEGREE >::GetNumberOfSegments ( ) const
inlineoverridevirtual

Returns the number of Bezier segments in the spline

Implements UE::Geometry::Spline::ISplineInterface.

Reimplemented in UE::Geometry::Spline::TPolyBezierSpline< VALUETYPE >.

◆ GetPairKnots()

template<typename VALUETYPE , int32 DEGREE>
const TArray< FKnot > & UE::Geometry::Spline::TBSpline< VALUETYPE, DEGREE >::GetPairKnots ( ) const
inline

◆ GetParameter()

◆ GetParameterSpace()

◆ GetSegmentParameterRange()

template<typename VALUETYPE , int32 DEGREE>
virtual FInterval1f UE::Geometry::Spline::TBSpline< VALUETYPE, DEGREE >::GetSegmentParameterRange ( int32  SegmentIndex) const
inlineoverridevirtual

Maps a segment index to its parameter range

Parameters
SegmentIndex- Index of the segment (0-based)
Returns
True if the segment index is valid and mapping succeeded

Implements UE::Geometry::Spline::ISplineInterface.

Reimplemented in UE::Geometry::Spline::TPolyBezierSpline< VALUETYPE >.

◆ GetValue()

template<typename VALUETYPE , int32 DEGREE>
const ValueType & UE::Geometry::Spline::TBSpline< VALUETYPE, DEGREE >::GetValue ( int32  Idx) const
inline

◆ InsertKnot()

template<typename VALUETYPE , int32 DEGREE>
bool UE::Geometry::Spline::TBSpline< VALUETYPE, DEGREE >::InsertKnot ( FKnot  InKnot)
inlineprotected

Inserts a knot at the specified parameter value

Parameters
InKnot- Knot to insert
Returns
true if knot insertion was successful, false otherwise.

◆ InsertValue()

template<typename VALUETYPE , int32 DEGREE>
int32 UE::Geometry::Spline::TBSpline< VALUETYPE, DEGREE >::InsertValue ( int32  Idx,
const ValueType NewValue 
)
inline

◆ IsClampedEnds()

template<typename VALUETYPE , int32 DEGREE>
bool UE::Geometry::Spline::TBSpline< VALUETYPE, DEGREE >::IsClampedEnds ( ) const
inline

◆ IsClosedLoop()

template<typename VALUETYPE , int32 DEGREE>
virtual bool UE::Geometry::Spline::TBSpline< VALUETYPE, DEGREE >::IsClosedLoop ( ) const
inlineoverridevirtual

◆ IsEqual()

template<typename VALUETYPE , int32 DEGREE>
virtual bool UE::Geometry::Spline::TBSpline< VALUETYPE, DEGREE >::IsEqual ( const ISplineInterface OtherSpline) const
inlineoverridevirtual

◆ MarkFlatKnotsCacheDirty()

template<typename VALUETYPE , int32 DEGREE>
void UE::Geometry::Spline::TBSpline< VALUETYPE, DEGREE >::MarkFlatKnotsCacheDirty ( ) const
inlineprotected

Marks the flat knots cache as dirty.

◆ NumKeys()

template<typename VALUETYPE , int32 DEGREE>
int32 UE::Geometry::Spline::TBSpline< VALUETYPE, DEGREE >::NumKeys ( ) const
inline

◆ operator==()

template<typename VALUETYPE , int32 DEGREE>
bool UE::Geometry::Spline::TBSpline< VALUETYPE, DEGREE >::operator== ( const TBSpline< VALUETYPE, DEGREE > &  Other) const
inline

◆ PrintKnotVector()

template<typename VALUETYPE , int32 DEGREE>
void UE::Geometry::Spline::TBSpline< VALUETYPE, DEGREE >::PrintKnotVector ( ) const
inlineprotected

Prints the knot vector to the log for debugging.

◆ RemoveKnot()

template<typename VALUETYPE , int32 DEGREE>
bool UE::Geometry::Spline::TBSpline< VALUETYPE, DEGREE >::RemoveKnot ( int32  KnotIdx)
inlineprotected

Removes a knot at the specified index.

Parameters
KnotIdx- Index of the knot to remove
Returns
True if the knot was successfully removed, false if index was invalid

◆ RemoveValue()

template<typename VALUETYPE , int32 DEGREE>
virtual bool UE::Geometry::Spline::TBSpline< VALUETYPE, DEGREE >::RemoveValue ( int32  Index)
inlinevirtual

◆ Reparameterize()

template<typename VALUETYPE , int32 DEGREE>
virtual void UE::Geometry::Spline::TBSpline< VALUETYPE, DEGREE >::Reparameterize ( EParameterizationPolicy  ParameterizationPolicy)
inlinevirtual

Updates the knot vector based on current control points and settings

Parameters
Points- Array of control points and their Knots
ParameterizationPolicy- Policy for generating knot vector

Reimplemented in UE::Geometry::Spline::TPolyBezierSpline< VALUETYPE >.

◆ ResetKnotVector()

template<typename VALUETYPE , int32 DEGREE>
void UE::Geometry::Spline::TBSpline< VALUETYPE, DEGREE >::ResetKnotVector ( )
inline

◆ Serialize()

template<typename VALUETYPE , int32 DEGREE>
virtual bool UE::Geometry::Spline::TBSpline< VALUETYPE, DEGREE >::Serialize ( FArchive Ar)
inlineoverridevirtual

Serializes the spline

Reimplemented from UE::Geometry::Spline::TSplineInterface< VALUETYPE >.

◆ SetClampedEnds()

template<typename VALUETYPE , int32 DEGREE>
void UE::Geometry::Spline::TBSpline< VALUETYPE, DEGREE >::SetClampedEnds ( bool  bInClampEnds)
inline

Sets whether the spline should be clamped at endpoints When true, the curve will interpolate the first and last control points

◆ SetClosedLoop()

template<typename VALUETYPE , int32 DEGREE>
virtual void UE::Geometry::Spline::TBSpline< VALUETYPE, DEGREE >::SetClosedLoop ( bool  bClosed)
inlineoverridevirtual

◆ SetCustomKnots()

template<typename VALUETYPE , int32 DEGREE>
bool UE::Geometry::Spline::TBSpline< VALUETYPE, DEGREE >::SetCustomKnots ( const TArray< FKnot > &  NewKnots)
inline

Sets a custom knot vector using explicit knot/multiplicity pairs

Parameters
NewKnots- Array of knot values. Must be non-decreasing and have correct length (see GetExpectedNumKnots)
Returns
True if the knot vector was valid and set successfully

◆ SetKnot()

template<typename VALUETYPE , int32 DEGREE>
void UE::Geometry::Spline::TBSpline< VALUETYPE, DEGREE >::SetKnot ( int32  KnotIdx,
float  NewValue 
)
inlineprotected

Sets the value of a knot

Parameters
KnotIdx- Index of the knot to set
NewValue- Value to set

◆ SetParameter()

◆ SetValue()

template<typename VALUETYPE , int32 DEGREE>
bool UE::Geometry::Spline::TBSpline< VALUETYPE, DEGREE >::SetValue ( int32  Idx,
const ValueType NewValue 
)
inline

◆ SwapKnots()

template<typename VALUETYPE , int32 DEGREE>
void UE::Geometry::Spline::TBSpline< VALUETYPE, DEGREE >::SwapKnots ( int32  KnotIdxA,
int32  KnotIdxB 
)
inlineprotected

Swaps two knots.

Parameters
KnotIdxA- Index of first knot to swap.
KnotIdxB- Index of second knot to swap.

◆ UpdateFlatKnotsCache()

template<typename VALUETYPE , int32 DEGREE>
void UE::Geometry::Spline::TBSpline< VALUETYPE, DEGREE >::UpdateFlatKnotsCache ( ) const
inlineprotected

Updates the flat knot cache from the pair representation if the cache is dirty.

Friends And Related Symbol Documentation

◆ operator<<

template<typename VALUETYPE , int32 DEGREE>
FArchive & operator<< ( FArchive Ar,
TBSpline< VALUETYPE, DEGREE > &  BSpline 
)
friend

Member Data Documentation

◆ bClampEnds

template<typename VALUETYPE , int32 DEGREE>
bool UE::Geometry::Spline::TBSpline< VALUETYPE, DEGREE >::bClampEnds = true
protected

Whether to clamp the endpoints for interpolation of first/last control points

◆ bFlatKnotsCacheDirty

template<typename VALUETYPE , int32 DEGREE>
bool UE::Geometry::Spline::TBSpline< VALUETYPE, DEGREE >::bFlatKnotsCacheDirty
mutableprotected

◆ bIsClosedLoop

template<typename VALUETYPE , int32 DEGREE>
bool UE::Geometry::Spline::TBSpline< VALUETYPE, DEGREE >::bIsClosedLoop = false
protected

◆ Degree

template<typename VALUETYPE , int32 DEGREE>
constexpr int32 UE::Geometry::Spline::TBSpline< VALUETYPE, DEGREE >::Degree = DEGREE
staticconstexpr

◆ FlatKnots

template<typename VALUETYPE , int32 DEGREE>
TArray<float> UE::Geometry::Spline::TBSpline< VALUETYPE, DEGREE >::FlatKnots
mutableprotected

◆ PairKnots

template<typename VALUETYPE , int32 DEGREE>
TArray<FKnot> UE::Geometry::Spline::TBSpline< VALUETYPE, DEGREE >::PairKnots
protected

◆ Values

◆ WindowSize

template<typename VALUETYPE , int32 DEGREE>
constexpr int32 UE::Geometry::Spline::TBSpline< VALUETYPE, DEGREE >::WindowSize = Degree + 1
staticconstexpr

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