Class Point
#include <Point.h >
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.
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. |
Get the x coordinate value
Return value: x
Get the y coordinate value
Return value: y
Get the z coordinate value
Return value: z
double value |
the new x value |
Set the x coordinate value
Return value: an instance of this point
double value |
the new y value |
Set the y coordinate value
Return value: an instance of this point
double value |
the new z value |
Set the z coordinate value
Return value: an instance of this point
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
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
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.
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().
Construct a blank point - at the origin.
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
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
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
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
const Point& p |
the Point with the amount to translate |
Given a point, return the translated point.
Return value: the translated point
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
const Point& p |
the other Point |
Calculate the distance from this Point to the Point provided
Return value: the distance between the points
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
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
const Point& p |
the other Point |
Determine the difference between the x values of the two points
Return value: the difference in x
const Point& p |
the other Point |
Determine the difference between the y values of the two points
Return value: the difference in y
const Point& p |
the other Point |
Determine the difference between the z values of the two points
Return value: the difference in z
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)
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)
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)
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
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
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
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
const Point& p |
the other Point |
Calcualted angle to p, if current point is focus, on the ZY plane.
Return value: the angle
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
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
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
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
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
double precision |
the precision to use Default value: POINT_PRECISION |
Adjust point to align with precision
Return the point at the origin.
Return value: a Point at the origin
Return an invalid point. That is, this point returns true when passed to isInvalid().
Return value: the invalid point
Test if the point is invalid
Return value: true if point is invalid
Test if the point is valid
Return value: true if point is valid (not invalid)
Test if the point is at the origin.
Return value: true if this Point is at the origin
double theta |
amount to rotate |
const Point& focus |
point to rotate around |
Rotate the point clockwise around focus
double theta |
amount to rotate |
const Point& focus |
point to rotate around |
Rotate the point clockwise around focus
double theta |
amount to rotate |
const Point& focus |
point to rotate around |
Rotate the point counter-clockwise around focus
double theta |
amount to rotate |
const Point& focus |
point to rotate around |
Rotate the point counter-clockwise around focus
Return the value of pi.
Return value: pi
double accuracy |
the accuracy to use |
Round the Point to the accuracy
Return value: the Point, rounded
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
const Point& a |
the other Point |
Add two points together and return the new point
Return value: the new point
const Point& a |
the other Point |
Subtract the provided Point from this Point and return the new point.
Return value: the new point
const Point& a |
the other Point |
Add the provided Point to this Point
Return value: the updated Point
const Point& a |
the other Point |
Subtract the provided Point from this Point
Return value: the updated Point
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
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
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.
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
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
Convert the Point to a text string.
Return value: a text representation of the point