Class Point

Index Home MAE > MAE Architecture > MAE Data Types > Class Index > Class Point

Summary
Public Properties
Public Methods
inline double getX() const
inline double getY() const
inline double getZ() const
inline Point& setX(value)
inline Point& setY(value)
inline Point& setZ(value)
inline Point& set(newX, newY, newZ)
inline Point& set(p)
Point(newx, newy, newz)
Point(text)
Point()
inline Point& Shift(p)
inline Point& ShiftXY(dx, dy)
inline Point& ShiftXYZ(dx, dy, dz)
Point& ShiftPolar(radius, theta)
inline Point translate(p) const
inline Point offsetFrom(p) const
double distance(p) const
double distanceXZ(p) const
double distanceXY(p) const
inline double deltax(p) const
inline double deltay(p) const
inline double deltaz(p) const
inline double distancex(p) const
inline double distancey(p) const
inline double distancez(p) const
double inclination(p) const
inline double azimuth(p) const
double angleXY(p) const
double angleXZ(p) const
double angleZY(p) const
inline double angle(p) const
inline bool same(p, tolerance) const
inline bool samexy(p, tolerance) const
inline bool equal(p) const
inline bool flat(p, tolerance) const
void snapToPrecision(precision)
inline static const Point& origin()
static const Point& invalidPoint()
bool isInvalid() const
inline bool valid() const
inline bool isOrigin() const
inline void rotateRight(theta, focus)
inline void rotateCW(theta, focus)
void rotateLeft(theta, focus)
inline void rotateCCW(theta, focus)
inline static double pi()
inline Point& round(accuracy)
inline Point midpoint(p, fraction) const
inline const Point operator+(a) const
inline const Point operator-(a) const
inline Point& operator+=(a)
inline Point& operator-=(a)
inline const Point operator*(a) const
inline Point& operator*=(a)
static void morphPolyline(p, n, focus, angle, scale)
static vector& morphPoints(p, focus, angle, scale)
static inline void morphPoint(pt, focus, angle, scale)
string toString() const

#include <Point.h >

Summary

This class is handy for representing a point in 3-D space. It's just as handy for representing just a point in 2-D space, too.

It holds the (x,y,z) value so a variety of methods can operate on it or between it and other points.

Public Properties

double x

why are these coordinates public!!? Please make them private.

double y

why are these coordinates public!!? Please make them private.

double z

why are these coordinates public!!? Please make them private.


Public Methods

inline double getX() const

Get the x coordinate value

Return value: x

inline double getY() const

Get the y coordinate value

Return value: y

inline double getZ() const

Get the z coordinate value

Return value: z

inline Point& setX(value)

double value

the new x value


Set the x coordinate value

Return value: an instance of this point

inline Point& setY(value)

double value

the new y value


Set the y coordinate value

Return value: an instance of this point

inline Point& setZ(value)

double value

the new z value


Set the z coordinate value

Return value: an instance of this point

inline Point& set(newX, newY, newZ)

double newX

the new x value

double newY

the new y value

double newZ

the new z value

Default value: 0.0


Set the (x,y,z) coordinates for this point

Return value: an instance of this point

inline Point& set(p)

const Point& p

the point to copy (x,y,z) from


Set the (x,y,z) coordinates for this point from another point

Return value: an instance of this point

Point(newx, newy, newz)

double newx

the x value

double newy

the y value

double newz

the z value

Default value: 0.0


Construct a point from (newx,newy,newz) coordinates.

Point(text)

const string& text

the string to convert to a point


Construct a point from a text, where the text takes the form of ( <number >, <number >) or ( <number >, <number >, <number >) as produced by toString().

Point()

Construct a blank point - at the origin.

inline Point& Shift(p)

const Point& p

the Point with the amount to shift


Translate/Shift this point by the Point given.  The (x,y,z) of the new Point is added to this Point.

Return value: an instance of this point

