InDesign SDK  20.5
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
PMPoint Class Reference

#include <PMPoint.h>

Public Types

typedef base_type data_type
 

Public Member Functions

constexpr PMPoint () noexcept
 
constexpr PMPoint (const PMPoint &) noexcept=default
 
constexpr PMPoint (PMPoint &&) noexcept=default
 
PMPointoperator= (const PMPoint &) noexcept=default
 
PMPointoperator= (PMPoint &&) noexcept=default
 
constexpr PMPoint (const PMReal &x_orig, const PMReal &y_orig) noexcept
 
constexpr PMPoint (const SysPoint &p) noexcept
 
const PMRealX () const noexcept
 
PMRealX () noexcept
 
void X (const PMReal &xParam) noexcept
 
const PMRealY () const noexcept
 
PMRealY () noexcept
 
void Y (const PMReal &yParam) noexcept
 
PMReal Distance (const PMPoint &otherPt) const
 
PMReal VectorLength () const
 
PMReal VectorAngle () const
 
PMPoint MirrorPoint (const PMPoint &aligningPoint) const
 
PMPoint ProjectOnLine (const PMPoint &pt0, const PMPoint &ptA) const
 
void operator+= (const PMPoint &a)
 
void operator-= (const PMPoint &a)
 
bool operator< (const PMPoint &rhs) const noexcept
 
bool16 ConstrainTo (const PMRect &r)
 
void Round ()
 
void ReadWrite (IPMStream *iPMStream)
 

Friends

class PMRect
 
SysPoint ToSys (const PMPoint &pt)
 
PMPoint operator+ (const PMPoint &a, const PMPoint &b)
 
PMPoint operator- (const PMPoint &a, const PMPoint &b)
 
PMPoint operator- (const PMPoint &a)
 
PMPoint operator* (const PMReal &c, const PMPoint &pt)
 
PMPoint operator* (const PMPoint &pt, const PMReal &c)
 
PMPoint operator* (const PMPoint &a, const PMPoint &b)
 
PMPoint operator/ (const PMPoint &numer, const PMPoint &denom)
 
PMPoint operator/ (const PMPoint &numer, const PMReal &denom)
 
bool16 operator== (const PMPoint &a, const PMPoint &b) noexcept
 
bool16 operator!= (const PMPoint &a, const PMPoint &b) noexcept
 

Detailed Description

Simple class for representing a point in InDesign. Also used to represent a vector. Many of the operations supported by PMPoint interpret the point as a vector - PMPoints may be added together, multiplied by scalar values, have their lengths taken, etc.

See Also
PMReal

Constructor & Destructor Documentation

constexpr PMPoint::PMPoint ()
inlinenoexcept

Default constructor. Initializes this point to the origin (0, 0).

constexpr PMPoint::PMPoint (const PMPoint)
defaultnoexcept

Copy/move constructor & assignments. Initializes this point to the same values as the source point.

Parameters
aPointIN The point to copy
constexpr PMPoint::PMPoint (const PMRealx_orig,
const PMRealy_orig 
)
inlinenoexcept

Constructs this point using specified PMReal x- and y-values.

Parameters
x_origIN The x-value for this point
y_origIN The y-value for this point
constexpr PMPoint::PMPoint (const SysPointp)
inlinenoexcept

Constructs this point from a system point.

Parameters
pIN The system point this point is initialized to

Member Function Documentation

bool16 PMPoint::ConstrainTo (const PMRectr)

Constrains this point to the specified rectangle

Parameters
rIN The rectangle to constrain to
Returns
kTrue if this point was modified while being constrained, else kFalse if the point was already constrained
PMReal PMPoint::Distance (const PMPointotherPt) const
inline

Returns the distance (a^2 + b^2 = c^2) from this point to the otherPt

Parameters
otherPtIN The other point for the distance calculation
Returns
The scalar distance from this point to the other
PMPoint PMPoint::MirrorPoint (const PMPointaligningPoint) const
inline

Returns the mirror of this point, using the specified alignment point.

Parameters
aligningPointIN The point about which the mirror point is calculated
Returns
The mirror of this point
void PMPoint::operator+= (const PMPointa)
inline

Increments this point by the specified (vector) point

Parameters
aIN The amount by which to increment (as a vector)
void PMPoint::operator-= (const PMPointa)
inline

Decrements this point by the specified (vector) point

Parameters
aIN The amount by which to decrement (as a vector)
bool PMPoint::operator< (const PMPointrhs) const
inlinenoexcept

Define a partial ordering on PMPoints so they can be used in associative containers

