Public Types | Public Member Functions | Private Attributes | List of all members
geo::PlaneDecomposer< Vector, Point, ProjVector > Class Template Reference

Class with methods for projection of vectors on a plane. More...

#include <Decomposer.h>

Public Types

using AffinePlaneBase_t = AffinePlaneBase< Vector, Point >
 
using DecomposedVector_t = DecomposedVector< ProjVector >
 Type of decomposed vector. More...
 
using Point_t = typename AffinePlaneBase_t::Point_t
 Type for a point. More...
 
using Vector_t = typename AffinePlaneBase_t::Vector_t
 Type for a vector. More...
 
using Projection_t = typename DecomposedVector_t::Projection_t
 Type representing the projection vector. More...
 
using Distance_t = typename DecomposedVector_t::Distance_t
 Type representing the signed distance from the projection plane. More...
 

Public Member Functions

 PlaneDecomposer ()
 Default constructor: projection on (x,y) with origin (0, 0, 0) More...
 
 PlaneDecomposer (AffinePlaneBase_t &&base)
 Constructor: specifies a base (an origin and two direction vectors) More...
 
 PlaneDecomposer (AffinePlaneBase_t const &base)
 Constructor: specifies a base (an origin and two direction vectors) More...
 
Setters
void SetBase (AffinePlaneBase_t &&base)
 Change projection base. More...
 
void SetBase (AffinePlaneBase_t const &base)
 Change projection base. More...
 
void SetOrigin (Point_t const &point)
 Change the 3D point of the reference frame origin. More...
 
void SetMainDir (Vector_t const &dir)
 Change the main direction of the projection base. More...
 
void SetSecondaryDir (Vector_t const &dir)
 Change the secondary direction of the projection base. More...
 
Reference point and base
Point_t ReferencePoint () const
 Returns the reference point for the plane coordinate, as a 3D point. More...
 
Vector_t const & MainDir () const
 Returns the plane main axis direction. More...
 
Vector_t const & SecondaryDir () const
 Returns the plane secondary axis direction. More...
 
AffinePlaneBase_t const & Base () const
 Returns the complete base representation. More...
 
Projection coordinate access

These methods act on 2D (vector) projections.

auto MainComponent (Projection_t const &v) const
 Returns the main component of a projection vector. More...
 
auto SecondaryComponent (Projection_t const &v) const
 Returns the secondary component of a projection vector. More...
 
Projection on plane
auto PointMainComponent (Point_t const &point) const
 Returns the main component of a 3D point. More...
 
auto PointSecondaryComponent (Point_t const &point) const
 Returns the secondary component of a 3D point. More...
 
Projection_t PointProjection (Point_t const &point) const
 Returns the projection of the specified point on the plane. More...
 
auto VectorMainComponent (Vector_t const &v) const
 Returns the main component of a projection vector. More...
 
auto VectorSecondaryComponent (Vector_t const &v) const
 Returns the secondary component of a projection vector. More...
 
Projection_t VectorProjection (Vector_t const &v) const
 Returns the projection of the specified vector on the plane. More...
 
double Angle (Vector_t const &v) const
 Returns the angle of the projection from main direction. More...
 
Composition from plane to 3D
Vector_t ComposeVector (Projection_t const &projection) const
 Returns the 3D vector from the specified projection. More...
 
Point_t ComposePoint (Projection_t const &projection) const
 Returns the 3D point from the specified projection. More...
 

Private Attributes

AffinePlaneBase_t fPlaneBase
 Reference base. More...
 

Detailed Description

template<typename Vector, typename Point, typename ProjVector>
class geo::PlaneDecomposer< Vector, Point, ProjVector >

Class with methods for projection of vectors on a plane.


Template Parameters
Vectortype to represent 3D vectors
Pointtype to represent 3D points
ProjVectortype to represent 2D projection on plane

These methods deal with projection of points and vectors on a plane.

