5#ifndef __IRR_LINE_2D_H_INCLUDED__
6#define __IRR_LINE_2D_H_INCLUDED__
85 (
l.end.Y -
l.start.Y)*(
start.X -
l.start.X);
99 else if(
l.end ==
end ||
l.start ==
end)
121 else if ((
l.start.X>
start.X &&
l.start.X>
l.end.X &&
l.start.X>
end.X) || (
l.start.Y>
start.Y &&
l.start.Y>
l.end.Y &&
l.start.Y>
end.Y))
129 else if (
maxp !=
l.start && ((
l.start.X<
start.X &&
l.start.X<
l.end.X &&
l.start.X<
end.X) || (
l.start.Y<
start.Y &&
l.start.Y<
l.end.Y &&
l.start.Y<
end.Y)))
221 f64 d = v.getLength();
225 f64 t = v.dotProduct(c);
257 if (
t < 0)
return start;
258 if (
t >
d)
return end;
Axis aligned bounding box in 3d dimensional space.
aabbox3d()
Default Constructor.
2D line between two points with intersection methods.
bool isPointOnLine(const vector2d< T > &point) const
Check if the given point is a member of the line.
f64 getAngleWith(const line2d< T > &l) const
Get angle between this line and given line.
bool operator==(const line2d< T > &other) const
line2d(const line2d< T > &other)
Copy constructor.
line2d< T > operator-(const vector2d< T > &point) const
void setLine(const vector2d< T > &nstart, const vector2d< T > &nend)
Set this line to new line going through the two points.
vector2d< T > getClosestPoint(const vector2d< T > &point, bool checkOnlySegments=true) const
Get the closest point on this line to a point.
vector2d< T > end
End point of the line.
line2d< T > & operator+=(const vector2d< T > &point)
line2d(const vector2d< T > &start, const vector2d< T > &end)
Constructor for line between the two points given as vectors.
vector2d< T > getMiddle() const
Get middle of the line.
bool isPointBetweenStartAndEnd(const vector2d< T > &point) const
Check if the given point is between start and end of the line.
void setLine(const T &xa, const T &ya, const T &xb, const T &yb)
Set this line to new line going through the two points.
vector2d< T > getUnitVector() const
Get unit vector of the line.
T getLength() const
Get length of line.
line2d()
Default constructor for line going from (0,0) to (1,1).
T getPointOrientation(const vector2d< T > &point) const
Tells us if the given point lies to the left, right, or on the line.
bool operator!=(const line2d< T > &other) const
bool intersectWith(const line2d< T > &l, vector2d< T > &out, bool checkOnlySegments=true) const
Tests if this line intersects with another line.
T getLengthSQ() const
Get squared length of the line.
line2d< T > operator+(const vector2d< T > &point) const
line2d< T > & operator-=(const vector2d< T > &point)
vector2d< T > start
Start point of the line.
vector2d< T > getVector() const
Get the vector of the line.
void setLine(const line2d< T > &line)
Set this line to new line given as parameter.
line2d(T xa, T ya, T xb, T yb)
Constructor for line between the two points.
T getLength() const
Gets the length of the vector.
T dotProduct(const vector2d< T > &other) const
Get the dot product of this vector with another.
line2d< f32 > line2df
Typedef for an f32 line.
line2d< s32 > line2di
Typedef for an integer line.
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
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.