3ds Max C++ API Reference
IPoint3 Class Reference

#include <ipoint3.h>

Public Member Functions

 IPoint3 ()=default
 Initializes all vector components to zero. More...
 
constexpr IPoint3 (const IPoint3 &)=default
 
constexpr IPoint3 (IPoint3 &&)=default
 
IPoint3operator= (const IPoint3 &)=default
 
IPoint3operator= (IPoint3 &&)=default
 
constexpr IPoint3 (int X, int Y, int Z)
 
constexpr IPoint3 (const int ai[3])
 
intoperator[] (int i)
 
const intoperator[] (int i) const
 
constexpr operator int * ()
 
constexpr operator const int * () const
 
constexpr IPoint3 operator- () const
 
constexpr IPoint3 operator+ () const
 
constexpr int LengthSquared () const
 
float Length () const
 
int MaxComponent () const
 
int MinComponent () const
 
constexpr IPoint3operator-= (const IPoint3 &p)
 
constexpr IPoint3operator+= (const IPoint3 &p)
 
constexpr IPoint3operator*= (const IPoint3 &p)
 Member-wise, in-place multiplication of this vector. More...
 
IPoint3operator/= (const IPoint3 &p)
 Member-wise, in-place division of this vector. More...
 
constexpr IPoint3operator*= (int f)
 
IPoint3operator/= (int f)
 
constexpr IPoint3operator+= (int f)
 
constexpr IPoint3operator-= (int f)
 
constexpr IPoint3 operator- (const IPoint3 &p) const
 
constexpr IPoint3 operator+ (const IPoint3 &p) const
 
constexpr IPoint3 operator* (const IPoint3 &p) const
 Member-wise multiplication of two vectors: (x*x, y*y, z*z) More...
 
IPoint3 operator/ (const IPoint3 &p) const
 Member-wise division of two vectors: (x/x, y/y, z/z) More...
 
constexpr int DotProd (const IPoint3 &p) const
 
constexpr int operator% (const IPoint3 &p) const
 
constexpr IPoint3 CrossProd (const IPoint3 &p) const
 
constexpr IPoint3 operator^ (const IPoint3 &p) const
 
constexpr bool operator== (const IPoint3 &p) const
 
constexpr bool operator!= (const IPoint3 &p) const
 

Public Attributes

int x = 0
 
int y = 0
 
int z = 0
 

Static Public Attributes

static const IPoint3 Origin
 
static const IPoint3 XAxis
 
static const IPoint3 YAxis
 
static const IPoint3 ZAxis
 

Detailed Description

See also
Class Point3.

Description:
This class describes a 3D point using integer 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:
int x,y,z;

Constructor & Destructor Documentation

◆ IPoint3() [1/5]

IPoint3 ( )
default

Initializes all vector components to zero.

◆ IPoint3() [2/5]

constexpr IPoint3 ( const IPoint3 )
constexprdefault

◆ IPoint3() [3/5]

constexpr IPoint3 ( IPoint3 &&  )
constexprdefault

◆ IPoint3() [4/5]

constexpr IPoint3 ( int  X,
int  Y,
int  Z 
)
inlineconstexpr
Remarks
Constructor. x, y, and z are initialized to the values specified.
49 : x(X), y(Y), z(Z) {}
int y
Definition: ipoint3.h:32
int z
Definition: ipoint3.h:33
int x
Definition: ipoint3.h:31

◆ IPoint3() [5/5]

constexpr IPoint3 ( const int  ai[3])
inlineconstexpr
Remarks
Constructor. x, y, and z are initialized to. ai[0], ai[1], and ai[2] respectively.
52 : x(ai[0]), y(ai[1]), z(ai[2]) {}

Member Function Documentation

◆ operator=() [1/2]

IPoint3& operator= ( const IPoint3 )
default

◆ operator=() [2/2]

IPoint3& operator= ( IPoint3 &&  )
default

◆ operator[]() [1/2]

int& operator[] ( int  i)
inline
Remarks
Allows access to x, y and z using the [ ] operator.
Returns
An index of 0 will return x, 1 will return y, 2 will return z.
58  {
59  assert((i >= 0) && (i <= 2));
60  return (&x)[i];
61  }
#define assert(expr)
Definition: assert1.h:81

◆ operator[]() [2/2]

const int& operator[] ( int  i) const
inline
Remarks
Allows access to x, y and z using the [ ] operator.
Returns
An index of 0 will return x, 1 will return y, 2 will return z.
65  {
66  assert((i >= 0) && (i <= 2));
67  return (&x)[i];
68  }

◆ operator int *()

constexpr operator int * ( )
inlineconstexpr
Remarks
Conversion function. Returns the address of the IPoint3.
73  {
74  return &x;
75  }

◆ operator const int *()

constexpr operator const int * ( ) const
inlineconstexpr
77  {
78  return &x;
79  }

◆ operator-() [1/2]

constexpr IPoint3 operator- ( ) const
inlineconstexpr
Remarks
Unary - operator. Negates x, y and z.
84  {
85  return IPoint3(-x, -y, -z);
86  }
IPoint3()=default
Initializes all vector components to zero.

◆ operator+() [1/2]

constexpr IPoint3 operator+ ( ) const
inlineconstexpr
Remarks
Unary +. Returns the point unaltered.
89  {
90  return *this;
91  }

◆ LengthSquared()

constexpr int LengthSquared ( ) const
inlineconstexpr
Remarks
Returns the length squared of the IPoint3
95  {
96  return x * x + y * y + z * z;
97  }

◆ Length()