The plane is defined in a 3D space, with two axes, the "main" and the "auxiliary" one, which are orthogonal.

Definition at line 179 of file Decomposer.h.

Member Typedef Documentation

template<typename Vector, typename Point, typename ProjVector>
using geo::PlaneDecomposer< Vector, Point, ProjVector >::AffinePlaneBase_t = AffinePlaneBase<Vector, Point>

Definition at line 183 of file Decomposer.h.

template<typename Vector, typename Point, typename ProjVector>
using geo::PlaneDecomposer< Vector, Point, ProjVector >::DecomposedVector_t = DecomposedVector<ProjVector>

Type of decomposed vector.

Definition at line 186 of file Decomposer.h.

template<typename Vector, typename Point, typename ProjVector>
using geo::PlaneDecomposer< Vector, Point, ProjVector >::Distance_t = typename DecomposedVector_t::Distance_t

Type representing the signed distance from the projection plane.

Definition at line 198 of file Decomposer.h.

template<typename Vector, typename Point, typename ProjVector>
using geo::PlaneDecomposer< Vector, Point, ProjVector >::Point_t = typename AffinePlaneBase_t::Point_t

Type for a point.

Definition at line 189 of file Decomposer.h.

template<typename Vector, typename Point, typename ProjVector>
using geo::PlaneDecomposer< Vector, Point, ProjVector >::Projection_t = typename DecomposedVector_t::Projection_t

Type representing the projection vector.

Definition at line 195 of file Decomposer.h.

template<typename Vector, typename Point, typename ProjVector>
using geo::PlaneDecomposer< Vector, Point, ProjVector >::Vector_t = typename AffinePlaneBase_t::Vector_t

Type for a vector.

Definition at line 192 of file Decomposer.h.

Constructor & Destructor Documentation

template<typename Vector, typename Point, typename ProjVector>
geo::PlaneDecomposer< Vector, Point, ProjVector >::PlaneDecomposer ( )
inline

Default constructor: projection on (x,y) with origin (0, 0, 0)

Definition at line 202 of file Decomposer.h.

203  : fPlaneBase(
204  { 0.0, 0.0, 0.0 }, // origin
205  { 1.0, 0.0, 0.0 }, // x axis
206  { 0.0, 1.0, 0.0 } // y axis
207  )
208  {}
AffinePlaneBase_t fPlaneBase
Reference base.
Definition: Decomposer.h:375
template<typename Vector, typename Point, typename ProjVector>
geo::PlaneDecomposer< Vector, Point, ProjVector >::PlaneDecomposer ( AffinePlaneBase_t &&  base)
inline

Constructor: specifies a base (an origin and two direction vectors)

Definition at line 211 of file Decomposer.h.

def move(depos, offset)
Definition: depos.py:107
AffinePlaneBase_t fPlaneBase
Reference base.
Definition: Decomposer.h:375
template<typename Vector, typename Point, typename ProjVector>
geo::PlaneDecomposer< Vector, Point, ProjVector >::PlaneDecomposer ( AffinePlaneBase_t const &  base)
inline

Constructor: specifies a base (an origin and two direction vectors)

Definition at line 214 of file Decomposer.h.

214 : fPlaneBase(base) {}
AffinePlaneBase_t fPlaneBase
Reference base.
Definition: Decomposer.h:375

Member Function Documentation

template<typename Vector, typename Point, typename ProjVector>
double geo::PlaneDecomposer< Vector, Point, ProjVector >::Angle ( Vector_t const &  v) const
inline

Returns the angle of the projection from main direction.

Parameters
vvector to get the angle of
Returns
the angle of the projection from main direction, in radians

The projection on the plane is taken, and its angle from the main direction is returned. That angle is defined in the range $ \left[ -\pi, \pi \right] $, so that it is 0 for a projection matching the main direction and $ \pi/2 $ for one matching the secondary direction.

Definition at line 328 of file Decomposer.h.

