3ds Max C++ API Reference
DPoint3 Class Reference

class DPoint3 Description: This class describes a 3D point using double precision x, y and z coordinates. More...

#include <dpoint3.h>

+ Inheritance diagram for DPoint3:

Public Member Functions

 DPoint3 ()=default
 Initializes all vector components to zero. More...
 
 DPoint3 (const DPoint3 &)=default
 
 DPoint3 (double X, double Y, double Z)
 Constructor. More...
 
 DPoint3 (const Point3 &a)
 
 DPoint3 (const double af[3])
 Constructor. More...
 
double & operator[] (int i)
 Allows access to x, y and z using the subscript operator. More...
 
const double & operator[] (int i) const
 Allows access to x, y and z using the subscript operator. More...
 
 operator double * ()
 Conversion function. More...
 
 operator Point3 ()
 Convert DPoint3 to Point3. More...
 
DPoint3 operator- () const
 Unary - operator. More...
 
DPoint3 operator+ () const
 Unary +. More...
 
DPoint3operator= (const Point3 &a)
 
DPoint3operator-= (const DPoint3 &)
 Subtracts a DPoint3 from this DPoint3. More...
 
DPoint3operator+= (const DPoint3 &)
 Adds a DPoint3 to this DPoint3. More...
 
DPoint3operator*= (const DPoint3 &)
 Member-wise multiplication of two vectors: (x*x, y*y, z*z) More...
 
DPoint3operator*= (double)
 Each element of this DPoint3 is multiplied by the specified double. More...
 
DPoint3operator/= (double)
 Each element of this DPoint3 is divided by the specified double. More...
 
DPoint3 operator- (const DPoint3 &) const
 Subtracts a DPoint3 from a DPoint3. More...
 
DPoint3 operator+ (const DPoint3 &) const
 Adds a DPoint3 to a DPoint3. More...
 
DPoint3 operator* (const DPoint3 &) const
 Member-wise multiplication of two vectors: (x*x, y*y, z*z) More...
 
DPoint3 operator^ (const DPoint3 &) const
 Computes the cross product of this DPoint3 and the specified DPoint3. More...
 
double Length () const
 Returns the 'Length' of this point (vector). More...
 
double LengthSquared () const
 The 'Length' squared of this point. More...
 
DPoint3Unify ()
 in place normalize More...
 
int MaxComponent () const
 
int MinComponent () const
 
int operator== (const DPoint3 &p) const
 Equality operator. More...
 
int operator!= (const DPoint3 &p) const
 Equality operator. More...
 

Public Attributes

double x = 0.0
 
double y = 0.0
 
double z = 0.0
 

Static Public Attributes

static const DPoint3 Origin
 const for (0,0,0) More...
 
static const DPoint3 XAxis
 const for (1,0,0) More...
 
static const DPoint3 YAxis
 const for (0,1,0) More...
 
static const DPoint3 ZAxis
 const for (0,0,1) 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

class DPoint3 Description: This class describes a 3D point using double precision x, y and z coordinates.

Methods are provided to add and subtract points, multiply and divide by scalars, and element by element multiply and divide two points. All methods are implemented by the system. Data Members: double x,y,z;

Constructor & Destructor Documentation

◆ DPoint3() [1/5]

DPoint3 ( )
default

Initializes all vector components to zero.

◆ DPoint3() [2/5]

DPoint3 ( const DPoint3 )
default

◆ DPoint3() [3/5]

DPoint3 ( double  X,
double  Y,
double  Z 
)
inline

Constructor.

x, y, and z are initialized to the values specified.

39  {
40  x = X;
41  y = Y;
42  z = Z;
43  }
double z
Definition: dpoint3.h:29
double y
Definition: dpoint3.h:28
double x
Definition: dpoint3.h:27

◆ DPoint3() [4/5]

DPoint3 ( const Point3 a)
inline
45  {
46  x = a.x;
47  y = a.y;
48  z = a.z;
49  }
float y
Definition: point3.h:61
float x
Definition: point3.h:60
float z
Definition: point3.h:62

◆ DPoint3() [5/5]

DPoint3 ( const double  af[3])
inline

Constructor.

x, y, and z are initialized to. af[0], af[1], and af[2] respectively. Operators:

55  {
56  x = af[0];
57  y = af[1];
58  z = af[2];
59  }

Member Function Documentation

◆ operator[]() [1/2]

double& operator[] ( int  i)
inline

Allows access to x, y and z using the subscript operator.

Returns
An index of 0 will return x, 1 will return y, 2 will return z.
65  {
66  DbgAssert((i >= 0) && (i <= 2));
67  return (&x)[i];
68  }
#define DbgAssert(expr)
Definition: assert1.h:82

◆ operator[]() [2/2]

const double& operator[] ( int  i) const
inline

Allows access to x, y and z using the subscript operator.

