3ds Max C++ API Reference
dpoint2.h File Reference
#include "GeomExport.h"
#include "maxheap.h"
#include "point2.h"
#include "assert1.h"
#include <iosfwd>

Classes

class  DPoint2
 Description: This class describes a 2D point using double precision x and y coordinates. More...
 
class  DRay2
 This class describes a vector in space using an origin point p, and a unit direction vector in double precision. More...
 

Functions

double Length (const DPoint2 &p)
 Returns the 'Length' of the point. More...
 
int MaxComponent (const DPoint2 &p)
 Returns the component with the maximum absolute value. More...
 
int MinComponent (const DPoint2 &p)
 Returns the component with the minimum absolute value. More...
 
DPoint2 Normalize (const DPoint2 &p)
 Returns a unit vector. More...
 
DPoint2 operator* (double m, const DPoint2 &p)
 Multiply a DPoint2 by a scalar. More...
 
DPoint2 operator* (const DPoint2 &p, double m)
 Multiply a DPoint2 by a scalar. More...
 
DPoint2 operator/ (const DPoint2 &p, double d)
 Divide a DPoint2 by a scalar. More...
 
std::ostream & operator<< (std::ostream &s, const DPoint2 &p)
 Output a DPoint2 to a std::ostream as text. More...
 
Point2 Point2FromDPoint2 (const DPoint2 &from)
 
double DotProd (const DPoint2 &a, const DPoint2 &b)
 Returns the dot product of two DPoint2s. More...
 
int DoublePrecisionLineSegmentIntersection (const DPoint2 &seg1Start, const DPoint2 &seg1End, const DPoint2 &seg2Start, const DPoint2 &seg2End, DPoint2 &intersectPoint)
 Double-Precision Line Segment Intersection test. More...
 
int DoublePrecisionLineIntersection (const DPoint2 &line1PointA, const DPoint2 &line1PointB, const DPoint2 &line2PointA, const DPoint2 &line2PointB, DPoint2 &intersectPoint)
 Double-Precision Line Intersection test. More...
 

Function Documentation

◆ Length()

double Length ( const DPoint2 p)
inline

Returns the 'Length' of the point.

This is sqrt(v.x*v.x+v.y*v.y)

Parameters
pthe DPoint2 to test
Returns
the length value
272 {
273  return (double)sqrt(v.x * v.x + v.y * v.y);
274 }

◆ MaxComponent()

int MaxComponent ( const DPoint2 p)

Returns the component with the maximum absolute value.

Parameters
pthe DPoint2 to test
Returns
the maximum component (0=x, 1=y).

◆ MinComponent()

int MinComponent ( const DPoint2 p)

Returns the component with the minimum absolute value.

0=x, 1=y.

Parameters
pthe DPoint2 to test
Returns
the minimum component (0=x, 1=y).

◆ Normalize()

DPoint2 Normalize ( const DPoint2 p)

Returns a unit vector.

This is a DPoint2 with each component divided by the point Length().

Parameters
pthe DPoint2 to test
Returns
the unit vector for the specified DPoint2

◆ operator*() [1/2]

DPoint2 operator* ( double  m,
const DPoint2 p 
)
inline

Multiply a DPoint2 by a scalar.

Parameters
mthe multiplier
pthe DPoint2
Returns
the resulting DPoint2
329 {
330  return (DPoint2(a.x * f, a.y * f));
331 }
Description: This class describes a 2D point using double precision x and y coordinates.
Definition: dpoint2.h:24

◆ operator*() [2/2]

DPoint2 operator* ( const DPoint2 p,
double  m 
)
inline

Multiply a DPoint2 by a scalar.

Parameters
pthe DPoint2
mthe multiplier
Returns
the resulting DPoint2
334 {
335  return (DPoint2(a.x * f, a.y * f));
336 }

◆ operator/()

DPoint2 operator/ ( const DPoint2 p,
double  d 
)
inline

Divide a DPoint2 by a scalar.

Parameters
pthe DPoint2
dthe divisor
Returns
the resulting DPoint2
339 {
340  DbgAssert(f != 0.0);
341  double invF = 1.0 / f; // Mimic 2019 behavior
342  return (DPoint2(a.x * invF, a.y * invF));
343 }
#define DbgAssert(expr)
Definition: assert1.h:82

◆ operator<<()

std::ostream& operator<< ( std::ostream &  s,
const DPoint2 p 
)

Output a DPoint2 to a std::ostream as text.

Parameters
sthe std::ostream
pthe DPoint2
Returns
the DPoint2 text value

◆ Point2FromDPoint2()

Point2 Point2FromDPoint2 ( const DPoint2 from)
inline
347 {
348  return Point2(from.x, from.y);
349 }
double y
Definition: dpoint2.h:27
double x
Definition: dpoint2.h:26
Definition: point2.h:44

◆ DotProd()

double DotProd ( const DPoint2 a,
const DPoint2 b 
)

Returns the dot product of two DPoint2s.

◆ DoublePrecisionLineSegmentIntersection()

int DoublePrecisionLineSegmentIntersection ( const DPoint2 seg1Start,
const DPoint2 seg1End,
const DPoint2 seg2Start,
const DPoint2 seg2End,
DPoint2 intersectPoint 
)

Double-Precision Line Segment Intersection test.

Determines if two line segments intersect.

Parameters
seg1Startendpoint 1 for the first line segment
seg1Endendpoint 2 for the first line segment
seg2Startendpoint 1 for the second line segment
seg2Endendpoint 2 for the second line segment
intersectPointif the lines intersect, this will return the intersection point.
Returns
Intersection determination (0: No intersection, 1: Lines intersect (intersection location in 'intersectPoint'), 2: Lines parallel (no intersection))

◆ DoublePrecisionLineIntersection()

int DoublePrecisionLineIntersection ( const DPoint2 line1PointA,
const DPoint2 line1PointB,
const DPoint2 line2PointA,
const DPoint2 line2PointB,
DPoint2 intersectPoint 
)

Double-Precision Line Intersection test.

Determines if two infinite lines cross, and if so, where.

Parameters
line1PointApoint 1 on the first line
line1PointBpoint 2 on the first line
line2PointApoint 1 on the second line
line2PointBpoint 2 on the second line
intersectPointif the lines intersect, this will return the intersection point.
Returns
Intersection determination (0: Lines parallel, 1: Lines intersect (intersection location in 'intersectPoint'))