329  {
330  double const a
331  = std::atan2(VectorSecondaryComponent(v), VectorMainComponent(v));
332  return (a >= M_PI)? -M_PI: a;
333  }
auto VectorMainComponent(Vector_t const &v) const
Returns the main component of a projection vector.
Definition: Decomposer.h:297
const double a
#define M_PI
Definition: includeROOT.h:54
auto VectorSecondaryComponent(Vector_t const &v) const
Returns the secondary component of a projection vector.
Definition: Decomposer.h:301
template<typename Vector, typename Point, typename ProjVector>
AffinePlaneBase_t const& geo::PlaneDecomposer< Vector, Point, ProjVector >::Base ( ) const
inline

Returns the complete base representation.

Definition at line 250 of file Decomposer.h.

250 { return fPlaneBase; }
AffinePlaneBase_t fPlaneBase
Reference base.
Definition: Decomposer.h:375
template<typename Vector, typename Point, typename ProjVector>
Point_t geo::PlaneDecomposer< Vector, Point, ProjVector >::ComposePoint ( Projection_t const &  projection) const
inline

Returns the 3D point from the specified projection.

Parameters
projectionthe projection vector on the plane
Returns
the 3D point representing the projection vector in world space
See also
Projection(), ReferencePoint()

The returned point is the 3D representation in space of the point of the plane described by the specified projection. The null projection is composed into the reference point returned by ReferencePoint().

Definition at line 369 of file Decomposer.h.

370  { return ReferencePoint() + ComposeVector(projection); }
Vector_t ComposeVector(Projection_t const &projection) const
Returns the 3D vector from the specified projection.
Definition: Decomposer.h:351
Point_t ReferencePoint() const
Returns the reference point for the plane coordinate, as a 3D point.
Definition: Decomposer.h:241
template<typename Vector, typename Point, typename ProjVector>
Vector_t geo::PlaneDecomposer< Vector, Point, ProjVector >::ComposeVector ( Projection_t const &  projection) const
inline

Returns the 3D vector from the specified projection.

Parameters
projectionthe projection vector on the plane
Returns
the 3D vector representing the projection vector in world space
See also
Projection()

The returned vector is the 3D representation in space of the point of the plane described by the specified projection. The null projection is composed into a null vector.

Definition at line 351 of file Decomposer.h.

352  {
353  return MainComponent(projection) * MainDir()
354  + SecondaryComponent(projection) * SecondaryDir()
355  ;
356  }
auto SecondaryComponent(Projection_t const &v) const
Returns the secondary component of a projection vector.
Definition: Decomposer.h:265
Vector_t const & MainDir() const
Returns the plane main axis direction.
Definition: Decomposer.h:244
auto MainComponent(Projection_t const &v) const
Returns the main component of a projection vector.
Definition: Decomposer.h:262
Vector_t const & SecondaryDir() const
Returns the plane secondary axis direction.
Definition: Decomposer.h:247
template<typename Vector, typename Point, typename ProjVector>
auto geo::PlaneDecomposer< Vector, Point, ProjVector >::MainComponent ( Projection_t const &  v) const
inline

Returns the main component of a projection vector.

Definition at line 262 of file Decomposer.h.

262 { return v.X(); }
template<typename Vector, typename Point, typename ProjVector>
Vector_t const& geo::PlaneDecomposer< Vector, Point, ProjVector >::MainDir ( ) const
inline

Returns the plane main axis direction.

Definition at line 244 of file Decomposer.h.

244 { return Base().MainDir(); }
AffinePlaneBase_t const & Base() const
Returns the complete base representation.
Definition: Decomposer.h:250
Vector_t const & MainDir() const
Returns the main axis direction.
Definition: Decomposer.h:108
template<typename Vector, typename Point, typename ProjVector>
auto geo::PlaneDecomposer< Vector, Point, ProjVector >::PointMainComponent ( Point_t const &  point) const
inline

Returns the main component of a 3D point.

Definition at line 274 of file Decomposer.h.

