Virtual Testbed
Ship dynamics simulator for extreme conditions
Public Types | Public Member Functions | Static Public Attributes | List of all members
vtb::geometry::Plane< T, N > Class Template Reference

Three- and two-dimensional plane. More...

#include <plane.hh>

Public Types

using scalar_type = T
 
using value_type = Vertex< T, N >
 
using reference = value_type &
 
using const_reference = const value_type &
 

Public Member Functions

 Plane (const_reference normal, const_reference origin)
 
 Plane (const_reference normal)
 
 Plane (const_reference a, const_reference b, const_reference c)
 Construct plane from plane equation. More...
 
const_reference normal () const
 A vector that is orthogonal to the plane.
 
const_reference origin () const
 A point on the plane.
 
void invert ()
 Invert plane orientation (the direction of the normal).
 
operator() (const_reference point) const
 Substitute point p to the plane equation. More...
 
operator() () const
 Substitute nought into the plane equation to get \(d\). More...
 
value_type project (const_reference point) const
 Project point on the plane. More...
 
value_type project_vector (const_reference vector) const
 Project vector on the plane. More...
 
int redundant_dimension () const
 The index of dimension that has nought basis vector. More...
 
Basis< T, N > basis () const
 Vector basis for the coordinate system defined by the and the origin. More...
 
Coordinate_system< T, N > coordinate_system () const
 Coordinate system defined by the and the origin. More...
 
void clear ()
 
void gnuplot (std::ostream &out) const
 
template<>
 Plane (const_reference a, const_reference b, const_reference c)
 
template<>
int redundant_dimension () const
 
template<>
vtb::geometry::Basis< T, 3 > basis () const
 
template<>
vtb::geometry::Coordinate_system< T, 3 > coordinate_system () const
 

Static Public Attributes

static constexpr const int dimensions = N
 

Detailed Description

template<class T, int N>
class vtb::geometry::Plane< T, N >

Three- and two-dimensional plane.

Date
2019-04-09
Author
Ivan Gankevich

Definition at line 28 of file plane.hh.

Constructor & Destructor Documentation

◆ Plane()

template<class T, int N>
vtb::geometry::Plane< T, N >::Plane ( const_reference  a,
const_reference  b,
const_reference  c 
)
explicit

Construct plane from plane equation.

Date
2019-04-05
Author
Ivan Gankevich

The plane is defined by equation \(ax+by+cz+d=0\), where \((a,b,c)\) is plane normal and \(d\) is a normal multiplied by any point lying on the plane.

Member Function Documentation

◆ basis()

template<class T, int N>
Basis<T,N> vtb::geometry::Plane< T, N >::basis ( ) const

Vector basis for the coordinate system defined by the and the origin.

Date
2019-04-09
Author
Ivan Gankevich

◆ coordinate_system()

template<class T, int N>
Coordinate_system<T,N> vtb::geometry::Plane< T, N >::coordinate_system ( ) const

Coordinate system defined by the and the origin.

Date
2019-04-09
Author
Ivan Gankevich

This system can be used to project arbitrary points on the plane and then "unproject" them back. After projecting the point on the plane one of its coordinates becomes redundant. The redundant dimension is returned by method. See puncture and restore global functions that reduce and add dimensions to a vertex.

◆ operator()() [1/2]

template<class T, int N>
T vtb::geometry::Plane< T, N >::operator() ( const_reference  point) const
inline

Substitute point p to the plane equation.

Date
2019-04-05
Author
Ivan Gankevich
  • If the result is less than nought, then point p lies behind the plane.
  • If the result is greater than nought, then point p lies in front of the plane.
  • If the result is nought, then point p lies on the plane.

Definition at line 87 of file plane.hh.

References vtb::geometry::Plane< T, N >::normal(), and vtb::geometry::Plane< T, N >::origin().

◆ operator()() [2/2]

template<class T, int N>
T vtb::geometry::Plane< T, N >::operator() ( ) const
inline

Substitute nought into the plane equation to get \(d\).

Date
2019-04-09
Author
Ivan Gankevich
Returns
\(d\)

Definition at line 97 of file plane.hh.

References vtb::geometry::Plane< T, N >::normal(), and vtb::geometry::Plane< T, N >::origin().

◆ project()

template<class T, int N>
value_type vtb::geometry::Plane< T, N >::project ( const_reference  point) const
inline

Project point on the plane.

Date
2019-04-09
Author
Ivan Gankevich

Definition at line 105 of file plane.hh.

References vtb::geometry::Plane< T, N >::normal(), and vtb::geometry::Plane< T, N >::origin().

◆ project_vector()

template<class T, int N>
value_type vtb::geometry::Plane< T, N >::project_vector ( const_reference  vector) const
inline

Project vector on the plane.

Date
2019-11-06

Definition at line 114 of file plane.hh.

References vtb::geometry::Plane< T, N >::normal().

◆ redundant_dimension()

template<class T, int N>
int vtb::geometry::Plane< T, N >::redundant_dimension ( ) const

The index of dimension that has nought basis vector.

Date
2019-04-09
Author
Ivan Gankevich

Method still returns unit vector instead of nought for this dimension.