#include <point3.h>
Public Member Functions | |
Point3 () | |
Initializes all components to zero. | |
Point3 (float c) | |
Initializes all components to the given real number c. | |
Point3 (float _x, float _y, float _z) | |
Initializes all components to the corresponding parameters. | |
Point3 | operator+ (const Vector3 &v) const |
Add the given vector to this and return the result (which is a point). | |
Point3 & | operator+= (const Vector3 &v) |
Add the given vector to this and set this to the result. | |
Vector3 | operator- (const Point3 &p) const |
Subtract the given point from this and return the result. | |
Point3 | operator- (const Vector3 &v) const |
Subtract the given vector from this and return the result. | |
Point3 & | operator-= (const Vector3 &v) |
Subtract the given vector from this and set this to the result. | |
bool | operator== (const Point3 &other) const |
Check if the given point to this. | |
bool | operator!= (const Point3 &other) const |
Check if the given point is not equal to this. | |
float | operator[] (int i) const |
Return the ith component of the point. | |
float & | operator[] (int i) |
Return the reference of the ith component of the point. | |
void | fill_array_3 (float *a) |
Set the elements of the given array a to the cooridnates of the points. | |
void | fill_array_4 (float *a) |
Set the elements of the given array a to the homogeneous cooridnates of the points. | |
bool | is_near (const Point3 &other, float threshold=EPSILON) const |
Check if each coordinate of this is within threshold (a real number) of the corresponding coordinate of other. | |
Public Attributes | |
float | x |
The x coordinate. | |
float | y |
The y coordinate. | |
float | z |
The z coordinate. |
Point3::Point3 | ( | ) | [inline] |
Initializes all components to zero.
Point3::Point3 | ( | float | c | ) | [inline] |
Initializes all components to the given real number c.
Point3::Point3 | ( | float | _x, | |
float | _y, | |||
float | _z | |||
) | [inline] |
Initializes all components to the corresponding parameters.
void Point3::fill_array_3 | ( | float * | a | ) | [inline] |
Set the elements of the given array a to the cooridnates of the points.
That is:
a
[0] will be set to the x coordinate.a
[1] will be set to the y coordinate.a
[2] will be set to the z coordinate. void Point3::fill_array_4 | ( | float * | a | ) | [inline] |
Set the elements of the given array a to the homogeneous cooridnates of the points.
That is:
a
[0] will be set to the x coordinate.a
[1] will be set to the y coordinate.a
[2] will be set to the z coordinate.a
[3] will be set to 1. bool Point3::is_near | ( | const Point3 & | other, | |
float | threshold = EPSILON | |||
) | const [inline] |
Check if each coordinate of this is within threshold (a real number) of the corresponding coordinate of other.
Use this method to test approximate equality.
bool Point3::operator!= | ( | const Point3 & | other | ) | const [inline] |
Check if the given point is not equal to this.
Add the given vector to this and return the result (which is a point).
Add the given vector to this and set this to the result.
Subtract the given vector from this and return the result.
Subtract the given point from this and return the result.
Subtract the given vector from this and set this to the result.
bool Point3::operator== | ( | const Point3 & | other | ) | const [inline] |
Check if the given point to this.
float& Point3::operator[] | ( | int | i | ) | [inline] |
Return the reference of the ith component of the point.
This is done so that you can do this:
Point3 p; p[0] = 1; p[1] = 2; p[2] = 3;
The components are indexed as follows: The 0th component is the x coordinate. The 1st component is the y coordinate. The 2nd component is the z coordinate.
float Point3::operator[] | ( | int | i | ) | const [inline] |
Return the ith component of the point.
The components are indexed as follows: The 0th component is the x coordinate. The 1st component is the y coordinate. The 2nd component is the z coordinate.
float Point3::x |
The x coordinate.
float Point3::y |
The y coordinate.
float Point3::z |
The z coordinate.