275  { return VectorMainComponent(Base().ToVector(point)); }
auto VectorMainComponent(Vector_t const &v) const
Returns the main component of a projection vector.
Definition: Decomposer.h:297
AffinePlaneBase_t const & Base() const
Returns the complete base representation.
Definition: Decomposer.h:250
template<typename Vector, typename Point, typename ProjVector>
Projection_t geo::PlaneDecomposer< Vector, Point, ProjVector >::PointProjection ( Point_t const &  point) const
inline

Returns the projection of the specified point on the plane.

Parameters
pointthe 3D point to be projected, in world coordinates
Returns
a 2D vector representing the projection of point on the plane

The returned vector is a 2D vector expressing the projection of the point (from world coordinates) on the plane. The vector is expressed as $ ( m, s ) $, components following the main and the secondary direction, respectively. The origin point is the one returned by ReferencePoint().

Definition at line 292 of file Decomposer.h.

293  { return VectorProjection(Base().ToVector(point)); }
Projection_t VectorProjection(Vector_t const &v) const
Returns the projection of the specified vector on the plane.
Definition: Decomposer.h:314
AffinePlaneBase_t const & Base() const
Returns the complete base representation.
Definition: Decomposer.h:250
template<typename Vector, typename Point, typename ProjVector>
auto geo::PlaneDecomposer< Vector, Point, ProjVector >::PointSecondaryComponent ( Point_t const &  point) const
inline

Returns the secondary component of a 3D point.

Definition at line 278 of file Decomposer.h.

279  { return VectorSecondaryComponent(Base().ToVector(point)); }
AffinePlaneBase_t const & Base() const
Returns the complete base representation.
Definition: Decomposer.h:250
auto VectorSecondaryComponent(Vector_t const &v) const
Returns the secondary component of a projection vector.
Definition: Decomposer.h:301
template<typename Vector, typename Point, typename ProjVector>
Point_t geo::PlaneDecomposer< Vector, Point, ProjVector >::ReferencePoint ( ) const
inline

Returns the reference point for the plane coordinate, as a 3D point.

Definition at line 241 of file Decomposer.h.

241 { return Base().Origin(); }
Point_t Origin() const
Returns the origin of the coordinate system in world coordinates.
Definition: Decomposer.h:117
AffinePlaneBase_t const & Base() const
Returns the complete base representation.
Definition: Decomposer.h:250
template<typename Vector, typename Point, typename ProjVector>
auto geo::PlaneDecomposer< Vector, Point, ProjVector >::SecondaryComponent ( Projection_t const &  v) const
inline

Returns the secondary component of a projection vector.

Definition at line 265 of file Decomposer.h.

265 { return v.Y(); }
template<typename Vector, typename Point, typename ProjVector>
Vector_t const& geo::PlaneDecomposer< Vector, Point, ProjVector >::SecondaryDir ( ) const
inline

Returns the plane secondary axis direction.

Definition at line 247 of file Decomposer.h.

247 { return Base().SecondaryDir(); }
Vector_t const & SecondaryDir() const
Returns the secondary axis direction.
Definition: Decomposer.h:111
AffinePlaneBase_t const & Base() const
Returns the complete base representation.
Definition: Decomposer.h:250
template<typename Vector, typename Point, typename ProjVector>
void geo::PlaneDecomposer< Vector, Point, ProjVector >::SetBase ( AffinePlaneBase_t &&  base)
inline

Change projection base.

Definition at line 220 of file Decomposer.h.

220 { fPlaneBase = std::move(base); }
def move(depos, offset)
Definition: depos.py:107
AffinePlaneBase_t fPlaneBase
Reference base.
Definition: Decomposer.h:375
template<typename Vector, typename Point, typename ProjVector>
void geo::PlaneDecomposer< Vector, Point, ProjVector >::SetBase ( AffinePlaneBase_t const &  base)
inline

Change projection base.

Definition at line 223 of file Decomposer.h.

