22 #define MINGFX_MATH_EPSILON 1e-8
69 float x()
const {
return p[0]; }
73 float y()
const {
return p[1]; }
76 float w()
const {
return 1.0; }
A 2D Point with floating point coordinates, used for storing 2D texture coordinates,...
const float * value_ptr() const
Returns a const pointer to the raw data array.
static const Point2 & Origin()
(0,0) - a shortcut for a special point that is frequently needed
Point2()
Default point at the origin.
static const Point2 & One()
(1,1) - a shortcut for a special point that is frequently needed
Point2(float *p)
Constructs a point given a pointer to x,y data.
float y() const
Read only access to the y coordinate. Can also use my_point[1]. Use the my_point[1] = 1....
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...
bool operator!=(const Point2 &p) const
Check for "inequality", taking floating point imprecision into account.
static const Point2 & Zero()
(0,0) - a shortcut for a special point that is frequently needed
static Point2 Lerp(const Point2 &a, const Point2 &b, float alpha)
Linear interpolation between two points. Alpha=0.0 returns 'a' and alpha=1.0 returns 'b',...
Point2(float x, float y)
Constructs a point given (x,y,1), where the 1 comes from the use of homogeneous coordinates in comput...
virtual ~Point2()
Point destructor.
Point2 Lerp(const Point2 &b, float alpha) const
Linear interpolation between this point and another. Alpha=0.0 returns this point,...
float x() const
Read only access to the x coordinate. Can also use my_point[0]. Use the my_point[0] = 1....
Point2(const Point2 &p)
Copy constructor for point.
float w() const
In homogeneous coordinates, the w coordinate for all points is 1.0.
bool operator==(const Point2 &p) const
Check for "equality", taking floating point imprecision into account.
float operator[](const int i) const
Read only access to the ith coordinate of the point.
Point2 & operator=(const Point2 &p)
Assignment operator.
Namespace for the MinGfx Toolkit.
std::ostream & operator<<(std::ostream &os, const Color &c)
std::istream & operator>>(std::istream &is, Color &c)