5#ifndef __IRR_POINT_2D_H_INCLUDED__
6#define __IRR_POINT_2D_H_INCLUDED__
188 return X < 0 ? 180 : 0;
191 return Y < 0 ? 270 : 90;
211 return X < 0 ? 180 : 0;
213 return Y < 0 ? 90 : 270;
261 if (begin.X != end.X)
263 return ((begin.X <=
X &&
X <= end.X) ||
264 (begin.X >=
X &&
X >= end.X));
268 return ((begin.Y <=
Y &&
Y <= end.Y) ||
269 (begin.Y >=
Y &&
Y >= end.Y));
310 X = (
T)((
f64)b.X + ( ( a.X - b.X ) *
d ));
311 Y = (
T)((
f64)b.Y + ( ( a.Y - b.Y ) *
d ));
328 template<
class S,
class T>
Axis aligned bounding box in 3d dimensional space.
bool operator==(const dimension2d< T > &other) const
Equality operator.
dimension2d()
Default constructor for empty dimension.
2d vector template class with lots of operators and methods.
vector2d< T > & operator+=(const vector2d< T > &other)
vector2d< T > operator*(const T v) const
vector2d< T > & operator-=(const vector2d< T > &other)
vector2d< T > operator-() const
bool operator<(const vector2d< T > &other) const
sort in order X, Y. Difference must be above rounding tolerance.
vector2d< T > operator-(const vector2d< T > &other) const
vector2d< T > & interpolate(const vector2d< T > &a, const vector2d< T > &b, f64 d)
Sets this vector to the linearly interpolated vector between a and b.
vector2d< T > & operator-=(const dimension2d< T > &other)
vector2d< T > operator+(const dimension2d< T > &other) const
vector2d< T > operator+(const vector2d< T > &other) const
T getDistanceFrom(const vector2d< T > &other) const
Gets distance from another point.
vector2d< T > operator-(const dimension2d< T > &other) const
vector2d< T > operator/(const vector2d< T > &other) const
vector2d< T > & operator*=(const T v)
f64 getAngleTrig() const
Calculates the angle of this vector in degrees in the trigonometric sense.
vector2d< T > & operator/=(const T v)
vector2d< T > & operator*=(const vector2d< T > &other)
vector2d< T > operator/(const T v) const
vector2d< T > & operator=(const vector2d< T > &other)
vector2d()
Default constructor (null vector)
bool operator>(const vector2d< T > &other) const
sort in order X, Y. Difference must be above rounding tolerance.
vector2d< T > operator+(const T v) const
vector2d< T > & set(T nx, T ny)
vector2d< T > operator*(const vector2d< T > &other) const
f64 getAngleWith(const vector2d< T > &b) const
Calculates the angle between this vector and another one in degree.
T getLength() const
Gets the length of the vector.
vector2d(const vector2d< T > &other)
Copy constructor.
T X
X coordinate of vector.
vector2d< T > getInterpolated(const vector2d< T > &other, f64 d) const
Creates an interpolated vector between this vector and another vector.
bool equals(const vector2d< T > &other) const
Checks if this vector equals the other one.
vector2d< T > & operator=(const dimension2d< T > &other)
T Y
Y coordinate of vector.
vector2d< T > getInterpolated_quadratic(const vector2d< T > &v2, const vector2d< T > &v3, f64 d) const
Creates a quadratically interpolated vector between this and two other vectors.
vector2d< T > & operator+=(const dimension2d< T > &other)
bool operator!=(const vector2d< T > &other) const
T getDistanceFromSQ(const vector2d< T > &other) const
Returns squared distance from another point.
vector2d< T > & rotateBy(f64 degrees, const vector2d< T > ¢er=vector2d< T >())
rotates the point anticlockwise around a center by an amount of degrees.
vector2d< T > & operator-=(const T v)
bool operator>=(const vector2d< T > &other) const
sort in order X, Y. Equality with rounding tolerance.
T getLengthSQ() const
Get the squared length of this vector.
vector2d< T > & set(const vector2d< T > &p)
bool operator<=(const vector2d< T > &other) const
sort in order X, Y. Equality with rounding tolerance.
T dotProduct(const vector2d< T > &other) const
Get the dot product of this vector with another.
vector2d(const dimension2d< T > &other)
f64 getAngle() const
Calculates the angle of this vector in degrees in the counter trigonometric sense.
vector2d(T nx, T ny)
Constructor with two different values.
vector2d< T > operator-(const T v) const
vector2d< T > & operator/=(const vector2d< T > &other)
vector2d< T > & normalize()
Normalize the vector.
bool isBetweenPoints(const vector2d< T > &begin, const vector2d< T > &end) const
Returns if this vector interpreted as a point is on a line between two other points.
vector2d< T > & operator+=(const T v)
bool operator==(const vector2d< T > &other) const
vector2d< f32 > vector2df
Typedef for f32 2d vector.
CMatrix4< T > operator*(const T scalar, const CMatrix4< T > &mat)
const T clamp(const T &value, const T &low, const T &high)
clamps a value between low and high
const f64 DEGTORAD64
64bit constant for converting from degrees to radians (formally known as GRAD_PI2)
vector2d< s32 > vector2di
Typedef for integer 2d vector.
bool equals(const f64 a, const f64 b, const f64 tolerance=ROUNDING_ERROR_f64)
returns if a equals b, taking possible rounding errors into account
REALINLINE f64 reciprocal_squareroot(const f64 x)
const f64 RADTODEG64
64bit constant for converting from radians to degrees
REALINLINE f32 squareroot(const f32 f)
Everything in the Irrlicht Engine can be found in this namespace.
float f32
32 bit floating point variable.
double f64
64 bit floating point variable.