Returns
An index of 0 will return x, 1 will return y, 2 will return z.
72  {
73  DbgAssert((i >= 0) && (i <= 2));
74  return (&x)[i];
75  }

◆ operator double *()

operator double * ( )
inline

Conversion function.

Returns the address of the DPoint3.x

80  {
81  return (&x);
82  }

◆ operator Point3()

operator Point3 ( )
inline

Convert DPoint3 to Point3.

85  {
86  return Point3(x, y, z);
87  }
Definition: point3.h:56

◆ operator-() [1/2]

DPoint3 operator- ( ) const
inline

Unary - operator.

Negates both x, y and z.

92  {
93  return (DPoint3(-x, -y, -z));
94  }
DPoint3()=default
Initializes all vector components to zero.

◆ operator+() [1/2]

DPoint3 operator+ ( ) const
inline

Unary +.

Returns the point unaltered.

97  {
98  return *this;
99  }

◆ operator=()

DPoint3& operator= ( const Point3 a)
inline
103  {
104  x = a.x;
105  y = a.y;
106  z = a.z;
107  return *this;
108  }

◆ operator-=()

DPoint3 & operator-= ( const DPoint3 a)
inline

Subtracts a DPoint3 from this DPoint3.

205 {
206  x -= a.x;
207  y -= a.y;
208  z -= a.z;
209  return *this;
210 }

◆ operator+=()

DPoint3 & operator+= ( const DPoint3 a)
inline

Adds a DPoint3 to this DPoint3.

213 {
214  x += a.x;
215  y += a.y;
216  z += a.z;
217  return *this;
218 }

◆ operator*=() [1/2]

DPoint3 & operator*= ( const DPoint3 rhs)
inline

Member-wise multiplication of two vectors: (x*x, y*y, z*z)

221 {
222  x *= rhs.x;
223  y *= rhs.y;
224  z *= rhs.z;
225  return *this;
226 }

◆ operator*=() [2/2]

DPoint3 & operator*= ( double  f)
inline

Each element of this DPoint3 is multiplied by the specified double.

229 {
230  x *= f;
231  y *= f;
232  z *= f;
233  return *this;
234 }

◆ operator/=()

DPoint3 & operator/= ( double  f)
inline

Each element of this DPoint3 is divided by the specified double.

237 {
238  DbgAssert(f != 0.0);
239  double invF = 1.0 / f; // Mimic 2019 behavior
240  x *= invF;
241  y *= invF;
242  z *= invF;
243  return *this;
244 }

◆ operator-() [2/2]

DPoint3 operator- ( const DPoint3 b) const
inline

Subtracts a DPoint3 from a DPoint3.

247 {
248  return (DPoint3(x - b.x, y - b.y, z - b.z));
249 }

◆ operator+() [2/2]

DPoint3 operator+ ( const DPoint3 b) const
inline

Adds a DPoint3 to a DPoint3.

252 {
253  return (DPoint3(x + b.x, y + b.y, z + b.z));
254 }

◆ operator*()

DPoint3 operator* ( const DPoint3 b) const
inline

Member-wise multiplication of two vectors: (x*x, y*y, z*z)

257 {
258  return DPoint3(x * b.x, y * b.y, z * b.z);
259 }

◆ operator^()

DPoint3 operator^ ( const DPoint3 ) const

Computes the cross product of this DPoint3 and the specified DPoint3.

◆ Length()

double Length ( ) const

Returns the 'Length' of this point (vector).

This is:

sqrt(v.x*v.x+v.y*v.y+v.z*v.z)

◆ LengthSquared()

double LengthSquared ( ) const

The 'Length' squared of this point.

This is v.x*v.x+v.y*v.y+v.z*v.z.

◆ Unify()

DPoint3& Unify ( )

in place normalize

◆ MaxComponent()

int MaxComponent ( ) const
Returns
The largest axis

◆ MinComponent()

int MinComponent ( ) const
Returns
The smallest axis

◆ operator==()

int operator== ( const DPoint3 p) const
inline

Equality operator.

Test for equality between two Point3's.

Returns
Nonzero if the Point3's are equal; otherwise 0.
155  {
156  return ((p.x == x) && (p.y == y) && (p.z == z));
157  }

◆ operator!=()

int operator!= ( const DPoint3 p) const
inline

Equality operator.

Test for nonequality between two Point3's.

Returns
Nonzero if the Point3's are not equal; otherwise 0.
161  {
162  return ((p.x != x) || (p.y != y) || (p.z != z));
163  }

Member Data Documentation

◆ x

double x = 0.0

◆ y

double y = 0.0

◆ z

double z = 0.0

◆ Origin

const DPoint3 Origin
static

const for (0,0,0)

◆ XAxis

const DPoint3 XAxis
static

const for (1,0,0)

◆ YAxis

const DPoint3 YAxis
static

const for (0,1,0)

◆ ZAxis

const DPoint3 ZAxis
static

const for (0,0,1)