Open 3D Engine AzCore API Reference 23.10.0
O3DE is an open-source, fully-featured, high-fidelity, modular 3D engine for building games and simulations, available to every industry.
AZ::BezierSpline Class Reference

#include <Spline.h>

Inherits AZ::Spline.

Classes

struct  BezierData
 

Public Member Functions

 BezierSpline (const BezierSpline &spline)
 
 BezierSpline (const Spline &spline)
 
RaySplineQueryResult GetNearestAddressRay (const Vector3 &localRaySrc, const Vector3 &localRayDir) const override
 
PositionSplineQueryResult GetNearestAddressPosition (const Vector3 &localPos) const override
 
SplineAddress GetAddressByDistance (float distance) const override
 
SplineAddress GetAddressByFraction (float fraction) const override
 
Vector3 GetPosition (const SplineAddress &splineAddress) const override
 
Vector3 GetNormal (const SplineAddress &splineAddress) const override
 
Vector3 GetTangent (const SplineAddress &splineAddress) const override
 
float GetLength (const SplineAddress &splineAddress) const override
 
float GetSplineLength () const override
 
float GetSegmentLength (size_t index) const override
 
size_t GetSegmentCount () const override
 
void GetAabb (Aabb &aabb, const Transform &transform=Transform::CreateIdentity()) const override
 
BezierSplineoperator= (const BezierSpline &spline)
 
BezierSplineoperator= (const Spline &spline)
 
const AZStd::vector< BezierData > & GetBezierData () const
 
- Public Member Functions inherited from AZ::Spline
 Spline (const Spline &spline)
 
virtual RaySplineQueryResult GetNearestAddressRay (const Vector3 &localRaySrc, const Vector3 &localRayDir) const =0
 
virtual PositionSplineQueryResult GetNearestAddressPosition (const Vector3 &localPos) const =0
 
virtual SplineAddress GetAddressByDistance (float distance) const =0
 
virtual SplineAddress GetAddressByFraction (float fraction) const =0
 
virtual Vector3 GetPosition (const SplineAddress &splineAddress) const =0
 
virtual Vector3 GetNormal (const SplineAddress &splineAddress) const =0
 
virtual Vector3 GetTangent (const SplineAddress &splineAddress) const =0
 
virtual float GetLength (const SplineAddress &splineAddress) const =0
 
virtual float GetSplineLength () const =0
 
virtual float GetSegmentLength (size_t index) const =0
 
virtual size_t GetSegmentCount () const =0
 
virtual u16 GetSegmentGranularity () const =0
 
virtual void GetAabb (Aabb &aabb, const Transform &transform=Transform::CreateIdentity()) const =0
 
void SetClosed (bool closed)
 
bool IsClosed () const
 
size_t GetVertexCount () const
 
const AZStd::vector< Vector3 > & GetVertices () const
 
const Vector3GetVertex (size_t index) const
 
void SetCallbacks (const VoidFunction &onChangeElement, const VoidFunction &onChangeContainer, const BoolFunction &onOpenClose)
 
void SetCallbacks (const IndexFunction &onAddVertex, const IndexFunction &onRemoveVertex, const IndexFunction &onUpdateVertex, const VoidFunction &onSetVertices, const VoidFunction &onClearVertices, const BoolFunction &onOpenClose)
 
virtual void OnSplineChanged ()
 

Static Public Member Functions

static void Reflect (SerializeContext &context)
 
- Static Public Member Functions inherited from AZ::Spline
static void Reflect (SerializeContext &context)
 

Protected Member Functions

void OnVertexAdded (size_t index) override
 Internal function to be overridden by derived spline spline to handle custom logic when a vertex is added.
 
void OnVerticesSet () override
 Internal function to be overridden by derived spline spline to handle custom logic when all vertices are set.
 
void OnVertexRemoved (size_t index) override
 Internal function to be overridden by derived spline to handle custom logic when a vertex is removed.
 
void OnSplineChanged () override
 
void OnVerticesCleared () override
 Internal function to be overridden by derived spline to handle custom logic when spline is reset (vertices are cleared).
 
u16 GetSegmentGranularity () const override
 
virtual void OnVertexAdded (size_t index)
 Internal function to be overridden by derived spline spline to handle custom logic when a vertex is added.
 
virtual void OnVerticesSet ()
 Internal function to be overridden by derived spline spline to handle custom logic when all vertices are set.
 
virtual void OnVertexRemoved (size_t index)
 Internal function to be overridden by derived spline to handle custom logic when a vertex is removed.
 
virtual void OnVerticesCleared ()
 Internal function to be overridden by derived spline to handle custom logic when spline is reset (vertices are cleared).
 

Additional Inherited Members

- Public Attributes inherited from AZ::Spline
VertexContainer< Vector3m_vertexContainer
 Vertices representing the spline.
 
- Protected Attributes inherited from AZ::Spline
bool m_closed = false
 Is the spline closed - default is not.
 
- Static Protected Attributes inherited from AZ::Spline
static const float s_splineEpsilon
 Epsilon value for splines to use to check approximate results.
 

Detailed Description

Bezier spline implementation

Member Function Documentation

◆ GetAabb()

void AZ::BezierSpline::GetAabb ( Aabb aabb,
const Transform transform = Transform::CreateIdentity() 
) const
overridevirtual

