Saga3D API Documentation
1.0-RC4
|
Go to the documentation of this file.
5 #ifndef __IRR_LINE_3D_H_INCLUDED__
6 #define __IRR_LINE_3D_H_INCLUDED__
8 #include <glm/vec3.hpp>
25 line3d(T xa, T ya, T za, T xb, T yb, T zb) :
start(xa, ya, za),
end(xb, yb, zb) {}
44 void setLine(
const T& xa,
const T& ya,
const T& za,
const T& xb,
const T& yb,
const T& zb)
45 {
start = {xa, ya, za};
end = {xb, yb, zb}; }
47 void setLine(
const glm::vec3& nstart,
const glm::vec3& nend)
90 glm::vec3 c = point -
start;
92 T d = (T) glm::length(v);
114 const glm::vec3 q = sorigin -
start;
115 T c = glm::length(q);
116 T v = glm::dot(q, glm::normalize(
getVector()));
117 T d = sradius * sradius - (c*c - v*v);
glm::vec3 getClosestPoint(const glm::vec3 &point) const
Get the closest point on this line to a point.
T getLength() const
Get length of line.
REALINLINE float squareroot(const float f)
bool operator!=(const line3d< T > &other) const
3D line between two points with intersection methods.
line3d(const glm::vec3 &start, const glm::vec3 &end)
Constructor with two points as vectors.
bool isBetweenPoints(const glm::vec3 &point, const glm::vec3 &begin, const glm::vec3 &end)
glm::vec3 end
End point of line.
glm::vec3 getVector() const
Get vector of line.
void setLine(const line3d< T > &line)
Set this line to new line given as parameter.
glm::vec3 start
Start point of line.
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.
line3d()
Default constructor.
line3d< T > operator-(const glm::vec3 &point) const
bool isPointBetweenStartAndEnd(const glm::vec3 &point) const
Check if the given point is between start and end of the line.
line3d(T xa, T ya, T za, T xb, T yb, T zb)
Constructor with two points.
bool getIntersectionWithSphere(const glm::vec3 &sorigin, T sradius, double &outdistance) const
Check if the line intersects with a sphere.
line3d< T > & operator-=(const glm::vec3 &point)
line3d< T > operator+(const glm::vec3 &point) const
line3d< T > & operator+=(const glm::vec3 &point)
T getLengthSQ() const
Get squared length of line.
bool operator==(const line3d< T > &other) const
line3d< float > line3df
Typedef for an float line.
glm::vec3 getMiddle() const
Get middle of line.
line3d< std::int32_t > line3di
Typedef for an integer line.
void setLine(const glm::vec3 &nstart, const glm::vec3 &nend)
Set this line to a new line going through the two points.