All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Types | Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
geo::Decomposer< Vector, Point, ProjVector > Class Template Reference

Class with methods to decompose and compose back vectors. More...

#include <Decomposer.h>

Public Types

using Point_t = typename PlaneDecomposer_t::Point_t
 Type for a vector. More...
 
using Vector_t = typename PlaneDecomposer_t::Vector_t
 
using Projection_t = typename PlaneDecomposer_t::Projection_t
 Type representing the projection vector. More...
 
using Distance_t = typename PlaneDecomposer_t::Distance_t
 Type representing the signed distance from the projection plane. More...
 
using DecomposedVector_t = typename PlaneDecomposer_t::DecomposedVector_t
 Type representing a decomposition on the plane. More...
 
using AffinePlaneBase_t = typename PlaneDecomposer_t::AffinePlaneBase_t
 Type of vector base for the space. More...
 

Public Member Functions

 Decomposer ()=default
 Default constructor: projection on (x,y) with origin (0, 0, 0) More...
 
 Decomposer (AffinePlaneBase_t &&base)
 Constructor: specifies a base (an origin and two direction vectors) More...
 
 Decomposer (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 directions and point
Point_t ReferencePoint () const
 Returns the reference point for the plane coordinate, as a 3D point. More...
 
AffinePlaneBase_t const & Base () const
 Returns the base of the decomposition. 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...
 
Vector_t const & NormalDir () const
 Returns the plane normal axis direction. More...
 
Decomposition of a 3D point
auto PointMainComponent (Point_t const &point) const
 Returns the main component of a point. More...
 
auto PointSecondaryComponent (Point_t const &point) const
 Returns the secondary component of a point. More...
 
auto PointNormalComponent (Point_t const &point) const
 Returns the secondary component of a point. More...
 
Projection_t ProjectPointOnPlane (Point_t const &point) const
 Returns the projection of the specified point on the plane. More...
 
DecomposedVector_t DecomposePoint (Point_t const &point) const
 Decomposes a 3D point in two components. More...
 
Decomposition of a 3D vector
auto VectorMainComponent (Vector_t const &v) const
 Returns the main component of a vector. More...
 
auto VectorSecondaryComponent (Vector_t const &v) const
 Returns the secondary component of a vector. More...
 
auto VectorNormalComponent (Vector_t const &v) const
 Returns the secondary component of a vector. More...
 
Projection_t ProjectVectorOnPlane (Vector_t const &v) const
 Returns the projection of the specified vector on the plane. More...
 
DecomposedVector_t DecomposeVector (Vector_t const &v) const
 Decomposes a 3D vector in two components. More...
 
double Angle (Vector_t const &v) const
 Returns the angle of the projection from main direction. More...
 
Decomposition of a projection vector
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...
 
Composition of a point
Point_t ComposePoint (DecomposedVector_t const &decomp) const
 Returns the 3D point from composition of projection and distance. More...
 
Point_t ComposePoint (double distance, Projection_t const &proj) const
 Returns the 3D point from composition of projection and distance. More...
 
Composition of a vector
Vector_t ComposeVector (DecomposedVector_t const &decomp) const
 Returns the 3D vector from composition of projection and distance. More...
 
Vector_t ComposeVector (double distance, Projection_t const &proj) const
 Returns the 3D vector from composition of projection and distance. More...
 

Private Types

using PlaneDecomposer_t = PlaneDecomposer< Vector, Point, ProjVector >
 

Private Member Functions

PlaneDecomposer_t const & Plane () const
 Returns the plane decomposer. More...
 

Private Attributes

PlaneDecomposer_t fPlaneDecomp
 Manages the projection on the plane. More...
 

Detailed Description

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

Class with methods to decompose and compose back vectors.


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 and the axis orthogonal to it.

Definition at line 391 of file Decomposer.h.

Member Typedef Documentation

template<typename Vector, typename Point, typename ProjVector>
using geo::Decomposer< Vector, Point, ProjVector >::AffinePlaneBase_t = typename PlaneDecomposer_t::AffinePlaneBase_t

Type of vector base for the space.

Definition at line 417 of file Decomposer.h.

template<typename Vector, typename Point, typename ProjVector>
using geo::Decomposer< Vector, Point, ProjVector >::DecomposedVector_t = typename PlaneDecomposer_t::DecomposedVector_t

Type representing a decomposition on the plane.

Definition at line 414 of file Decomposer.h.

template<typename Vector, typename Point, typename ProjVector>
using geo::Decomposer< Vector, Point, ProjVector >::Distance_t = typename PlaneDecomposer_t::Distance_t

Type representing the signed distance from the projection plane.

Definition at line 411 of file Decomposer.h.

template<typename Vector, typename Point, typename ProjVector>
using geo::Decomposer< Vector, Point, ProjVector >::PlaneDecomposer_t = PlaneDecomposer<Vector, Point, ProjVector>
private

Definition at line 393 of file Decomposer.h.

template<typename Vector, typename Point, typename ProjVector>
using geo::Decomposer< Vector, Point, ProjVector >::Point_t = typename PlaneDecomposer_t::Point_t

Type for a vector.

Definition at line 404 of file Decomposer.h.

template<typename Vector, typename Point, typename ProjVector>
using geo::Decomposer< Vector, Point, ProjVector >::Projection_t = typename PlaneDecomposer_t::Projection_t

Type representing the projection vector.

Definition at line 408 of file Decomposer.h.

template<typename Vector, typename Point, typename ProjVector>
using geo::Decomposer< Vector, Point, ProjVector >::Vector_t = typename PlaneDecomposer_t::Vector_t

Definition at line 405 of file Decomposer.h.

Constructor & Destructor Documentation

template<typename Vector, typename Point, typename ProjVector>
geo::Decomposer< Vector, Point, ProjVector >::Decomposer ( )
default

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

template<typename Vector, typename Point, typename ProjVector>
geo::Decomposer< Vector, Point, ProjVector >::Decomposer ( AffinePlaneBase_t &&  base)
inline

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

Definition at line 424 of file Decomposer.h.

424 : fPlaneDecomp(std::move(base)) {}
PlaneDecomposer_t fPlaneDecomp
Manages the projection on the plane.
Definition: Decomposer.h:395
template<typename Vector, typename Point, typename ProjVector>
geo::Decomposer< Vector, Point, ProjVector >::Decomposer ( AffinePlaneBase_t const &  base)
inline

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

Definition at line 427 of file Decomposer.h.

427 : fPlaneDecomp(base) {}
PlaneDecomposer_t fPlaneDecomp
Manages the projection on the plane.
Definition: Decomposer.h:395

Member Function Documentation

template<typename Vector, typename Point, typename ProjVector>
double geo::Decomposer< 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 580 of file Decomposer.h.

581  { return Plane().Angle(v); }
PlaneDecomposer_t const & Plane() const
Returns the plane decomposer.
Definition: Decomposer.h:398
template<typename Vector, typename Point, typename ProjVector>
AffinePlaneBase_t const& geo::Decomposer< Vector, Point, ProjVector >::Base ( ) const
inline

Returns the base of the decomposition.

Definition at line 460 of file Decomposer.h.

460 { return Plane().Base(); }
PlaneDecomposer_t const & Plane() const
Returns the plane decomposer.
Definition: Decomposer.h:398
template<typename Vector, typename Point, typename ProjVector>
Point_t geo::Decomposer< Vector, Point, ProjVector >::ComposePoint ( DecomposedVector_t const &  decomp) const
inline

Returns the 3D point from composition of projection and distance.

Parameters
decompdecomposed point
Returns
the 3D point from composition of projection and distance
See Also
DecomposePoint(), ComposePoint(double, Projection_t const&)

See ComposePoint(double, Projection_t const&) for details.

Definition at line 611 of file Decomposer.h.

612  { return ComposePoint(decomp.distance, decomp.projection); }
Point_t ComposePoint(DecomposedVector_t const &decomp) const
Returns the 3D point from composition of projection and distance.
Definition: Decomposer.h:611
template<typename Vector, typename Point, typename ProjVector>
Point_t geo::Decomposer< Vector, Point, ProjVector >::ComposePoint ( double  distance,
Projection_t const &  proj 
) const
inline

Returns the 3D point from composition of projection and distance.

Parameters
distancedistance of the target point from the wire plane
projprojection of the target point on the wire plane
Returns
the 3D point from composition of projection and distance
See Also
DecomposePoint()

The returned point is the sum of two 3D contributions:

  1. a vector parallel to the plane normal, with norm the input distance
  2. a vector lying on the plane, whose projection via ProjectPointOnPlane() gives the input projection

Given the arbitrary definition of the projection reference, it is assumed that the same convention is used as in ProjectPointOnPlane() and PointNormalComponent().

Definition at line 632 of file Decomposer.h.

633  { return ReferencePoint() + ComposeVector(distance, proj); }
Vector_t ComposeVector(DecomposedVector_t const &decomp) const
Returns the 3D vector from composition of projection and distance.
Definition: Decomposer.h:648
double distance(geo::Point_t const &point, CathodeDesc_t const &cathode)
Returns the distance of a point from the cathode.
Point_t ReferencePoint() const
Returns the reference point for the plane coordinate, as a 3D point.
Definition: Decomposer.h:457
template<typename Vector, typename Point, typename ProjVector>
Vector_t geo::Decomposer< Vector, Point, ProjVector >::ComposeVector ( DecomposedVector_t const &  decomp) const
inline

Returns the 3D vector from composition of projection and distance.

Parameters
decompdecomposed vector
Returns
the 3D vector from composition of projection and distance
See Also
DecomposeVector(), ComposeVector(double, Projection_t const&)

See ComposeVector(double, Projection_t const&) for details.

Definition at line 648 of file Decomposer.h.

649  { return ComposeVector(decomp.distance, decomp.projection); }
Vector_t ComposeVector(DecomposedVector_t const &decomp) const
Returns the 3D vector from composition of projection and distance.
Definition: Decomposer.h:648
template<typename Vector, typename Point, typename ProjVector>
Vector_t geo::Decomposer< Vector, Point, ProjVector >::ComposeVector ( double  distance,
Projection_t const &  proj 
) const
inline

Returns the 3D vector from composition of projection and distance.

Parameters
distancedistance of the target point from the wire plane
projprojection of the target point on the wire plane
Returns
the 3D vector from composition of projection and distance
See Also
DecomposeVector()

The returned vector is the sum of two 3D vectors:

  1. a vector parallel to the plane normal, with norm the input distance
  2. a vector lying on the plane, whose projection via ProjectVectorOnPlane() gives the input projection

Given the arbitrary definition of the projection reference, it is assumed that the same convention is used as in ProjectVectorOnPlane() and VectorNormalComponent().

Definition at line 669 of file Decomposer.h.

670  { return Plane().ComposeVector(proj) + distance * NormalDir(); }
Vector_t const & NormalDir() const
Returns the plane normal axis direction.
Definition: Decomposer.h:469
PlaneDecomposer_t const & Plane() const
Returns the plane decomposer.
Definition: Decomposer.h:398
double distance(geo::Point_t const &point, CathodeDesc_t const &cathode)
Returns the distance of a point from the cathode.
template<typename Vector, typename Point, typename ProjVector>
DecomposedVector_t geo::Decomposer< Vector, Point, ProjVector >::DecomposePoint ( Point_t const &  point) const
inline

Decomposes a 3D point in two components.

Parameters
pointthe point to be decomposed
Returns
the two components of point, on the plane and orthogonal to it

The point is decomposed in:

  1. a component orthogonal to the plane, expressed as a signed real number
  2. a component lying on the plane, expressed as a 2D vector

The distance is obtained as by PointNormalComponent(). The projection on the plane is obtained following the same convention as ProjectPointOnPlane().

Definition at line 517 of file Decomposer.h.

518  { return DecomposeVector(Base().ToVector(point)); }
DecomposedVector_t DecomposeVector(Vector_t const &v) const
Decomposes a 3D vector in two components.
Definition: Decomposer.h:566
AffinePlaneBase_t const & Base() const
Returns the base of the decomposition.
Definition: Decomposer.h:460
template<typename Vector, typename Point, typename ProjVector>
DecomposedVector_t geo::Decomposer< Vector, Point, ProjVector >::DecomposeVector ( Vector_t const &  v) const
inline

Decomposes a 3D vector in two components.

Parameters
vthe vector to be decomposed
Returns
the two components of vector, on the plane and orthogonal to it

The vector is decomposed in:

  1. a component orthogonal to the plane, expressed as a signed real number
  2. a component lying on the plane, expressed as a 2D vector

The distance is obtained as by VectorNormalComponent(). The projection on the plane is obtained following the same convention as ProjectVectorOnPlane().

Definition at line 566 of file Decomposer.h.

567  { return { VectorNormalComponent(v), ProjectVectorOnPlane(v) }; }
auto VectorNormalComponent(Vector_t const &v) const
Returns the secondary component of a vector.
Definition: Decomposer.h:535
Projection_t ProjectVectorOnPlane(Vector_t const &v) const
Returns the projection of the specified vector on the plane.
Definition: Decomposer.h:549
template<typename Vector, typename Point, typename ProjVector>
auto geo::Decomposer< Vector, Point, ProjVector >::MainComponent ( Projection_t const &  v) const
inline

Returns the main component of a projection vector.

Definition at line 590 of file Decomposer.h.

591  { return Plane().MainComponent(v); }
PlaneDecomposer_t const & Plane() const
Returns the plane decomposer.
Definition: Decomposer.h:398
template<typename Vector, typename Point, typename ProjVector>
Vector_t const& geo::Decomposer< Vector, Point, ProjVector >::MainDir ( ) const
inline

Returns the plane main axis direction.

Definition at line 463 of file Decomposer.h.

463 { return Plane().MainDir(); }
PlaneDecomposer_t const & Plane() const
Returns the plane decomposer.
Definition: Decomposer.h:398
template<typename Vector, typename Point, typename ProjVector>
Vector_t const& geo::Decomposer< Vector, Point, ProjVector >::NormalDir ( ) const
inline

Returns the plane normal axis direction.

Definition at line 469 of file Decomposer.h.

469 { return Base().NormalDir(); }
AffinePlaneBase_t const & Base() const
Returns the base of the decomposition.
Definition: Decomposer.h:460
template<typename Vector, typename Point, typename ProjVector>
PlaneDecomposer_t const& geo::Decomposer< Vector, Point, ProjVector >::Plane ( ) const
inlineprivate

Returns the plane decomposer.

Definition at line 398 of file Decomposer.h.

398 { return fPlaneDecomp; }
PlaneDecomposer_t fPlaneDecomp
Manages the projection on the plane.
Definition: Decomposer.h:395
template<typename Vector, typename Point, typename ProjVector>
auto geo::Decomposer< Vector, Point, ProjVector >::PointMainComponent ( Point_t const &  point) const
inline

Returns the main component of a point.

Definition at line 478 of file Decomposer.h.

479  { return VectorMainComponent(Base().ToVector(point)); }
AffinePlaneBase_t const & Base() const
Returns the base of the decomposition.
Definition: Decomposer.h:460
auto VectorMainComponent(Vector_t const &v) const
Returns the main component of a vector.
Definition: Decomposer.h:527
template<typename Vector, typename Point, typename ProjVector>
auto geo::Decomposer< Vector, Point, ProjVector >::PointNormalComponent ( Point_t const &  point) const
inline

Returns the secondary component of a point.

Definition at line 486 of file Decomposer.h.

487  { return VectorNormalComponent(Base().ToVector(point)); }
auto VectorNormalComponent(Vector_t const &v) const
Returns the secondary component of a vector.
Definition: Decomposer.h:535
AffinePlaneBase_t const & Base() const
Returns the base of the decomposition.
Definition: Decomposer.h:460
template<typename Vector, typename Point, typename ProjVector>
auto geo::Decomposer< Vector, Point, ProjVector >::PointSecondaryComponent ( Point_t const &  point) const
inline

Returns the secondary component of a point.

Definition at line 482 of file Decomposer.h.

483  { return VectorSecondaryComponent(Base().ToVector(point)); }
auto VectorSecondaryComponent(Vector_t const &v) const
Returns the secondary component of a vector.
Definition: Decomposer.h:531
AffinePlaneBase_t const & Base() const
Returns the base of the decomposition.
Definition: Decomposer.h:460
template<typename Vector, typename Point, typename ProjVector>
Projection_t geo::Decomposer< Vector, Point, ProjVector >::ProjectPointOnPlane ( 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 direction (MainDir()) and the secondary one (SecondaryDir()) respectively. The origin point is the one from ReferencePoint().

Definition at line 500 of file Decomposer.h.

501  { return Plane().PointProjection(point); }
PlaneDecomposer_t const & Plane() const
Returns the plane decomposer.
Definition: Decomposer.h:398
template<typename Vector, typename Point, typename ProjVector>
Projection_t geo::Decomposer< Vector, Point, ProjVector >::ProjectVectorOnPlane ( 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 wire plane. The vector is expressed as $ ( m, s ) $, components following the main direction (MainDir()) and the secondary one (SecondaryDir()) respectively.

Definition at line 549 of file Decomposer.h.

550  { return Plane().VectorProjection(v); }
PlaneDecomposer_t const & Plane() const
Returns the plane decomposer.
Definition: Decomposer.h:398
template<typename Vector, typename Point, typename ProjVector>
Point_t geo::Decomposer< Vector, Point, ProjVector >::ReferencePoint ( ) const
inline

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

Definition at line 457 of file Decomposer.h.

457 { return Plane().ReferencePoint(); }
PlaneDecomposer_t const & Plane() const
Returns the plane decomposer.
Definition: Decomposer.h:398
template<typename Vector, typename Point, typename ProjVector>
auto geo::Decomposer< Vector, Point, ProjVector >::SecondaryComponent ( Projection_t const &  v) const
inline

Returns the secondary component of a projection vector.

Definition at line 594 of file Decomposer.h.

595  { return Plane().SecondaryComponent(v); }
PlaneDecomposer_t const & Plane() const
Returns the plane decomposer.
Definition: Decomposer.h:398
template<typename Vector, typename Point, typename ProjVector>
Vector_t const& geo::Decomposer< Vector, Point, ProjVector >::SecondaryDir ( ) const
inline

Returns the plane secondary axis direction.

Definition at line 466 of file Decomposer.h.

466 { return Plane().SecondaryDir(); }
PlaneDecomposer_t const & Plane() const
Returns the plane decomposer.
Definition: Decomposer.h:398
template<typename Vector, typename Point, typename ProjVector>
void geo::Decomposer< Vector, Point, ProjVector >::SetBase ( AffinePlaneBase_t &&  base)
inline

Change projection base.

Definition at line 433 of file Decomposer.h.

434  { fPlaneDecomp.SetBase(std::move(base)); }
PlaneDecomposer_t fPlaneDecomp
Manages the projection on the plane.
Definition: Decomposer.h:395
template<typename Vector, typename Point, typename ProjVector>
void geo::Decomposer< Vector, Point, ProjVector >::SetBase ( AffinePlaneBase_t const &  base)
inline

Change projection base.

Definition at line 437 of file Decomposer.h.

438  { fPlaneDecomp.SetBase(base); }
PlaneDecomposer_t fPlaneDecomp
Manages the projection on the plane.
Definition: Decomposer.h:395
template<typename Vector, typename Point, typename ProjVector>
void geo::Decomposer< Vector, Point, ProjVector >::SetMainDir ( Vector_t const &  dir)
inline

Change the main direction of the projection base.

Definition at line 444 of file Decomposer.h.

444 { fPlaneDecomp.SetMainDir(dir); }
tuple dir
Definition: dropbox.py:28
PlaneDecomposer_t fPlaneDecomp
Manages the projection on the plane.
Definition: Decomposer.h:395
template<typename Vector, typename Point, typename ProjVector>
void geo::Decomposer< Vector, Point, ProjVector >::SetOrigin ( Point_t const &  point)
inline

Change the 3D point of the reference frame origin.

Definition at line 441 of file Decomposer.h.

441 { fPlaneDecomp.SetOrigin(point); }
PlaneDecomposer_t fPlaneDecomp
Manages the projection on the plane.
Definition: Decomposer.h:395
template<typename Vector, typename Point, typename ProjVector>
void geo::Decomposer< Vector, Point, ProjVector >::SetSecondaryDir ( Vector_t const &  dir)
inline

Change the secondary direction of the projection base.

Definition at line 447 of file Decomposer.h.

448  { fPlaneDecomp.SetSecondaryDir(dir); }
tuple dir
Definition: dropbox.py:28
PlaneDecomposer_t fPlaneDecomp
Manages the projection on the plane.
Definition: Decomposer.h:395
template<typename Vector, typename Point, typename ProjVector>
auto geo::Decomposer< Vector, Point, ProjVector >::VectorMainComponent ( Vector_t const &  v) const
inline

Returns the main component of a vector.

Definition at line 527 of file Decomposer.h.

528  { return Plane().VectorMainComponent(v); }
PlaneDecomposer_t const & Plane() const
Returns the plane decomposer.
Definition: Decomposer.h:398
template<typename Vector, typename Point, typename ProjVector>
auto geo::Decomposer< Vector, Point, ProjVector >::VectorNormalComponent ( Vector_t const &  v) const
inline

Returns the secondary component of a vector.

Definition at line 535 of file Decomposer.h.

536  { return geo::vect::dot(v, NormalDir()); }
constexpr auto dot(Vector const &a, Vector const &b)
Return cross product of two vectors.
Vector_t const & NormalDir() const
Returns the plane normal axis direction.
Definition: Decomposer.h:469
template<typename Vector, typename Point, typename ProjVector>
auto geo::Decomposer< Vector, Point, ProjVector >::VectorSecondaryComponent ( Vector_t const &  v) const
inline

Returns the secondary component of a vector.

Definition at line 531 of file Decomposer.h.

532  { return Plane().VectorSecondaryComponent(v); }
PlaneDecomposer_t const & Plane() const
Returns the plane decomposer.
Definition: Decomposer.h:398

Member Data Documentation

template<typename Vector, typename Point, typename ProjVector>
PlaneDecomposer_t geo::Decomposer< Vector, Point, ProjVector >::fPlaneDecomp
private

Manages the projection on the plane.

Definition at line 395 of file Decomposer.h.


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