Gets the Aabb of the vertices in the spline.

Parameters
aabbout param of filled aabb.

Implements AZ::Spline.

◆ GetAddressByDistance()

SplineAddress AZ::BezierSpline::GetAddressByDistance ( float  distance) const
overridevirtual

Return address at distance value - range [0, splineLength].

Parameters
distanceDistance along the spline.
Returns
SplineAddress corresponding to distance.

Implements AZ::Spline.

◆ GetAddressByFraction()

SplineAddress AZ::BezierSpline::GetAddressByFraction ( float  fraction) const
overridevirtual

Return address at fractional value - range [0, 1].

Parameters
fractionfraction/proportion/percentage along the spline.
Returns
SplineAddress corresponding to fraction.

Implements AZ::Spline.

◆ GetBezierData()

const AZStd::vector< BezierData > & AZ::BezierSpline::GetBezierData ( ) const
inline

Return immutable bezier data for each vertex

◆ GetLength()

float AZ::BezierSpline::GetLength ( const SplineAddress splineAddress) const
overridevirtual

Returns spline length from the beginning to the specific point.

Parameters
splineAddressAddress of the point to get the distance to.
Returns
Distance to the address specified along the spline

Implements AZ::Spline.

◆ GetNearestAddressPosition()

PositionSplineQueryResult AZ::BezierSpline::GetNearestAddressPosition ( const Vector3 localPos) const
overridevirtual

Return nearest address on spline from position (local space).

Parameters
localPosPosition in local space of spline (must be transformed prior to being passed).
Returns
SplineAddress closest to given position on spline.

Implements AZ::Spline.

◆ GetNearestAddressRay()

RaySplineQueryResult AZ::BezierSpline::GetNearestAddressRay ( const Vector3 localRaySrc,
const Vector3 localRayDir 
) const
overridevirtual

Return nearest address on spline from ray (local space).

Parameters
localRaySrcPosition of ray in local space of spline (must be transformed prior to being passed).
localRayDirDirection of ray in local space of spline (must be transformed prior to being passed).
Returns
SplineAddress closest to given ray on spline.

Implements AZ::Spline.

◆ GetNormal()

Vector3 AZ::BezierSpline::GetNormal ( const SplineAddress splineAddress) const
overridevirtual

Return normal at SplineAddress (local space).

Parameters
splineAddressAddress representing a point on the spline.
Returns
Normal of given SplineAddress in local space.

Implements AZ::Spline.

◆ GetPosition()

Vector3 AZ::BezierSpline::GetPosition ( const SplineAddress splineAddress) const
overridevirtual

Return position at SplineAddress (local space).

Parameters
splineAddressAddress representing a point on the spline.
Returns
Position of given SplineAddress in local space.

Implements AZ::Spline.

◆ GetSegmentCount()

size_t AZ::BezierSpline::GetSegmentCount ( ) const
overridevirtual

Return number of Segments along spline. Explicitly returns the number of valid/real segments in the spline Some splines technically have invalid segments (example: that lie in the range [0 - 1] and [vertexCount - 2, vertexCount -1] - these will be ignored in the segment count calculation).

Implements AZ::Spline.

◆ GetSegmentGranularity()

u16 AZ::BezierSpline::GetSegmentGranularity ( ) const
inlineoverrideprotectedvirtual

Return the number of parts (lines) that make up a segment (higher granularity - smoother curve).

Implements AZ::Spline.

◆ GetSegmentLength()

float AZ::BezierSpline::GetSegmentLength ( size_t  index) const
overridevirtual

Returns length the segment between vertices - [index, index + 1].

Implements AZ::Spline.

◆ GetSplineLength()

float AZ::BezierSpline::GetSplineLength ( ) const
overridevirtual

Returns total length of spline.

Implements AZ::Spline.

◆ GetTangent()

Vector3 AZ::BezierSpline::GetTangent ( const SplineAddress splineAddress) const
overridevirtual

Return tangent at SplineAddress (local space).

Parameters
splineAddressAddress representing a point on the spline.
Returns
Tangent of given SplineAddress in local space.

Implements AZ::Spline.

◆ OnSplineChanged()

void AZ::BezierSpline::OnSplineChanged ( )
overrideprotectedvirtual

Notification that spline has changed

Reimplemented from AZ::Spline.

◆ OnVertexAdded()

void AZ::BezierSpline::OnVertexAdded ( size_t  index)
overrideprotectedvirtual

Internal function to be overridden by derived spline spline to handle custom logic when a vertex is added.

Reimplemented from AZ::Spline.

◆ OnVertexRemoved()

void AZ::BezierSpline::OnVertexRemoved ( size_t  index)
overrideprotectedvirtual

Internal function to be overridden by derived spline to handle custom logic when a vertex is removed.

Reimplemented from AZ::Spline.

◆ OnVerticesCleared()

void AZ::BezierSpline::OnVerticesCleared ( )
overrideprotectedvirtual

Internal function to be overridden by derived spline to handle custom logic when spline is reset (vertices are cleared).

Reimplemented from AZ::Spline.

◆ OnVerticesSet()

void AZ::BezierSpline::OnVerticesSet ( )
overrideprotectedvirtual

Internal function to be overridden by derived spline spline to handle custom logic when all vertices are set.

Reimplemented from AZ::Spline.


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