LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
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 177 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 180 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 183 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 195 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 186 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 192 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 189 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 198 of file Decomposer.h.

199  : fPlaneBase({0.0, 0.0, 0.0}, // origin
200  {1.0, 0.0, 0.0}, // x axis
201  {0.0, 1.0, 0.0} // y axis
202  )
203  {}
AffinePlaneBase_t fPlaneBase
Reference base.
Definition: Decomposer.h:374
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 206 of file Decomposer.h.

206 : fPlaneBase(std::move(base)) {}
AffinePlaneBase_t fPlaneBase
Reference base.
Definition: Decomposer.h:374
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 209 of file Decomposer.h.

209 : fPlaneBase(base) {}
AffinePlaneBase_t fPlaneBase
Reference base.
Definition: Decomposer.h:374

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 = std::atan2(VectorSecondaryComponent(v), VectorMainComponent(v));
331  return (a >= M_PI) ? -M_PI : a;
332  }
auto VectorMainComponent(Vector_t const &v) const
Returns the main component of a projection vector.
Definition: Decomposer.h:294
auto VectorSecondaryComponent(Vector_t const &v) const
Returns the secondary component of a projection vector.
Definition: Decomposer.h:297
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 244 of file Decomposer.h.

244 { return fPlaneBase; }
AffinePlaneBase_t fPlaneBase
Reference base.
Definition: Decomposer.h:374
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 366 of file Decomposer.h.

367  {
368  return ReferencePoint() + ComposeVector(projection);
369  }
Vector_t ComposeVector(Projection_t const &projection) const
Returns the 3D vector from the specified projection.
Definition: Decomposer.h:349
Point_t ReferencePoint() const
Returns the reference point for the plane coordinate, as a 3D point.
Definition: Decomposer.h:235
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 349 of file Decomposer.h.

350  {
351  return MainComponent(projection) * MainDir() +
352  SecondaryComponent(projection) * SecondaryDir();
353  }
auto SecondaryComponent(Projection_t const &v) const
Returns the secondary component of a projection vector.
Definition: Decomposer.h:258
Vector_t const & MainDir() const
Returns the plane main axis direction.
Definition: Decomposer.h:238
auto MainComponent(Projection_t const &v) const
Returns the main component of a projection vector.
Definition: Decomposer.h:255
Vector_t const & SecondaryDir() const
Returns the plane secondary axis direction.
Definition: Decomposer.h:241
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 255 of file Decomposer.h.

255 { 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 238 of file Decomposer.h.

238 { return Base().MainDir(); }
AffinePlaneBase_t const & Base() const
Returns the complete base representation.
Definition: Decomposer.h:244
Vector_t const & MainDir() const
Returns the main axis direction.
Definition: Decomposer.h:111
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 266 of file Decomposer.h.

267  {
268  return VectorMainComponent(Base().ToVector(point));
269  }
auto VectorMainComponent(Vector_t const &v) const
Returns the main component of a projection vector.
Definition: Decomposer.h:294
AffinePlaneBase_t const & Base() const
Returns the complete base representation.
Definition: Decomposer.h:244
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 288 of file Decomposer.h.

289  {
290  return VectorProjection(Base().ToVector(point));
291  }
Projection_t VectorProjection(Vector_t const &v) const
Returns the projection of the specified vector on the plane.
Definition: Decomposer.h:312
AffinePlaneBase_t const & Base() const
Returns the complete base representation.
Definition: Decomposer.h:244
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 272 of file Decomposer.h.

273  {
274  return VectorSecondaryComponent(Base().ToVector(point));
275  }
AffinePlaneBase_t const & Base() const
Returns the complete base representation.
Definition: Decomposer.h:244
auto VectorSecondaryComponent(Vector_t const &v) const
Returns the secondary component of a projection vector.
Definition: Decomposer.h:297
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 235 of file Decomposer.h.

235 { return Base().Origin(); }
Point_t Origin() const
Returns the origin of the coordinate system in world coordinates.
Definition: Decomposer.h:120
AffinePlaneBase_t const & Base() const
Returns the complete base representation.
Definition: Decomposer.h:244
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 258 of file Decomposer.h.

258 { 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 241 of file Decomposer.h.

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

Change projection base.

Definition at line 215 of file Decomposer.h.

Referenced by geo::Decomposer< Direction_t, Position_t, Projection_t >::SetBase().

215 { fPlaneBase = std::move(base); }
AffinePlaneBase_t fPlaneBase
Reference base.
Definition: Decomposer.h:374
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 218 of file Decomposer.h.

218 { fPlaneBase = base; }
AffinePlaneBase_t fPlaneBase
Reference base.
Definition: Decomposer.h:374
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 224 of file Decomposer.h.

Referenced by geo::Decomposer< Direction_t, Position_t, Projection_t >::SetMainDir().

TDirectory * dir
Definition: macro.C:5
AffinePlaneBase_t fPlaneBase
Reference base.
Definition: Decomposer.h:374
void SetMainDir(Vector_t const &dir)
Change the main direction of the projection base.
Definition: Decomposer.h:129
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 221 of file Decomposer.h.

Referenced by geo::Decomposer< Direction_t, Position_t, Projection_t >::SetOrigin().

221 { fPlaneBase.SetOrigin(point); }
void SetOrigin(Point_t const &point)
Change the 3D point of the reference frame origin.
Definition: Decomposer.h:126
AffinePlaneBase_t fPlaneBase
Reference base.
Definition: Decomposer.h:374
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 227 of file Decomposer.h.

Referenced by geo::Decomposer< Direction_t, Position_t, Projection_t >::SetSecondaryDir().

TDirectory * dir
Definition: macro.C:5
AffinePlaneBase_t fPlaneBase
Reference base.
Definition: Decomposer.h:374
void SetSecondaryDir(Vector_t const &dir)
Change the secondary direction of the projection base.
Definition: Decomposer.h:132
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 294 of file Decomposer.h.

294 { return geo::vect::dot(v, MainDir()); }
Vector_t const & MainDir() const
Returns the plane main axis direction.
Definition: Decomposer.h:238
constexpr auto dot(Vector const &a, OtherVector const &b)
Return cross product of two vectors.
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 312 of file Decomposer.h.

313  {
315  }
auto VectorMainComponent(Vector_t const &v) const
Returns the main component of a projection vector.
Definition: Decomposer.h:294
auto VectorSecondaryComponent(Vector_t const &v) const
Returns the secondary component of a projection vector.
Definition: Decomposer.h:297
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 297 of file Decomposer.h.

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

Member Data Documentation

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

Reference base.

Definition at line 374 of file Decomposer.h.


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