3ds Max C++ API Reference
DBox2 Class Reference

#include <dbox2.h>

+ Inheritance diagram for DBox2:

Public Member Functions

 DBox2 ()=default
 Constructor. More...
 
 DBox2 (const DBox2 &)=default
 
 DBox2 (DBox2 &&)=default
 
DBox2operator= (const DBox2 &)=default
 
DBox2operator= (DBox2 &&)=default
 
 DBox2 (const DPoint2 &p, const DPoint2 &q)
 Constructor. More...
 
void Init ()
 Initializes this box such that pmin is a very large value while pmax is a small value. More...
 
DPoint2 Min () const
 Returns the minimum corner value. More...
 
DPoint2 Max () const
 Returns the maximum corner value. More...
 
DPoint2 Center () const
 Returns the center of this DBox2 as a DPoint2. More...
 
DPoint2 Width () const
 Returns the width of the box as a DPoint2. More...
 
DBox2operator+= (const DPoint2 &p)
 Expands this DBox2 to include the DPoint2 p. More...
 
DBox2operator+= (const DBox2 &b)
 Expands this DBox2 to include the specified DBox2. More...
 
void Scale (double s)
 Scales this box about its center by the specified scale. More...
 
void Translate (const DPoint2 &p)
 Translates this box by the distance specified. More...
 
void EnlargeBy (double s)
 Enlarges this box. More...
 
int IsEmpty () const
 Determines if the box is empty. More...
 
int Contains (const DPoint2 &p) const
 Determines if the specified point p is contained in this box. More...
 
int Contains (const DBox2 &b) const
 Determines if the specified DBox2 is contained totally within this box. More...
 
int Overlaps (const DBox2 &b) const
 Determines if the specified DBox2 overlaps this box. More...
 

Public Attributes

DPoint2 pmin { DBL_MAX, DBL_MAX }
 The minimum 2D point in this box. More...
 
DPoint2 pmax { DBL_MIN, DBL_MIN }
 The maximum 2D point in this box. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from MaxHeapOperators
static UtilExport voidoperator new (size_t size)
 Standard new operator used to allocate objects If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new (size_t size, const std::nothrow_t &e)
 Standard new operator used to allocate objects if there is insufficient memory, NULL will be returned. More...
 
static UtilExport voidoperator new (size_t size, const char *filename, int line)
 New operator used to allocate objects that takes the filename and line number where the new was called If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new (size_t size, int block_type, const char *filename, int line)
 New operator used to allocate objects that takes the type of memory, filename and line number where the new was called If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new (size_t size, const std::nothrow_t &e, const char *filename, int line)
 New operator used to allocate objects that takes the filename and line number where the new was called If there is insufficient memory, NULL will be returned. More...
 
static UtilExport voidoperator new (size_t size, unsigned long flags)
 New operator used to allocate objects that takes extra flags to specify special operations If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new (size_t size, const std::nothrow_t &e, unsigned long flags)
 New operator used to allocate objects that takes extra flags to specify special operations If there is insufficient memory, NULL will be returned. More...
 
static UtilExport voidoperator new[] (size_t size)
 New operator used to allocate arrays of objects If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new[] (size_t size, const std::nothrow_t &e)
 New operator used to allocate arrays of objects If there is insufficient memory, NULL will be returned. More...
 
static UtilExport voidoperator new[] (size_t size, const char *filename, int line)
 New operator used to allocate arrays of objects If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new[] (size_t size, int block_type, const char *filename, int line)
 New operator used to allocate arrays of objects. More...
 
static UtilExport voidoperator new[] (size_t size, const std::nothrow_t &e, const char *filename, int line)
 New operator used to allocate arrays of objects If there is insufficient memory, NULL will be returned. More...
 
static UtilExport voidoperator new[] (size_t size, unsigned long flags)
 New operator used to allocate arrays of objects If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new[] (size_t size, const std::nothrow_t &e, unsigned long flags)
 New operator used to allocate arrays of objects If there is insufficient memory, NULL will be returned. More...
 
static UtilExport void operator delete (void *ptr)
 Standard delete operator used to deallocate an object If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete (void *ptr, const std::nothrow_t &e)
 Standard delete operator used to deallocate an object If the pointer is invalid, nothing will happen. More...
 
static UtilExport void operator delete (void *ptr, const char *filename, int line)
 Delete operator used to deallocate an object that takes the filename and line number where the delete was called If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete (void *ptr, int block_type, const char *filename, int line)
 Delete operator used to deallocate an object that takes the type of memory, filename and line number where the delete was called If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete (void *ptr, const std::nothrow_t &e, const char *filename, int line)
 Delete operator used to deallocate an object that takes the filename and line number where the delete was called If the pointer is invalid, nothing will happen. More...
 
static UtilExport void operator delete (void *ptr, unsigned long flags)
 Delete operator used to deallocate an object that takes extra flags to specify special operations If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete (void *ptr, const std::nothrow_t &e, unsigned long flags)
 Delete operator used to deallocate an object that takes extra flags to specify special operations If the pointer is invalid, nothing will happen. More...
 
static UtilExport void operator delete[] (void *ptr)
 Standard delete operator used to deallocate an array of objects If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete[] (void *ptr, const std::nothrow_t &e)
 Standard delete operator used to deallocate an array of objects If the pointer is invalid, nothing will happen. More...
 
static UtilExport void operator delete[] (void *ptr, const char *filename, int line)
 Delete operator used to deallocate an array of objects that takes the filename and line number where the delete was called If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete[] (void *ptr, int block_type, const char *filename, int line)
 Delete operator used to deallocate an array of objects that takes the type of memory, filename and line number where the delete was called If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete[] (void *ptr, const std::nothrow_t &e, const char *filename, int line)
 Delete operator used to deallocate an array of objects that takes the filename and line number where the delete was called If the pointer is invalid, nothing will happen. More...
 