PMPoint PMPoint::ProjectOnLine (const PMPointpt0,
const PMPointptA 
) const

Projects this point to the line defined by pt0, ptA, keeping the distance to pt0 unchanged.

Parameters
pt0IN The first point defining the line to project to
ptAIN The second point defining the line to project to
Returns
The point, projected on to the line defined by pt0 and ptA
void PMPoint::ReadWrite (IPMStreamiPMStream)

Streams this point to an IPMStream. The point is written out if the stream is writing, and is read in if the stream is reading.

Parameters
iPMStreamIN The stream to which this point is written or read
void PMPoint::Round ()
inline

Rounds this point's x- and y-values.

PMReal PMPoint::VectorAngle () const

Returns the angle (in degrees) of this point, interpreted as a vector

Returns
The angle (in degrees) of this point, interpreted as a vector
PMReal PMPoint::VectorLength () const
inline

Returns the length of the vector represented by this point

Returns
The scalar length of this point, interpreted as a vector
const PMReal& PMPoint::X () const
inlinenoexcept

Const-accessor for this point's x-value.

Returns
Const reference to the point's x-value
PMReal& PMPoint::X ()
inlinenoexcept

Non-const-accessor for this point's x-value.

Returns
Non-const reference to this point's x-value
void PMPoint::X (const PMRealxParam)
inlinenoexcept

Sets the x-value for this point.

Parameters
xParamIN The new x-value for this point
const PMReal& PMPoint::Y () const
inlinenoexcept

Const-accessor for this point's y-value.

Returns
Const reference to this point's y-value
PMReal& PMPoint::Y ()
inlinenoexcept

Non-const-accessor for this point's y-value.

Returns
Non-const reference to this point's y-value
void PMPoint::Y (const PMRealyParam)
inlinenoexcept

Sets the y-value for this point.

Parameters
yParamIN The new y-value for this point

Friends And Related Function Documentation

bool16 operator!= (const PMPointa,
const PMPointb 
)
friend

Compares two points for inequality.

Parameters
aIN First point to compare
bIN Second point to compare
Returns
kTrue if x- and y-values do not match, else kFalse
PMPoint operator* (const PMRealc,
const PMPointpt 
)
friend

Multiplies a point by a scalar: result = PMPoint(pt.x * c, pt.y * c)

Parameters
cIN The scalar to multiply by
ptIN The point to multiply by
Returns
The product of the point and the scalar
PMPoint operator* (const PMPointpt,
const PMRealc 
)
friend

Multiplies a point by a scalar: result = PMPoint(pt.x * c, pt.y * c)

Parameters
ptIN The point to multiply by
cIN The scalar to multiply by
Returns
The product of the point and the scalar
PMPoint operator* (const PMPointa,
const PMPointb 
)
friend

Multiplies two points: result = PMPoint(a.x * b.x, a.y * b.y)

Parameters
aIN The first point to multiply
bIN The second point to multiply
Returns
The product of the two points
PMPoint operator+ (const PMPointa,
const PMPointb 
)
friend

Adds two points: result = PMPoint(a.x + b.x, a.y + b.y)

Parameters
aIN The first point to add
bIN The second point to add
Returns
The sum of the two points
PMPoint operator- (const PMPointa,
const PMPointb 
)
friend

Subtracts two points: result = PMPoint(a.x - b.x, a.y - b.y)

Parameters
aIN The first point to subtract
bIN The second point to subtract
Returns
The difference of the two points
PMPoint operator- (const PMPointa)
friend

Negates a point: result = PMPoint(-a.x, -a.y)

Parameters
aIN The point to negate
Returns
The negated point
PMPoint operator/ (const PMPointnumer,
const PMPointdenom 
)
friend

Divides one point by another: result = PMPoint(numer.x / denom.x, numer.y / denom.y)

Parameters
numerIN The numerator as a PMPoint
denomIN The denomination as a PMPoint
Returns
The divided point
PMPoint operator/ (const PMPointnumer,
const PMRealdenom 
)
friend

Divides a point by a scalar: result = PMPoint(numer.x / denom, numer.y / denom)

Parameters
numerIN The point being divided
denomIN The scalar denominator
Returns
The divided point
bool16 operator== (const PMPointa,
const PMPointb 
)
friend

Compares two points for equality.

Parameters
aIN First point to compare
bIN Second point to compare
Returns
kTrue if x- and y-values match, else kFalse
SysPoint ToSys (const PMPointpt)
friend

Converts a PMPoint to a system point.

Parameters
ptIN The PMPoint to convert
Returns
The equivalent system point