3ds Max C++ API Reference
IPoint2 Class Reference

#include <ipoint2.h>

+ Inheritance diagram for IPoint2:

Public Member Functions

 IPoint2 ()=default
 Initializes all vector components to zero. More...
 
 IPoint2 (const IPoint2 &)=default
 
 IPoint2 (IPoint2 &&)=default
 
IPoint2operator= (const IPoint2 &)=default
 
IPoint2operator= (IPoint2 &&)=default
 
 IPoint2 (int X, int Y)
 
 IPoint2 (int af[2])
 
intoperator[] (int i)
 
const intoperator[] (int i) const
 
 operator int * ()
 
IPoint2 operator- () const
 
IPoint2 operator+ () const
 
IPoint2operator-= (const IPoint2 &)
 
IPoint2operator+= (const IPoint2 &)
 
IPoint2operator*= (const IPoint2 &)
 Member-wise, in-place multiplication of this vector: (x*x, y*y) More...
 
IPoint2operator*= (int)
 
IPoint2operator/= (int)
 
IPoint2 operator- (const IPoint2 &) const
 
IPoint2 operator+ (const IPoint2 &) const
 
int DotProd (const IPoint2 &) const
 
IPoint2 operator* (const IPoint2 &) const
 Member-wise multiplication of two vectors: (x*x, y*y) More...
 
int operator== (const IPoint2 &p) const
 
int operator!= (const IPoint2 &p) const
 

Public Attributes

int x = 0
 
int y = 0
 

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 Point2.

Description:
This class describes a 2D point using int x and y coordinates. Methods are provided to add and subtract points, multiply and divide by scalars, normalize and compute the dot product of two IPoint2s. All methods are implemented by the system.
Data Members:
int x,y;

Constructor & Destructor Documentation

◆ IPoint2() [1/5]

IPoint2 ( )
default

Initializes all vector components to zero.

◆ IPoint2() [2/5]

IPoint2 ( const IPoint2 )
default

◆ IPoint2() [3/5]

IPoint2 ( IPoint2 &&  )
default

◆ IPoint2() [4/5]

IPoint2 ( int  X,
int  Y 
)
inline
Remarks
Constructor. Data members are initialized to X and Y.
50  {
51  x = X;
52  y = Y;
53  }
int y
Definition: ipoint2.h:38
int x
Definition: ipoint2.h:37

◆ IPoint2() [5/5]

IPoint2 ( int  af[2])
inline
Remarks
Constructor. Data members are initialized as x = af[0] and y = af[1].
57  {
58  x = af[0];
59  y = af[1];
60  }

Member Function Documentation

◆ operator=() [1/2]

IPoint2& operator= ( const IPoint2 )
default

◆ operator=() [2/2]

IPoint2& operator= ( IPoint2 &&  )
default

◆ operator[]() [1/2]

int& operator[] ( int  i)
inline
Remarks
Allows access to x, y using the subscript operator.
Returns
An index of 0 will return x, 1 will return y.
66  {
67  DbgAssert((i == 0) || (i == 1));
68  return (&x)[i];
69  }
#define DbgAssert(expr)
Definition: assert1.h:82

◆ operator[]() [2/2]

const int& operator[] ( int  i) const
inline
Remarks
Allows access to x, y using the subscript operator.
Returns
An index of 0 will return x, 1 will return y.
73  {
74  DbgAssert((i == 0) || (i == 1));
75  return (&x)[i];
76  }

◆ operator int *()

operator int * ( )
inline
Remarks
Returns the address of the IPoint2.x.
81  {
82  return (&x);
83  }

◆ operator-() [1/2]

IPoint2 operator- ( ) const
inline
Remarks
Unary -. Negates both x and y.
88  {
89  return (IPoint2(-x, -y));
90  }
IPoint2()=default
Initializes all vector components to zero.

◆ operator+() [1/2]

IPoint2 operator+ ( ) const
inline
Remarks
Unary +. Returns the Ipoint2 unaltered.
93  {
94  return *this;
95  }

◆ operator-=()

IPoint2 & operator-= ( const IPoint2 a)
inline
Remarks
Subtracts a IPoint2 from this IPoint2.
174 {
175  x -= a.x;
176  y -= a.y;
177  return *this;
178 }

◆ operator+=()

IPoint2 & operator+= ( const IPoint2 a)
inline
Remarks
Adds a IPoint2 to this IPoint2.
181 {
182  x += a.x;
183  y += a.y;
184  return *this;
185 }

◆ operator*=() [1/2]

IPoint2 & operator*= ( const IPoint2 rhs)
inline

Member-wise, in-place multiplication of this vector: (x*x, y*y)

188 {
189  x *= rhs.x;
190  y *= rhs.y;
191  return *this;
192 }

◆ operator*=() [2/2]

IPoint2 & operator*= ( int  f)
inline
Remarks
Multiplies this IPoint2 by an integer value.
195 {
196  x *= f;
197  y *= f;
198  return *this;
199 }

◆ operator/=()

IPoint2 & operator/= ( int  f)
inline
Remarks
Divides this IPoint2 by an integer value.
202 {
203  x /= f;
204  y /= f;
205  return *this;
206 }

◆ operator-() [2/2]

IPoint2 operator- ( const IPoint2 b) const
inline
Remarks
Subtracts a IPoint2 from a IPoint2.
209 {
210  return (IPoint2(x - b.x, y - b.y));
211 }

◆ operator+() [2/2]

IPoint2 operator+ ( const IPoint2 b) const
inline
Remarks
Adds a IPoint2 to a IPoint2.
214 {
215  return (IPoint2(x + b.x, y + b.y));
216 }

◆ DotProd()

int DotProd ( const IPoint2 b) const
inline
Remarks
Returns the dot product of two IPoint2's. This is the sum of both x values multiplied together and both y values multiplied together.
Operators:
219 {
220  return (x * b.x + y * b.y);
221 }

◆ operator*()

IPoint2 operator* ( const IPoint2 b) const
inline

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

224 {
225  return IPoint2(x * b.x, y * b.y);
226 }

◆ operator==()

int operator== ( const IPoint2 p) const
inline
Remarks
Equality operator. Compare two IPoint2's.
Returns
Nonzero if the IPoint2's are equal; otherwise 0.

127  {
128  return (x == p.x && y == p.y);
129  }

◆ operator!=()

int operator!= ( const IPoint2 p) const
inline
131  {
132  return (x != p.x || y != p.y);
133  }

Member Data Documentation

◆ x

int x = 0

◆ y

int y = 0