5 #ifndef __IRR_LINE_2D_H_INCLUDED__ 6 #define __IRR_LINE_2D_H_INCLUDED__ 45 void setLine(
const T& xa,
const T& ya,
const T& xb,
const T& yb){
start.set(xa, ya);
end.set(xb, yb);}
90 if(
equals(commonDenominator, 0.f))
139 if (
end != maxp &&
end != minp)
143 if (l.
end != maxp && l.
end != minp)
145 out.
X = (T)(out.
X/2);
146 out.
Y = (T)(out.
Y/2);
157 const f32 uA = numeratorA / commonDenominator;
158 if(checkOnlySegments && (uA < 0.f || uA > 1.f) )
161 const f32 uB = numeratorB / commonDenominator;
162 if(checkOnlySegments && (uB < 0.f || uB > 1.f))
226 if ( checkOnlySegments )
254 if ( checkOnlySegments )
256 if (t < 0)
return start;
257 if (t > d)
return end;
line2d(T xa, T ya, T xb, T yb)
Constructor for line between the two points.
line2d< T > operator-(const vector2d< T > &point) const
vector2d< T > start
Start point of the line.
float f32
32 bit floating point variable.
vector2d< T > getClosestPoint(const vector2d< T > &point, bool checkOnlySegments=true) const
Get the closest point on this line to a point.
T Y
Y coordinate of vector.
Everything in the Irrlicht Engine can be found in this namespace.
line2d< s32 > line2di
Typedef for an integer line.
f64 getAngleWith(const vector2d< T > &b) const
Calculates the angle between this vector and another one in degree.
bool operator!=(const line2d< T > &other) const
double f64
64 bit floating point variable.
void setLine(const line2d< T > &line)
Set this line to new line given as parameter.
vector2d< T > getUnitVector() const
Get unit vector of the line.
bool isPointBetweenStartAndEnd(const vector2d< T > &point) const
Check if the given point is between start and end of the line.
vector2d< T > getVector() const
Get the vector of the line.
line2d< T > & operator-=(const vector2d< T > &point)
T getPointOrientation(const vector2d< T > &point) const
Tells us if the given point lies to the left, right, or on the line.
bool intersectWith(const line2d< T > &l, vector2d< T > &out, bool checkOnlySegments=true) const
Tests if this line intersects with another line.
void setLine(const vector2d< T > &nstart, const vector2d< T > &nend)
Set this line to new line going through the two points.
T getLength() const
Get length of line.
T getLength() const
Gets the length of the vector.
line2d< T > operator+(const vector2d< T > &point) const
T dotProduct(const vector2d< T > &other) const
Get the dot product of this vector with another.
line2d< f32 > line2df
Typedef for an f32 line.
bool isPointOnLine(const vector2d< T > &point) const
Check if the given point is a member of the line.
line2d(const vector2d< T > &start, const vector2d< T > &end)
Constructor for line between the two points given as vectors.
bool operator==(const line2d< T > &other) const
line2d()
Default constructor for line going from (0,0) to (1,1).
2d vector template class with lots of operators and methods.
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.
f64 getAngleWith(const line2d< T > &l) const
Get angle between this line and given line.
line2d< T > & operator+=(const vector2d< T > &point)
line2d(const line2d< T > &other)
Copy constructor.
vector2d< T > end
End point of the line.
vector2d< T > getMiddle() const
Get middle of the line.
2D line between two points with intersection methods.
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
T getLengthSQ() const
Get squared length 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.
T X
X coordinate of vector.