static UtilExport void operator delete[] (void *ptr, unsigned long flags)
 Delete operator used to deallocate an array of objects that takes extra flags to specify special operations If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete[] (void *ptr, const std::nothrow_t &e, unsigned long flags)
 Delete operator used to deallocate an array of objects that takes extra flags to specify special operations If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport voidoperator new (size_t size, void *placement_ptr)
 Placement new operator. More...
 
static UtilExport void operator delete (void *ptr, void *placement_ptr)
 Placement delete operator. More...
 
static UtilExport voidaligned_malloc (size_t size, size_t alignment)
 Allocates memory on a specified alignment boundary. More...
 
static UtilExport voidaligned_realloc (void *ptr, size_t size, size_t alignment)
 Reallocates memory on a specified alignment boundary. More...
 
static UtilExport void aligned_free (void *ptr)
 Frees a block of memory that was allocated with aligned_malloc/aligned_realloc. More...
 

Detailed Description

See also
Class DPoint2.

This class represents a 2D box described by two double-precision 2D corner coordinates. DBox2 provides methods that return individual coordinates of the box, scale and translate it, retrieve its center, modify its size, expand it to include points or other boxes, and determine if points are inside the box. All methods are implemented by the system.

Constructor & Destructor Documentation

◆ DBox2() [1/4]

DBox2 ( )
default

Constructor.

The corners of the box are initialized such that the box is 'empty'. See

See also
IsEmpty().

◆ DBox2() [2/4]

DBox2 ( const DBox2 )
default

◆ DBox2() [3/4]

DBox2 ( DBox2 &&  )
default

◆ DBox2() [4/4]

DBox2 ( const DPoint2 p,
const DPoint2 q 
)
inline

Constructor.

The corners of the box are initialized to the points passed.

Parameters
pThe first corner of the box
qThe second corner of the box
49  {
50  pmin = p;
51  pmax = q;
52  }
DPoint2 pmin
The minimum 2D point in this box.
Definition: dbox2.h:30
DPoint2 pmax
The maximum 2D point in this box.
Definition: dbox2.h:33

Member Function Documentation

◆ operator=() [1/2]

DBox2& operator= ( const DBox2 )
default

◆ operator=() [2/2]

DBox2& operator= ( DBox2 &&  )
default

◆ Init()

void Init ( )

Initializes this box such that pmin is a very large value while pmax is a small value.

Thus the box is 'empty'. See

See also
IsEmpty().

◆ Min()

DPoint2 Min ( ) const
inline

Returns the minimum corner value.

Returns
the value of corner pmin
64  {
65  return pmin;
66  }

◆ Max()

DPoint2 Max ( ) const
inline

Returns the maximum corner value.

Returns
the value of corner pmax.
71  {
72  return pmax;
73  }

◆ Center()

DPoint2 Center ( ) const
inline

Returns the center of this DBox2 as a DPoint2.

Returns
the center of the box
78  {
79  return (pmin + pmax) / 2.0;
80  }

◆ Width()

DPoint2 Width ( ) const
inline

Returns the width of the box as a DPoint2.

This is pmax-pmin.

Returns
the width of the box
86  {
87  return (pmax - pmin);
88  }

◆ operator+=() [1/2]

DBox2& operator+= ( const DPoint2 p)

Expands this DBox2 to include the DPoint2 p.

Parameters
pthe DPoint2 to include in the new size
Returns
the resulting box

◆ operator+=() [2/2]

DBox2& operator+= ( const DBox2 b)

Expands this DBox2 to include the specified DBox2.

Parameters
bthe box to include in the new size
Returns
the resulting box

◆ Scale()

void Scale ( double  s)

Scales this box about its center by the specified scale.

Parameters
sSpecifies the scale factor for this DBox2.

◆ Translate()

void Translate ( const DPoint2 p)

Translates this box by the distance specified.

The point is added to each corner.

Parameters
pSpecifies the distance to translate the box.

◆ EnlargeBy()

void EnlargeBy ( double  s)

Enlarges this box.

A DPoint2 is created from s as DPoint2(s,s) and added to pmax and subtracted from pmin. If the box is 'empty', the box is centered at (0,0) and then enlarged.

Parameters
sthe amount to enlarge the box on all sides

◆ IsEmpty()

int IsEmpty ( ) const

Determines if the box is empty.

This indicates the box has not had specific values set by the developer.

Returns
Nonzero if the box is empty; otherwise 0.

◆ Contains() [1/2]

int Contains ( const DPoint2 p) const

Determines if the specified point p is contained in this box.

Parameters
pSpecifies the point to check.
Returns
Nonzero if the specified point is contained in this box, otherwise 0.

◆ Contains() [2/2]

int Contains ( const DBox2 b) const

Determines if the specified DBox2 is contained totally within this box.

Parameters
bSpecifies the box to check.
Returns
Nonzero if the specified box is entirely contained within this box; otherwise 0.

◆ Overlaps()

int Overlaps ( const DBox2 b) const

Determines if the specified DBox2 overlaps this box.

Parameters
bSpecifies the box to check.
Returns
Nonzero if the specified box overlaps this box; otherwise 0.

Member Data Documentation

◆ pmin

DPoint2 pmin { DBL_MAX, DBL_MAX }

The minimum 2D point in this box.

◆ pmax

DPoint2 pmax { DBL_MIN, DBL_MIN }

The maximum 2D point in this box.