23 #define MINGFX_MATH_EPSILON 1e-8
93 float x()
const {
return p[0]; }
97 float y()
const {
return p[1]; }
101 float z()
const {
return p[2]; }
104 float w()
const {
return 1.0; }
A 3D Point with floating point coordinates, used for storing vertices and all sorts of other 3D graph...
Point3(float *p)
Constructs a point given a pointer to x,y,z data.
float y() const
Read only access to the y coordinate. Can also use my_point[1]. Use the my_point[1] = 1....
static Point3 Lerp(const Point3 &a, const Point3 &b, float alpha)
Linear interpolation between two points. Alpha=0.0 returns 'a' and alpha=1.0 returns 'b',...
Point3 Lerp(const Point3 &b, float alpha) const
Linear interpolation between this point and another. Alpha=0.0 returns this point,...
Point3(const Point3 &p)
Copy constructor for point.
Point3(float x, float y, float z)
Constructs a point given (x,y,z,1), where the 1 comes from the use of homogeneous coordinates in comp...
static const Point3 & One()
(1,1,1) - a shortcut for a special point that is frequently needed
float operator[](const int i) const
Read only access to the ith coordinate of the point.
float & operator[](const int i)
Returns a reference to the ith coordinate of the point. Use this accessor if you wish to set the coor...
Point3 & operator=(const Point3 &p)
Assignment operator.
static const Point3 & Zero()
(0,0,0) - a shortcut for a special point that is frequently needed
Point3 ClosestPoint(const std::vector< Point3 > &point_list)
Given a list of points, returns the closest in the last to the current point.
virtual ~Point3()
Point destructor.
bool operator==(const Point3 &p) const
Check for "equality", taking floating point imprecision into account.
float w() const
In homogeneous coordinates, the w coordinate for all points is 1.0.
float x() const
Read only access to the x coordinate. Can also use my_point[0]. Use the my_point[0] = 1....
float z() const
Read only access to the z coordinate. Can also use my_point[2]. Use the my_point[2] = 1....
bool operator!=(const Point3 &p) const
Check for "inequality", taking floating point imprecision into account.
Point3 ClosestPointOnPlane(const Point3 &plane_origin, const Vector3 &plane_normal)
Returns the perpendicular projection of this point onto a plane defined by a point and a normal.
Point3()
Default point at the origin.
static const Point3 & Origin()
(0,0,0) - a shortcut for a special point that is frequently needed
const float * value_ptr() const
Returns a const pointer to the raw data array.
float DistanceToPlane(const Point3 &plane_origin, const Vector3 &plane_normal)
Returns the shortest (i.e., perpendicular) distance from this point to a plane defined by a point and...
A 3D Vector with floating point coordinates, used for storing normals and all sorts of other 3D graph...
Namespace for the MinGfx Toolkit.
std::ostream & operator<<(std::ostream &os, const Color &c)
std::istream & operator>>(std::istream &is, Color &c)