ivutils
Loading...
Searching...
No Matches
Plane_Nt< T, N > Class Template Reference

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.
 
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.
 
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.
 

Detailed Description

template<class T, int N>
class Plane_Nt< T, N >

Base plane class implementing N-dimensional plane equation \(\vec{n}\vec{x}+d=0\).

Examples are given here: 3 Dimensial plane (Plane_3)

Constructor & Destructor Documentation

◆ Plane_Nt() [1/2]

template<class T , int N>
Plane_Nt< T, N >::Plane_Nt ( const Vector_Nt< T, N > &  n = Vector_Nt<T, N>(1),
d = 0,
vec_type  eps = 0 
)
inline

Constructor with precomputed d.

Parameters
[in]nplane vector (normalized automatically)
[in]dconstant
[eps]if the norm of vector nn is less than eps, the plane normal is set to zero to mark a degenerate plane

◆ Plane_Nt() [2/2]

template<class T , int N>
Plane_Nt< T, N >::Plane_Nt ( const Vector_Nt< T, N > &  n,
const Vector_Nt< T, N > &  pos,
vec_type  eps = 0 
)
inline

Constructor from a given position.

Parameters
[in]nplane normal vector (normalized automatically)
[in]posa 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

Member Function Documentation

◆ init()

template<class T , int N>
int Plane_Nt< T, N >::init ( const Vector_Nt< T, N > &  n,
const Vector_Nt< T, N > &  pos,
vec_type  eps = 0 
)
inline

Initialization analogous to Plane_3::Plane_3(const Vector_3& n, const Vector_3& pos, vec_type eps).

Return values
<0if n is small
>0otherwise

◆ set_coeff()

template<class T , int N>
void Plane_Nt< T, N >::set_coeff ( const Vector_Nt< T, N > &  n,
const T &  d 
)
inline

Sets the plane vector n and the constant d.

The plane vector is NOT normalized, for normalization use Plane_Nt::init()

◆ set_pos()

template<class T , int N>
void Plane_Nt< T, N >::set_pos ( const Vector_Nt< T, N > &  newpos)
inline

Sets the position of a starting point not changing the normal vector.

Parameters
[in]newposnew plane position

◆ TestEdge()

template<class T , int N>
bool Plane_Nt< T, N >::TestEdge ( const Vector_Nt< T, N > &  v1,
const Vector_Nt< T, N > &  v2,
Vector_Nt< T, N > *  cross = NULL 
) const
inline

Tests whether a segment \((\vec{v}_1,\vec{v}_2)\) crosses the plane.

Parameters
[in]v1segment starting position
[in]v2segment end position
[out]crosscrossing position, returned if cross is not NULL
Return values
trueif crossing point exists
falseotherwise

◆ TestRay()

template<class T , int N>
T Plane_Nt< T, N >::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,
epsilon = 0 
) const
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.

Parameters
[in]p1ray starting point
[in]kray direction
[out]surfpif not NULL, will contain the crossing point
[out]surfnif not NULL, will contain the plane normal n (normal at the crossing point)
[in]epsilonintersections with \(t_0<=\epsilon\) are ignored (-epsilon is reported as a solution)
Returns
intersection coordinate on the ray ( \(t_0\))
Return values
-epsilonmeans that intersection is found in epsilon vicinity of the starting point p1 (may be interpreted as p1 lying in the plane)
<-epsilonmeans no intersection in the positive ray direction. Negative \(t_0\) value may however be used as a solution in the opposite direction
-VEC_INFTYmeans that there is no intersection (ray is parallel to the plane with the accuracy of VEC_ZERO)

The documentation for this class was generated from the following file: