SMinMax Class Reference

#include <c4d_tools.h>

Detailed Description

A class to construct a bounding box around points.

Public Member Functions

 SMinMax ()
 
 SMinMax (const Vector32 &v)
 
void Init (void)
 
void Init (const Vector32 &v)
 
void AddPoint (const Vector32 &p)
 
void AddPoints (const Vector32 &a, const Vector32 &b)
 
void Set (const Vector32 &a, const Vector32 &b)
 
Bool IsPopulated (void) const
 
const Vector32GetMin (void) const
 
const Vector32GetMax (void) const
 
Vector32 GetMp (void) const
 
Vector32 GetRad (void) const
 
void GetMpRad (Vector32 *mp, Vector32 *rad) const
 

Private Attributes

Vector32 min
 
Vector32 max
 
Bool used
 

Constructor & Destructor Documentation

◆ SMinMax() [1/2]

SMinMax ( )

Default constructor.

◆ SMinMax() [2/2]

SMinMax ( const Vector32 v)
explicit

Constructs with vector v set for both the minimum and maximum.

Parameters
[in]vThe vector for minimum and maximum.

Member Function Documentation

◆ Init() [1/2]

void Init ( void  )

Resets the minimum and maximum to the largest values possible.

◆ Init() [2/2]

void Init ( const Vector32 v)

Initializes the minimum and maximum with vector v.

Parameters
[in]vThe value to initialize minimum and maximum.

◆ AddPoint()

void AddPoint ( const Vector32 p)

Adds point p and recalculates the minimum and maximum.

Parameters
[in]pThe point to add into the bounds.

◆ AddPoints()

void AddPoints ( const Vector32 a,
const Vector32 b 
)

Adds points a and b and recalculates the minimum and maximum.

Parameters
[in]aThe minimum point to add into the bounds.
[in]bThe maximum point to add into the bounds.

◆ Set()

void Set ( const Vector32 a,
const Vector32 b 
)

Sets the minimum and maximum of the bounding box.

Parameters
[in]aThe minimum.
[in]bThe maximum.

◆ IsPopulated()

Bool IsPopulated ( void  ) const

Checks if any points were added.

Returns
true if if any points were added to the bounds, otherwise false.

◆ GetMin()

const Vector32& GetMin ( void  ) const

Gets the minimum of the bounding box.

Returns
The minimum position of the bounds.

◆ GetMax()

const Vector32& GetMax ( void  ) const

Gets the maximum of the bounding box.

Returns
The maximum position of the bounds.

◆ GetMp()

Vector32 GetMp ( void  ) const

Gets the middle between the minimum and maximum (the center).

Returns
The center of the bounds.

◆ GetRad()

Vector32 GetRad ( void  ) const

Gets half the distance between the minimum and the maximum (the size).

Returns
The size of the bounds.

◆ GetMpRad()

void GetMpRad ( Vector32 mp,
Vector32 rad 
) const

Gets both the center and size of the bounding box.

Parameters
[out]mpAssigned the center of the bounds.
[out]radAssigned the size of the bounds.

Member Data Documentation

◆ min

Vector32 min
private

◆ max

Vector32 max
private

◆ used

Bool used
private