223 { fPlaneBase = base; }
AffinePlaneBase_t fPlaneBase
Reference base.
Definition: Decomposer.h:375
template<typename Vector, typename Point, typename ProjVector>
void geo::PlaneDecomposer< Vector, Point, ProjVector >::SetMainDir ( Vector_t const &  dir)
inline

Change the main direction of the projection base.

Definition at line 229 of file Decomposer.h.

string dir
AffinePlaneBase_t fPlaneBase
Reference base.
Definition: Decomposer.h:375
void SetMainDir(Vector_t const &dir)
Change the main direction of the projection base.
Definition: Decomposer.h:127
template<typename Vector, typename Point, typename ProjVector>
void geo::PlaneDecomposer< Vector, Point, ProjVector >::SetOrigin ( Point_t const &  point)
inline

Change the 3D point of the reference frame origin.

Definition at line 226 of file Decomposer.h.

226 { fPlaneBase.SetOrigin(point); }
void SetOrigin(Point_t const &point)
Change the 3D point of the reference frame origin.
Definition: Decomposer.h:124
AffinePlaneBase_t fPlaneBase
Reference base.
Definition: Decomposer.h:375
template<typename Vector, typename Point, typename ProjVector>
void geo::PlaneDecomposer< Vector, Point, ProjVector >::SetSecondaryDir ( Vector_t const &  dir)
inline

Change the secondary direction of the projection base.

Definition at line 232 of file Decomposer.h.

string dir
AffinePlaneBase_t fPlaneBase
Reference base.
Definition: Decomposer.h:375
void SetSecondaryDir(Vector_t const &dir)
Change the secondary direction of the projection base.
Definition: Decomposer.h:130
template<typename Vector, typename Point, typename ProjVector>
auto geo::PlaneDecomposer< Vector, Point, ProjVector >::VectorMainComponent ( Vector_t const &  v) const
inline

Returns the main component of a projection vector.

Definition at line 297 of file Decomposer.h.

298  { return geo::vect::dot(v, MainDir()); }
constexpr auto dot(Vector const &a, Vector const &b)
Return cross product of two vectors.
Vector_t const & MainDir() const
Returns the plane main axis direction.
Definition: Decomposer.h:244
template<typename Vector, typename Point, typename ProjVector>
Projection_t geo::PlaneDecomposer< Vector, Point, ProjVector >::VectorProjection ( Vector_t const &  v) const
inline

Returns the projection of the specified vector on the plane.

Parameters
vthe 3D vector to be projected, in world units
Returns
a 2D vector representing the projection of v on the plane

The returned vector is a 2D vector expressing the projection of the vector (from world units) on the plane. The vector is expressed as $ ( m, s ) $, components following the main and the secondary direction, respectively.

Definition at line 314 of file Decomposer.h.

315  { return { VectorMainComponent(v), VectorSecondaryComponent(v) }; }
auto VectorMainComponent(Vector_t const &v) const
Returns the main component of a projection vector.
Definition: Decomposer.h:297
auto VectorSecondaryComponent(Vector_t const &v) const
Returns the secondary component of a projection vector.
Definition: Decomposer.h:301
template<typename Vector, typename Point, typename ProjVector>
auto geo::PlaneDecomposer< Vector, Point, ProjVector >::VectorSecondaryComponent ( Vector_t const &  v) const
inline

Returns the secondary component of a projection vector.

Definition at line 301 of file Decomposer.h.

302  { return geo::vect::dot(v, SecondaryDir()); }
constexpr auto dot(Vector const &a, Vector const &b)
Return cross product of two vectors.
Vector_t const & SecondaryDir() const
Returns the plane secondary axis direction.
Definition: Decomposer.h:247

Member Data Documentation

template<typename Vector, typename Point, typename ProjVector>
AffinePlaneBase_t geo::PlaneDecomposer< Vector, Point, ProjVector >::fPlaneBase
private

Reference base.

Definition at line 375 of file Decomposer.h.


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