LMinMax Class Reference

#include <c4d_tools.h>

Detailed Description

A class to construct a bounding box around points.

Public Member Functions

 LMinMax ()
 
 LMinMax (const Vector64 &v)
 
void Init ()
 
void Init (const Vector64 &v)
 
void AddPoint (const Vector64 &p)
 
void AddPoints (const Vector64 &a, const Vector64 &b)
 
void Set (const Vector64 &a, const Vector64 &b)
 
Bool IsPopulated () const
 
const Vector64GetMin () const
 
const Vector64GetMax () const
 
Vector64 GetMp () const
 
Vector64 GetRad () const
 
void GetMpRad (Vector64 *mp, Vector64 *rad) const
 

Private Attributes

Vector64 min
 
Vector64 max
 
Bool used
 

Constructor & Destructor Documentation

◆ LMinMax() [1/2]

LMinMax ( )

Default constructor.

◆ LMinMax() [2/2]

LMinMax ( const Vector64 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 ( )

Resets the minimum and maximum to the largest values possible.

◆ Init() [2/2]

void Init ( const Vector64 v)

Initializes the minimum and maximum with vector v.

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

◆ AddPoint()

void AddPoint ( const Vector64 p)

Adds point p and recalculates the minimum and maximum.

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

◆ AddPoints()

void AddPoints ( const Vector64 a,
const Vector64 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 Vector64 a,
const Vector64 b 
)

Sets the minimum and maximum of the bounding box.

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

◆ IsPopulated()

Bool IsPopulated ( ) const

Checks if any points were added.

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

◆ GetMin()

const Vector64& GetMin ( ) const

Gets the minimum of the bounding box.

Returns
The minimum position of the bounds.

◆ GetMax()

const Vector64& GetMax ( ) const

Gets the maximum of the bounding box.

Returns
The maximum position of the bounds.

◆ GetMp()

Vector64 GetMp ( ) const

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

Returns
The center of the bounds.

◆ GetRad()

Vector64 GetRad ( ) const

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

Returns
The size of the bounds.

◆ GetMpRad()

void GetMpRad ( Vector64 mp,
Vector64 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

Vector64 min
private

◆ max

Vector64 max
private

◆ used

Bool used
private