inline Point& ShiftXY(dx, dy)

double dx

the amount to add to this- >x

double dy

the amount to add to this- >y


Translate/Shift the point by the (dx,dy) given.  The (dx,dy) is added to this Point.

Return value: an instance of this point

inline Point& ShiftXYZ(dx, dy, dz)

double dx

the amount to add to this- >x

double dy

the amount to add to this- >y

double dz


Translate/Shift the point by the (dx,dy,dz) given.  The (dx,dy,dz) is added to this Point.

Return value: an instance of this point

Point& ShiftPolar(radius, theta)

double radius

amount to move

double theta

direction to move, in radians


Adjust/translate point relative to old using polar coordinates given.

Return value: an instance of this point

inline Point translate(p) const

const Point& p

the Point with the amount to translate


Given a point, return the translated point.

Return value: the translated point

inline Point offsetFrom(p) const

const Point& p

the Point with the amount to subtract


Reverse-shift thie point by the amount in the Point provided.  The (x,y,z) of the new Point is subtracted from this Point to form a new point.

Return value: the offset Point

double distance(p) const

const Point& p

the other Point


Calculate the distance from this Point to the Point provided

Return value: the distance between the points

double distanceXZ(p) const

const Point& p

the other Point


Calculate the distance on the XZ plane from this Point to the Point provided, ignoring any y-axis difference.

Return value: the distance between the points

double distanceXY(p) const

const Point& p

the other Point


Calculate the distance on the XY plane from this Point to the Point provided, ignoring any z-axis difference.

Return value: the distance between the points

inline double deltax(p) const

const Point& p

the other Point


Determine the difference between the x values of the two points

Return value: the difference in x

inline double deltay(p) const

const Point& p

the other Point


Determine the difference between the y values of the two points

Return value: the difference in y

inline double deltaz(p) const

const Point& p

the other Point


Determine the difference between the z values of the two points

Return value: the difference in z

inline double distancex(p) const

const Point& p

the other Point


The absolute (positive) distance between the x values of the two points.

Return value: the absolute distance in x (0 or positive)

inline double distancey(p) const

const Point& p

the other Point


The absolute (positive) distance between the y values of the two points.

Return value: the absolute distance in y (0 or positive)

inline double distancez(p) const

const Point& p

the other Point


The absolute (positive) distance between the z values of the two points.

Return value: the absolute distance in z (0 or positive)

double inclination(p) const

const Point& p

the other Point


Calculate theta, the inclination angle to p, where current point is focus. Useful for creating polar coordinates.

Return value: the angle, theta

inline double azimuth(p) const

const Point& p

the other Point


Calculate phi, the aizmuth angle to p, where current point is focus.  Useful for creating 3-D polar coordinates.

Return value: the angle

double angleXY(p) const

const Point& p

the other Point


Calculate phi, angle to p, where current point is focus, on the XY plane.

Return value: the angle, phi

double angleXZ(p) const

const Point& p

the other Point


Calculate theta, angle to p, if current point is focus, on the XZ plane.

Return value: the angle, theta

double angleZY(p) const

const Point& p

the other Point


Calcualted angle to p, if current point is focus, on the ZY plane.

Return value: the angle

inline double angle(p) const

const Point& p

the other Point


Calculate phi, angle to p, where current point is focus, on the XY plane.

Return value: the angle, phi

inline bool same(p, tolerance) const

const Point& p

the other Point

double tolerance

the precision to use

Default value: POINT_PRECISION


Determine if this (x,y,z) point and the provided (x,y,z) point are the same, within a precision tolerance

Return value: true if both points are the same, within tolerance

inline bool samexy(p, tolerance) const

const Point& p

the other Point

double tolerance

the precision to use

Default value: POINT_PRECISION


Determine if this (x,y) point and the provided (x,y) point are the same, within a precision tolerance

Return value: true if both points are the same, within tolerance

inline bool equal(p) const

