HairCollider Class Reference

#include <lib_hair.h>

Detailed Description

Hair collider class.

Note
Has to be created with Alloc() and destroyed with Free(). Use AutoAlloc to automate the allocation and destruction based on scope.

Public Member Functions

Bool Init (HairGuides *hair)
 
void Release ()
 
Int32 GetClosestPoint (const Vector &p)
 
Bool GetClosestSegment (const Vector &p, Int32 *guide, Int32 *segment, Float *segt)
 
Bool GetParticleIntersection (const Vector &p, const Vector &v, Float r, Int32 *guide, Int32 *segment, Float *segt, Float *rayt)
 

Static Public Member Functions

static HairColliderAlloc ()
 
static void Free (HairCollider *&p)
 

Private Member Functions

 HairCollider ()
 
 ~HairCollider ()
 

Private Attributes

HairColliderData * m_pData
 

Constructor & Destructor Documentation

◆ HairCollider()

HairCollider ( )
private

◆ ~HairCollider()

~HairCollider ( )
private

Member Function Documentation

◆ Alloc()

static HairCollider* Alloc ( )
static

Allocates a hair collider. Destroy the allocated hair collider with Free(). Use AutoAlloc to automate the allocation and destruction based on scope.

Returns
The allocated hair collider, or nullptr if the allocation failed.

◆ Free()

static void Free ( HairCollider *&  p)
static

Destructs hair colliders allocated with Alloc(). Use AutoAlloc to automate the allocation and destruction based on scope.

Parameters
[in,out]pThe hair collider to destruct. If the pointer is nullptr nothing happens. The pointer is assigned nullptr afterwards.

◆ Init()

Bool Init ( HairGuides hair)

Initializes the hair collider.

Parameters
[in]hairThe hair to initialize with.
Returns
true if successful, otherwise false.

◆ Release()

void Release ( )

Releases allocated memory. Called automatically by Free().

◆ GetClosestPoint()

Int32 GetClosestPoint ( const Vector p)

Gets the closest point to p.

Parameters
[in]pThe point to search for.
Returns
The closest point or NOTOK if an error occurred.

◆ GetClosestSegment()

Bool GetClosestSegment ( const Vector p,
Int32 guide,
Int32 segment,
Float segt 
)

Gets the closest segment to p.

Parameters
[in]pThe point to search for.
[out]guideAssigned the guide index.
[out]segmentAssigned the segment index.
[out]segtAssigned the segment t coordinate.
Returns
true if successful, otherwise false.

◆ GetParticleIntersection()

Bool GetParticleIntersection ( const Vector p,
const Vector v,
Float  r,
Int32 guide,
Int32 segment,
Float segt,
Float rayt 
)

Gets the intersection of particle p with vector v, looking within a distance radius of r.

Parameters
[in]pThe point to search for.
[in]vThe vector of particle to search for.
[in]rThe search distance radius.
[out]guideAssigned the guide index.
[out]segmentAssigned the segment index.
[out]segtAssigned the segment t coordinate.
[out]raytAssigned the ray coordinate.
Returns
true if successful, otherwise false.

Member Data Documentation

◆ m_pData

HairColliderData* m_pData
private