ivutils
|
Base plane class implementing N-dimensional plane equation \(\vec{n}\vec{x}+d=0\). More...
#include <plane_n.h>
Public Member Functions | |
Plane_Nt (const Vector_Nt< T, N > &n=Vector_Nt< T, N >(1), T d=0, vec_type eps=0) | |
Constructor with precomputed d. | |
Plane_Nt (const Vector_Nt< T, N > &n, const Vector_Nt< T, N > &pos, vec_type eps=0) | |
Constructor from a given position. | |
int | init (const Vector_Nt< T, N > &n, const Vector_Nt< T, N > &pos, vec_type eps=0) |
Initialization analogous to Plane_3::Plane_3(const Vector_3& n, const Vector_3& pos, vec_type eps). | |
void | set_pos (const Vector_Nt< T, N > &newpos) |
Sets the position of a starting point not changing the normal vector. | |
void | shift (const Vector_Nt< T, N > &shift) |
Shifts the plane by specified vector. | |
T | distance (const Vector_Nt< T, N > &x) const |
Returns the distance \(\vec{n}\vec{x}+d\) between a point x in space and the plane. | |
void | get_coeff (Vector_Nt< T, N > &n, T &d) const |
Gets the plane vector n and the constant d. | |
void | set_coeff (const Vector_Nt< T, N > &n, const T &d) |
Sets the plane vector n and the constant d. | |
Vector_Nt< T, N > | get_normal () const |
Gets the plane vector n. | |
Plane_Nt | get_inverse () const |
Gets the plane inverse to this. | |
bool | TestEdge (const Vector_Nt< T, N > &v1, const Vector_Nt< T, N > &v2, Vector_Nt< T, N > *cross=NULL) const |
Tests whether a segment \((\vec{v}_1,\vec{v}_2)\) crosses the plane. | |
T | TestRay (const Vector_Nt< T, N > &p1, const Vector_Nt< T, N > &k, Vector_Nt< T, N > *surfp=NULL, Vector_Nt< T, N > *surfn=NULL, T epsilon=0) const |
Returns \(t_0\) on the ray \(\vec{p}=\vec{p}_1+\vec{k}t_0\) corresponding to the intersection with the plane in the positive direction. | |
Base plane class implementing N-dimensional plane equation \(\vec{n}\vec{x}+d=0\).
Examples are given here: 3 Dimensial plane (Plane_3)
|
inline |
Constructor with precomputed d.
[in] | n | plane vector (normalized automatically) |
[in] | d | constant |
[eps] | if the norm of vector nn is less than eps, the plane normal is set to zero to mark a degenerate plane |
|
inline |
Constructor from a given position.
[in] | n | plane normal vector (normalized automatically) |
[in] | pos | a point that belongs to the plane |
[eps] | if the norm of vector nn is less than eps, the plane normal is set to zero to mark a degenerate plane |
|
inline |
Initialization analogous to Plane_3::Plane_3(const Vector_3& n, const Vector_3& pos, vec_type eps).
<0 | if n is small |
>0 | otherwise |
|
inline |
Sets the plane vector n and the constant d.
The plane vector is NOT normalized, for normalization use Plane_Nt::init()
Sets the position of a starting point not changing the normal vector.
[in] | newpos | new plane position |
|
inline |
Tests whether a segment \((\vec{v}_1,\vec{v}_2)\) crosses the plane.
[in] | v1 | segment starting position |
[in] | v2 | segment end position |
[out] | cross | crossing position, returned if cross is not NULL |
true | if crossing point exists |
false | otherwise |
|
inline |
Returns \(t_0\) on the ray \(\vec{p}=\vec{p}_1+\vec{k}t_0\) corresponding to the intersection with the plane in the positive direction.
Analogous to Region_3::TestRay() function.
[in] | p1 | ray starting point |
[in] | k | ray direction |
[out] | surfp | if not NULL, will contain the crossing point |
[out] | surfn | if not NULL, will contain the plane normal n (normal at the crossing point) |
[in] | epsilon | intersections with \(t_0<=\epsilon\) are ignored (-epsilon is reported as a solution) |
-epsilon | means that intersection is found in epsilon vicinity of the starting point p1 (may be interpreted as p1 lying in the plane) |
<-epsilon | means no intersection in the positive ray direction. Negative \(t_0\) value may however be used as a solution in the opposite direction |
-VEC_INFTY | means that there is no intersection (ray is parallel to the plane with the accuracy of VEC_ZERO) |