Nirtcpp 2.1.0
Nirtcpp is a high-performance c++ graphics engine.
|
3D line between two points with intersection methods. More...
#include <nirtcpp/core/engine/line3d.hpp>
Public Member Functions | |
line3d () | |
Default constructor. | |
line3d (T xa, T ya, T za, T xb, T yb, T zb) | |
Constructor with two points. | |
line3d (const vector3d< T > &start, const vector3d< T > &end) | |
Constructor with two points as vectors. | |
line3d< T > | operator+ (const vector3d< T > &point) const |
line3d< T > & | operator+= (const vector3d< T > &point) |
line3d< T > | operator- (const vector3d< T > &point) const |
line3d< T > & | operator-= (const vector3d< T > &point) |
bool | operator== (const line3d< T > &other) const |
bool | operator!= (const line3d< T > &other) const |
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. | |
void | setLine (const vector3d< T > &nstart, const vector3d< T > &nend) |
Set this line to a new line going through the two points. | |
void | setLine (const line3d< T > &line) |
Set this line to new line given as parameter. | |
T | getLength () const |
Get length of line. | |
T | getLengthSQ () const |
Get squared length of line. | |
vector3d< T > | getMiddle () const |
Get middle of line. | |
vector3d< T > | getVector () const |
Get vector of line. | |
bool | isPointBetweenStartAndEnd (const vector3d< T > &point) const |
Check if the given point is between start and end of the line. | |
vector3d< T > | getClosestPoint (const vector3d< T > &point) const |
Get the closest point on this line to a point. | |
bool | getIntersectionWithSphere (const vector3d< T > &sorigin, T sradius, f64 &outdistance) const |
Check if the line intersects with a sphere. | |
Public Attributes | |
vector3d< T > | start |
Start point of line. | |
vector3d< T > | end |
End point of line. | |
3D line between two points with intersection methods.
|
inline |
Default constructor.
line from (0,0,0) to (1,1,1)
Get the closest point on this line to a point.
point | The point to compare to. |
|
inline |
Check if the line intersects with a sphere.
sorigin | Origin of the sphere. |
sradius | Radius of the sphere. |
outdistance | The distance to the first intersection point. |
|
inline |
Get length of line.
|
inline |
Get squared length of line.
Get middle of line.
Get vector of line.
Check if the given point is between start and end of the line.
Assumes that the point is already somewhere on the line.
point | The point to test. |