const Point& p

the other Point


Determine if this point is equal to the provided point. This is not best practice for comparing double values; instead use same().

Return value: true if both points are equal

inline bool flat(p, tolerance) const

const Point& p

the other Point

double tolerance

the precision to use

Default value: POINT_PRECISION


Determine if this point and the provided point lie in the same x-y plane (same z value) within the tolerance provided.

Return value: true if both points have the same z value within tolerance

void snapToPrecision(precision)

double precision

the precision to use

Default value: POINT_PRECISION


Adjust point to align with precision

inline static const Point& origin()

Return the point at the origin.

Return value: a Point at the origin

static const Point& invalidPoint()

Return an invalid point. That is, this point returns true when passed to isInvalid().

Return value: the invalid point

bool isInvalid() const

Test if the point is invalid

Return value: true if point is invalid

inline bool valid() const

Test if the point is valid

Return value: true if point is valid (not invalid)

inline bool isOrigin() const

Test if the point is at the origin.

Return value: true if this Point is at the origin

inline void rotateRight(theta, focus)

double theta

amount to rotate

const Point& focus

point to rotate around


Rotate the point clockwise around focus

inline void rotateCW(theta, focus)

double theta

amount to rotate

const Point& focus

point to rotate around


Rotate the point clockwise around focus

void rotateLeft(theta, focus)

double theta

amount to rotate

const Point& focus

point to rotate around


Rotate the point counter-clockwise around focus

inline void rotateCCW(theta, focus)

double theta

amount to rotate

const Point& focus

point to rotate around


Rotate the point counter-clockwise around focus

inline static double pi()

Return the value of pi.

Return value: pi

inline Point& round(accuracy)

double accuracy

the accuracy to use


Round the Point to the accuracy

Return value: the Point, rounded

inline Point midpoint(p, fraction) const

const Point& p

the other Point

double fraction

the fraction of the way from this Point to other Point to calculate

Default value: .5


Determine a midpoint a certain fraction of the way from this point to p

If fraction not specified, then half-way point returned

inline const Point operator+(a) const

const Point& a

the other Point


Add two points together and return the new point

Return value: the new point

inline const Point operator-(a) const

const Point& a

the other Point


Subtract the provided Point from this Point and return the new point.

Return value: the new point

inline Point& operator+=(a)

const Point& a

the other Point


Add the provided Point to this Point

Return value: the updated Point

inline Point& operator-=(a)

const Point& a

the other Point


Subtract the provided Point from this Point

Return value: the updated Point

inline const Point operator*(a) const

const double& a

the amount to scale the point


Scale this point out by the amount provided from the origin and return the new point.

Return value: the new Point

inline Point& operator*=(a)

const double& a

the amount to scale the point


Scale this point out by the amount provided from the origin.

Return value: the updated Point

static void morphPolyline(p, n, focus, angle, scale)

Point* p

an array of Points (is modified)

int n

the number of Points in array

const Point& focus

a Point of focus for rotation and scale

double angle

the amount to rotate each p[] around the focus

double scale

the amount to scale each p[] from the focus


Given an array of Points, rotate and scale them around a focus Point.

static vector <Point >& morphPoints(p, focus, angle, scale)

vector <Point >& p

an vector of Points (is modified)

const Point& focus

a Point of focus for rotation and scale

double angle

the amount to rotate each p[] around the focus

double scale

the amount to scale each p[] from the focus


Given an vector of Points, rotate and scale them around a focus Point.

Return value: the udpated vector of Points

static inline void morphPoint(pt, focus, angle, scale)

Point& pt

the Point (is modified)

const Point& focus

a Point of focus for rotation and scale

double angle

the amount to rotate pt around the focus

double scale

the amount to scale pt from the focus


Given a Point, rotate and scale it around a focus Point.

Return value: the udpated Point

string toString() const

Convert the Point to a text string.

Return value: a text representation of the point