LArSoft  v10_04_05
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 175 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 178 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 181 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 193 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 184 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 190 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 187 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 196 of file Decomposer.h.

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

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

207 : fPlaneBase(base) {}
AffinePlaneBase_t fPlaneBase
Reference base.
Definition: Decomposer.h:369

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 323 of file Decomposer.h.

324  {
325  double const a = std::atan2(VectorSecondaryComponent(v), VectorMainComponent(v));
326  return (a >= M_PI) ? -M_PI : a;
327  }
auto VectorMainComponent(Vector_t const &v) const
Returns the main component of a projection vector.
Definition: Decomposer.h:292
auto VectorSecondaryComponent(Vector_t const &v) const
Returns the secondary component of a projection vector.
Definition: Decomposer.h:295
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 242 of file Decomposer.h.

242 { return fPlaneBase; }
AffinePlaneBase_t fPlaneBase
Reference base.
Definition: Decomposer.h:369
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 361 of file Decomposer.h.

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

345  {
346  return MainComponent(projection) * MainDir() +
347  SecondaryComponent(projection) * SecondaryDir();
348  }
auto SecondaryComponent(Projection_t const &v) const
Returns the secondary component of a projection vector.
Definition: Decomposer.h:256
Vector_t const & MainDir() const
Returns the plane main axis direction.
Definition: Decomposer.h:236
auto MainComponent(Projection_t const &v) const
Returns the main component of a projection vector.
Definition: Decomposer.h:253
Vector_t const & SecondaryDir() const
Returns the plane secondary axis direction.
Definition: Decomposer.h:239
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 253 of file Decomposer.h.

253 { 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 236 of file Decomposer.h.

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

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

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

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

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

256 { 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 239 of file Decomposer.h.

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

Change projection base.

Definition at line 213 of file Decomposer.h.

Referenced by geo::Decomposer< Vector_t, Point_t, WireCoordProjection_t >::SetBase().

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

216 { fPlaneBase = base; }
AffinePlaneBase_t fPlaneBase
Reference base.
Definition: Decomposer.h:369
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 222 of file Decomposer.h.

Referenced by geo::Decomposer< Vector_t, Point_t, WireCoordProjection_t >::SetMainDir().

TDirectory * dir
Definition: macro.C:5
AffinePlaneBase_t fPlaneBase
Reference base.
Definition: Decomposer.h:369
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 219 of file Decomposer.h.

Referenced by geo::Decomposer< Vector_t, Point_t, WireCoordProjection_t >::SetOrigin().

219 { 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:369
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 225 of file Decomposer.h.

Referenced by geo::Decomposer< Vector_t, Point_t, WireCoordProjection_t >::SetSecondaryDir().

TDirectory * dir
Definition: macro.C:5
AffinePlaneBase_t fPlaneBase
Reference base.
Definition: Decomposer.h:369
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 292 of file Decomposer.h.

292 { return vect::dot(v, MainDir()); }
Vector_t const & MainDir() const
Returns the plane main axis direction.
Definition: Decomposer.h:236
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 307 of file Decomposer.h.

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

295 { return vect::dot(v, SecondaryDir()); }
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:239

Member Data Documentation

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

Reference base.

Definition at line 369 of file Decomposer.h.


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