float Length ( ) const
inline
Remarks
Returns the length of the IPoint3
100  {
101  return sqrtf(float(LengthSquared()));
102  }
constexpr int LengthSquared() const
Definition: ipoint3.h:94

◆ MaxComponent()

int MaxComponent ( ) const
Remarks
Returns the component with the maximum abs value. 0=x, 1=y, 2=z.

◆ MinComponent()

int MinComponent ( ) const
Remarks
Returns the component with the minimum abs value. 0=x, 1=y, 2=z.

◆ operator-=() [1/2]

constexpr IPoint3& operator-= ( const IPoint3 p)
inlineconstexpr
Remarks
Subtracts a IPoint3 from this IPoint3.
112  {
113  x -= p.x;
114  y -= p.y;
115  z -= p.z;
116  return *this;
117  }

◆ operator+=() [1/2]

constexpr IPoint3& operator+= ( const IPoint3 p)
inlineconstexpr
Remarks
Adds a IPoint3 to this IPoint3.
120  {
121  x += p.x;
122  y += p.y;
123  z += p.z;
124  return *this;
125  }

◆ operator*=() [1/2]

constexpr IPoint3& operator*= ( const IPoint3 p)
inlineconstexpr

Member-wise, in-place multiplication of this vector.

128  {
129  x *= p.x;
130  y *= p.y;
131  z *= p.z;
132  return *this;
133  }

◆ operator/=() [1/2]

IPoint3& operator/= ( const IPoint3 p)
inline

Member-wise, in-place division of this vector.

136  {
137  assert(p.x != 0 && p.y != 0 && p.z != 0);
138  x /= p.x;
139  y /= p.y;
140  z /= p.z;
141  return *this;
142  }

◆ operator*=() [2/2]

constexpr IPoint3& operator*= ( int  f)
inlineconstexpr
Remarks
Multiplies this IPoint3 by an integer value.
146  {
147  x *= f;
148  y *= f;
149  z *= f;
150  return *this;
151  }

◆ operator/=() [2/2]

IPoint3& operator/= ( int  f)
inline
Remarks
Divides this IPoint3 by an integer value.
154  {
155  assert(f != 0);
156  x /= f;
157  y /= f;
158  z /= f;
159  return *this;
160  }

◆ operator+=() [2/2]

constexpr IPoint3& operator+= ( int  f)
inlineconstexpr
Remarks
Adds int point value to this IPoint3.
163  {
164  x += f;
165  y += f;
166  z += f;
167  return *this;
168  }

◆ operator-=() [2/2]

constexpr IPoint3& operator-= ( int  f)
inlineconstexpr
Remarks
Subtracts int point value from this IPoint3.
171  {
172  return *this += -f;
173  }

◆ operator-() [2/2]

constexpr IPoint3 operator- ( const IPoint3 p) const
inlineconstexpr
Remarks
Subtracts a IPoint3 from a IPoint3.
178  {
179  return IPoint3(x - p.x, y - p.y, z - p.z);
180  }

◆ operator+() [2/2]

constexpr IPoint3 operator+ ( const IPoint3 p) const
inlineconstexpr
Remarks
Adds a IPoint3 to a IPoint3.
183  {
184  return IPoint3(x + p.x, y + p.y, z + p.z);
185  }

◆ operator*()

constexpr IPoint3 operator* ( const IPoint3 p) const
inlineconstexpr

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

188  {
189  return IPoint3(x * p.x, y * p.y, z * p.z);
190  }

◆ operator/()

IPoint3 operator/ ( const IPoint3 p) const
inline

Member-wise division of two vectors: (x/x, y/y, z/z)

193  {
194  assert(p.x != 0 && p.y != 0 && p.z != 0);
195  return IPoint3(x / p.x, y / p.y, z / p.z);
196  }

◆ DotProd()

constexpr int DotProd ( const IPoint3 p) const
inlineconstexpr
Remarks
Returns the dot product of two IPoint3s.
199  {
200  return x * p.x + y * p.y + z * p.z;
201  }

◆ operator%()

constexpr int operator% ( const IPoint3 p) const
inlineconstexpr
203  {
204  return DotProd(p);
205  }
constexpr int DotProd(const IPoint3 &p) const
Definition: ipoint3.h:198

◆ CrossProd()

constexpr IPoint3 CrossProd ( const IPoint3 p) const
inlineconstexpr
Remarks
The cross product of two IPoint3's (vectors).
209  {
210  return IPoint3(y * p.z - z * p.y, z * p.x - x * p.z, x * p.y - y * p.x);
211  }

◆ operator^()

constexpr IPoint3 operator^ ( const IPoint3 p) const
inlineconstexpr
Remarks
The cross product of two IPoint3's (vectors).
214  {
215  return CrossProd(p);
216  }
constexpr IPoint3 CrossProd(const IPoint3 &p) const
Definition: ipoint3.h:208

◆ operator==()

constexpr bool operator== ( const IPoint3 p) const
inlineconstexpr
Remarks
Test for equality between two IPoint3's.
Returns
true if the IPoint3's are equal; otherwise false.

223  {
224  return x == p.x && y == p.y && z == p.z;
225  }

◆ operator!=()

constexpr bool operator!= ( const IPoint3 p) const
inlineconstexpr
227  {
228  return !(*this == p);
229  }

Member Data Documentation

◆ x

int x = 0

◆ y

int y = 0

◆ z

int z = 0

◆ Origin

const IPoint3 Origin
static

◆ XAxis

const IPoint3 XAxis
static

◆ YAxis

const IPoint3 YAxis
static

◆ ZAxis

const IPoint3 ZAxis
static