5#ifndef __IRR_LINE_3D_H_INCLUDED__
6#define __IRR_LINE_3D_H_INCLUDED__
26 line3d(T xa, T ya, T za, T xb, T yb, T zb) :
start(xa, ya, za),
end(xb, yb, zb) {}
33 line3d<T>& operator+=(
const vector3d<T>& point) {
start += point;
end += point;
return *
this; }
36 line3d<T>& operator-=(
const vector3d<T>& point) {
start -= point;
end -= point;
return *
this; }
38 bool operator==(
const line3d<T>& other)
const
39 {
return (
start==other.start &&
end==other.end) || (
end==other.start &&
start==other.end);}
40 bool operator!=(
const line3d<T>& other)
const
41 {
return !(
start==other.start &&
end==other.end) || (
end==other.start &&
start==other.end);}
45 void setLine(
const T& xa,
const T& ya,
const T& za,
const T& xb,
const T& yb,
const T& zb)
46 {
start.set(xa, ya, za);
end.set(xb, yb, zb);}
118 T d = sradius * sradius - (c*c - v*v);
123 outdistance = v - core::squareroot ( d );
3D line between two points with intersection methods.
Definition line3d.h:19
bool getIntersectionWithSphere(vector3d< T > sorigin, T sradius, f64 &outdistance) const
Check if the line intersects with a shpere.
Definition line3d.h:113
line3d(T xa, T ya, T za, T xb, T yb, T zb)
Constructor with two points.
Definition line3d.h:26
T getLengthSQ() const
Get squared length of line.
Definition line3d.h:60
vector3d< T > getMiddle() const
Get middle of line.
Definition line3d.h:64
void setLine(const line3d< T > &line)
Set this line to new line given as parameter.
Definition line3d.h:51
vector3d< f32 > start
Definition line3d.h:130
vector3d< T > getClosestPoint(const vector3d< T > &point) const
Get the closest point on this line to a point.
Definition line3d.h:89
line3d(const vector3d< T > &start, const vector3d< T > &end)
Constructor with two points as vectors.
Definition line3d.h:28
void setLine(const T &xa, const T &ya, const T &za, const T &xb, const T &yb, const T &zb)
Set this line to a new line going through the two points.
Definition line3d.h:45
T getLength() const
Get length of line.
Definition line3d.h:56
line3d()
Default constructor.
Definition line3d.h:24
bool isPointBetweenStartAndEnd(const vector3d< T > &point) const
Check if the given point is between start and end of the line.
Definition line3d.h:81
vector3d< T > getVector() const
Get vector of line.
Definition line3d.h:71
vector3d< f32 > end
Definition line3d.h:132
void setLine(const vector3d< T > &nstart, const vector3d< T > &nend)
Set this line to a new line going through the two points.
Definition line3d.h:48
3d vector template class with lots of operators and methods.
Definition vector3d.h:23
T getLength() const
Get length of the vector.
Definition vector3d.h:117
bool isBetweenPoints(const vector3d< T > &begin, const vector3d< T > &end) const
Returns if this vector interpreted as a point is on a line between two other points.
Definition vector3d.h:157
T dotProduct(const vector3d< T > &other) const
Get the dot product with another vector.
Definition vector3d.h:125
Basic classes such as vectors, planes, arrays, lists, and so on can be found in this namespace.
Definition aabbox3d.h:15
line3d< f32 > line3df
Typedef for an f32 line.
Definition line3d.h:136
line3d< s32 > line3di
Typedef for an integer line.
Definition line3d.h:138
Everything in the Irrlicht Engine can be found in this namespace.
Definition Skylicht.h:33
double f64
64 bit floating point variable.
Definition irrTypes.h:108