LArSoft
v06_85_00
Liquid Argon Software toolkit - http://larsoft.org/
|
Utilities to manipulate geometry vectors.The utilities include generic vector interface facilities allowing to use different vector types via templates. More...
Namespaces | |
details | |
dump | |
Utilities to print vector types. | |
extra | |
Convenience utilities not directly related to vectors. | |
Classes | |
class | MiddlePointAccumulatorDim |
Helper class to compute the middle point in a point set. More... | |
Typedefs | |
template<typename Vector > | |
using | coordinate_t = details::VectorScalar_t< Vector > |
Type of coordinate of the specified vector type. More... | |
template<typename Vector > | |
using | CoordReader_t = decltype(details::makeCoordReader(&Vector::X)) |
Type of a coordinate reader for a vector type. More... | |
template<typename Vector > | |
using | CoordManager_t = decltype(details::makeCoordManager(&Vector::X,&Vector::SetX)) |
Type of a coordinate manager for a vector type. More... | |
using | MiddlePointAccumulator = MiddlePointAccumulatorDim< 3U > |
Middle-point accumulator for vectors of dimension 3. More... | |
Functions | |
template<typename Vector , typename Coords > | |
constexpr Vector | makeFromCoords (Coords &&coords) |
Creates a Vector object with coordinates from coords . More... | |
template<typename Vector > | |
constexpr auto | coordManager (unsigned int n) |
Returns an object that can be bound to a vector to manage one of its coordinates. More... | |
template<typename Vector > | |
constexpr auto | coordManager (unsigned int n, Vector &v) |
Returns an object that can be bound to a vector to manage one of its coordinates. More... | |
template<typename Vector > | |
constexpr auto | bindCoord (Vector const &v, CoordReader_t< Vector > helper) |
Binds the specified constant vector to the coordinate reader. More... | |
template<typename Vector > | |
auto | bindCoord (Vector &v, CoordManager_t< Vector > helper) -> details::BoundCoordManager< CoordManager_t< Vector >, Vector > |
Binds the specified vector to the coordinate manager. More... | |
template<typename Vector > | |
auto | Xcoord (Vector &v) |
Returns an object to manage the coordinate X of the vector v . More... | |
template<typename Vector > | |
auto | Ycoord (Vector &v) |
Returns an object to manage the coordinate Y of the vector v . More... | |
template<typename Vector > | |
auto | Zcoord (Vector &v) |
Returns an object to manage the coordinate Z of the vector v . More... | |
template<typename Vector > | |
auto | Tcoord (Vector &v) |
Returns an object to manage the coordinate T of the vector v . More... | |
template<typename Vector > | |
auto | coord (Vector &v, unsigned int n) noexcept |
Returns an object to manage the coordinate n of a vector. More... | |
template<typename Vector > | |
constexpr auto | bindCoordManagers (Vector &v) |
template<typename Vector > | |
constexpr auto | bindCoordReaders (Vector const &v) |
template<typename Dest , typename Source > | |
Dest | convertTo (Source const &v) |
Returns a vector of type Dest with the same content as a Src . More... | |
template<typename Dest , typename Source > | |
std::vector< Dest > | convertCollTo (std::vector< Source > const &coll) |
Returns a vector of type Dest with the same content as a Src . More... | |
template<typename Vector , typename Pred > | |
Vector | transformCoords (Vector const &v, Pred &&pred) |
Returns a new vector applying a predicate to each component. More... | |
template<> | |
auto | norm (geo::Vector_t const &v) |
template<> | |
auto | mag2< TVector2 > (TVector2 const &v) |
Vector coordinate access abstraction | |
This group of utilities provides a common interface for tasks involving geometry vectors, which may have different interface. An example of that is the access of coordinates by an index: it is supported (and "slow") in Coordinate managersA "coordinate manager" is an object handling a specific coordinate out of a specific vector type; i.e., a coordinate manager object will manage for its entire lifetime the same coordinate, e.g. x or z. A coordinate manager can be:
Two types of managers are available:
Note that a coordinate is never returned as a reference, either mutable or constant. Handling a coordinate of a vector object: bound managersA bound coordinate manager can be created directly: geo::Point_t p { 1.0, 2.0, 3.0 }; auto px = geo::vect::Xcoord(p); std::cout << p << " has x=" << px() << std::endl; px += 5.0; std::cout << p << " has now x=" << px() << std::endl; will return something along the line of Functions If access by numeric index is necessary, geo::Vector_t const v { 1.0, 2.0, 3.0 }; for (unsigned c = 0; c < 3; ++c) { auto vc = geo::vect::coord(v, c); std::cout << v << "[" << c << "]=" << vc() << std::endl; } (note that for this example we have implicitly obtained a coordinate reader instead of a full coordinate manager because v[0]=1 v[1]=2 v[2]=3 If there are more vectors to access the same coordinate of, it's better to use unbound managers (see below). Handling a coordinate for any vector objectUnbound coordinate managers (and readers) can't operate directly on vectors but they need to be bound to one. Binding produces a new bound manager, leaving the unbound manager untouched. Binding is done with geo::Point_t A { 1.0, 2.0, 3.0 }; auto Ax = geo::vect::bindCoord(A, YcoordManager<geo::Point_t>); std::cout << A << " has y=" << Ax << std::endl; should produce an output like (1,2,3) has y=2 In the example, for (unsigned c = 0; c < 3; ++c) { auto coordMan = geo::vect::coordManager(c); auto Ac = geo::vect::bindCoord(A, coordMan); std::cout << (Bc() - Ac() * 2.0) << std::endl; } // for which will emit 3 3 3 This is marginally faster than the same code with for (auto coordMan: geo::vect::coordManagers<geo::Point_t const>()) { auto Ac = geo::vect::bindCoord(A, coordMan); std::cout << (Bc() - Ac() * 2.0) << std::endl; } // for Conversion between vector typesA convenience function Vector requirementsSo far, the requirements for this set of utilities are the following. The vector type must support:
| |
template<typename Vector > | |
constexpr unsigned int | dimension () |
Returns the dimension of the specified vector type. More... | |
template<typename Vector > | |
constexpr unsigned int | dimension (Vector &&) |
Returns the dimension of the specified vector type. More... | |
template<typename Vector > | |
constexpr std::array< std::size_t, geo::vect::dimension< Vector >)> | indices () |
Returns a sequence of indices valid for a vector of the specified type. More... | |
template<typename Vector > | |
constexpr auto | indices (Vector const &) -> decltype(indices< Vector >()) |
Returns a sequence of indices valid for a vector of the specified type. More... | |
template<typename Vector > | |
constexpr auto | coordManagers () |
Returns an array with all coordinate managers for a type of vector. More... | |
template<typename Vector > | |
constexpr auto | coordManagers (Vector &&) |
Returns an array with all coordinate managers for a type of vector. More... | |
template<typename Vector > | |
constexpr auto | coordReaders () |
Returns an array with all coordinate readers for a type of vector. More... | |
template<typename Vector > | |
constexpr auto | coordReaders (Vector &&) |
Returns an array with all coordinate readers for a type of vector. More... | |
Functions for common vector operations. | |
This group of template functions are meant to be used with vectors in a generic way. The default implementation is for In addition, two "standard" representations for vectors and points are provided.
| |
template<typename Vector , typename Scalar > | |
Vector | rounded01 (Vector const &v, Scalar tol) |
Returns a vector with all components rounded if close to 0, -1 or +1. More... | |
template<typename Vector , typename Scalar > | |
void | round01 (Vector &v, Scalar tol) |
Returns a vector with all components rounded if close to 0, -1 or +1. More... | |
template<typename Vector > | |
bool | isfinite (Vector const &v) |
Returns whether all components of the vector are finite. More... | |
template<typename Vector > | |
Vector | normalize (Vector const &v) |
Returns a vector parallel to v and with norm 1. More... | |
template<typename Vector > | |
Vector | cross (Vector const &a, Vector const &b) |
Return cross product of two vectors. More... | |
template<typename Vector > | |
constexpr auto | dot (Vector const &a, Vector const &b) |
Return cross product of two vectors. More... | |
template<typename Vector > | |
auto | mag2 (Vector const &v) |
Return norm of the specified vector. More... | |
template<typename Vector > | |
auto | norm (Vector const &v) |
Return norm of the specified vector. More... | |
template<typename Vector > | |
auto | mixedProduct (Vector const &a, Vector const &b, Vector const &c) |
Middle point functions | |
template<typename Point , typename BeginIter , typename EndIter > | |
Point | middlePointAs (BeginIter begin, EndIter end) |
Returns the middle of the specified points. More... | |
template<typename BeginIter , typename EndIter > | |
geo::Point_t | middlePoint (BeginIter begin, EndIter end) |
Returns the middle of the specified points. More... | |
template<typename Point > | |
Point | middlePoint (std::initializer_list< Point > points) |
Returns the middle of the specified points. More... | |
Support for LArSoft geometry vectors | |
template<typename Point > | |
::geo::Point_t | toPoint (Point const &p) |
Convert the specified point into a geo::Point_t . More... | |
template<typename Vector > | |
::geo::Vector_t | toVector (Vector const &v) |
Convert the specified vector into a geo::Vector_t . More... | |
template<typename Point > | |
std::vector< geo::Point_t > | convertCollToPoint (std::vector< Point > const &coll) |
template<typename Vector > | |
std::vector< geo::Vector_t > | convertCollToVector (std::vector< Vector > const &coll) |
template<typename Coords > | |
GENVECTOR_CONSTEXPR::geo::Point_t | makePointFromCoords (Coords &&coords) |
Creates a geo::Point_t from its coordinates (see makeFromCoords() ). More... | |
template<typename Coords > | |
GENVECTOR_CONSTEXPR::geo::Vector_t | makeVectorFromCoords (Coords &&coords) |
Creates a geo::Vector_t from its coordinates (see makeFromCoords() ). More... | |
TVector3 conversions | |
template<typename Vector > | |
TVector3 | toTVector3 (Vector const &v) |
Converts a vector into a TVector3 . More... | |
Variables | |
template<typename Vector > | |
static constexpr auto | XcoordManager = details::makeCoordManager(&Vector::X, &Vector::SetX) |
Object that can be bound to a vector to manage its X coordinate. More... | |
template<typename Vector > | |
static constexpr auto | XcoordManager< Vector const > = details::makeCoordReader(&Vector::X) |
Object that can be bound to a vector to access its X coordinate. More... | |
template<typename Vector > | |
static constexpr auto const | YcoordManager = details::makeCoordManager(&Vector::Y, &Vector::SetY) |
template<typename Vector > | |
static constexpr auto | YcoordManager< Vector const > = details::makeCoordReader(&Vector::Y) |
template<typename Vector > | |
static constexpr auto | ZcoordManager = details::makeCoordManager(&Vector::Z, &Vector::SetZ) |
template<typename Vector > | |
static constexpr auto | ZcoordManager< Vector const > = details::makeCoordReader(&Vector::Z) |
template<typename Vector > | |
static constexpr auto | TcoordManager = details::makeCoordManager(&Vector::T, &Vector::SetT) |
template<typename Vector > | |
static constexpr auto | TcoordManager< Vector const > = details::makeCoordReader(&Vector::T) |
Utilities to manipulate geometry vectors.
The utilities include generic vector interface facilities allowing to use different vector types via templates.
using geo::vect::coordinate_t = typedef details::VectorScalar_t<Vector> |
Type of coordinate of the specified vector type.
Definition at line 585 of file geo_vectors_utils.h.
using geo::vect::CoordManager_t = typedef decltype (details::makeCoordManager(&Vector::X, &Vector::SetX)) |
Type of a coordinate manager for a vector type.
Definition at line 618 of file geo_vectors_utils.h.
using geo::vect::CoordReader_t = typedef decltype(details::makeCoordReader(&Vector::X)) |
Type of a coordinate reader for a vector type.
Definition at line 613 of file geo_vectors_utils.h.
using geo::vect::MiddlePointAccumulator = typedef MiddlePointAccumulatorDim<3U> |
Middle-point accumulator for vectors of dimension 3.
Definition at line 1180 of file geo_vectors_utils.h.
constexpr auto geo::vect::bindCoord | ( | Vector const & | v, |
CoordReader_t< Vector > | helper | ||
) |
Binds the specified constant vector to the coordinate reader.
Definition at line 785 of file geo_vectors_utils.h.
Referenced by geo::BoxBoundedGeo::GetIntersections(), geo::BoxBoundedGeo::SortCoordinates(), and Xcoord().
auto geo::vect::bindCoord | ( | Vector & | v, |
CoordManager_t< Vector > | helper | ||
) | -> details::BoundCoordManager<CoordManager_t<Vector>, Vector> |
Binds the specified vector to the coordinate manager.
Definition at line 793 of file geo_vectors_utils.h.
constexpr auto geo::vect::bindCoordManagers | ( | Vector & | v | ) |
Returns an array with all coordinate managers bound to the specified vector.
Definition at line 1715 of file geo_vectors_utils.h.
Referenced by geo::vect::MiddlePointAccumulatorDim< N >::add(), and Tcoord().
constexpr auto geo::vect::bindCoordReaders | ( | Vector const & | v | ) |
Returns an array with all coordinate readers bound to the specified vector.
Definition at line 1721 of file geo_vectors_utils.h.
Referenced by Tcoord(), and transformCoords().
std::vector< Dest > geo::vect::convertCollTo | ( | std::vector< Source > const & | coll | ) |
Returns a vector of type Dest
with the same content as a Src
.
Dest | target vector type |
Source | type of the vector to be converted from |
coll | the collection of vectors to be converted from |
coll
, but of type Dest
convertTo()
This version applies convertTo()
to all the elements of the specified collection, returning a collection of the same template type (std::vector
).
For the requirements, see convertTo()
.
Definition at line 1736 of file geo_vectors_utils.h.
Referenced by Tcoord().
std::vector<geo::Point_t> geo::vect::convertCollToPoint | ( | std::vector< Point > const & | coll | ) |
Convert the specified collection of points into a collection of geo::Point_t
.
Definition at line 1294 of file geo_vectors_utils.h.
References convertCollToVector().
Referenced by trkf::BezierTrackerModule::produce(), and toVector().
std::vector<geo::Vector_t> geo::vect::convertCollToVector | ( | std::vector< Vector > const & | coll | ) |
Convert the specified collection of vectors into a collection of geo::Vector_t
.
Definition at line 1301 of file geo_vectors_utils.h.
Referenced by convertCollToPoint(), and trkf::BezierTrackerModule::produce().
Dest geo::vect::convertTo | ( | Source const & | v | ) |
Returns a vector of type Dest
with the same content as a Src
.
Dest | target vector type |
Source | type of the vector to be converted from |
v | the vector to be converted from |
v
, but of type Dest
For this to work, both Src
and Dest
types must satisfy the requirements of Xcoord()
, Ycoord()
, Zcoord()
etc.
Definition at line 1730 of file geo_vectors_utils.h.
Referenced by Tcoord().
|
noexcept |
Returns an object to manage the coordinate n
of a vector.
Vector | the type of vector to be managed |
v | the vector to be managed |
n | the coordinate index: 0 for X, 1 for Y and 2 for Z |
n
of a vector Result is undefined for any value of n
other than 0
, 1
and 2
. See Xcoord()
, Ycoord()
and Zcoord()
for Vector
type requirements.
Definition at line 1683 of file geo_vectors_utils.h.
References n.
Referenced by shower::EMShowerAlg::FindInitialTrackHits(), geo::BoxBoundedGeo::GetIntersections(), evd::details::GridAxisClass::GridAxisClass(), geo::vect::details::isfiniteImpl(), and Tcoord().
constexpr auto geo::vect::coordManager | ( | unsigned int | n | ) |
Returns an object that can be bound to a vector to manage one of its coordinates.
Vector | type of vector to get a manager for (constantness matters) |
n | index of the coordinate (0 : X, 1 : Y, 2 : Z, 3 : T) |
Index n
is assumed to be smaller than the dimension of the vector. The manager returned for a mutable vector exposes a read/write interface. Example of usage:
will print something like:
For a constant vector, the returned manager exposes a read-only interface. Example of usage:
will print something like:
Note that the use in these examples, coord()
is preferred.
Definition at line 1677 of file geo_vectors_utils.h.
constexpr auto geo::vect::coordManager | ( | unsigned int | n, |
Vector & | v | ||
) |
Returns an object that can be bound to a vector to manage one of its coordinates.
Vector | type of vector to get a manager for (constantness matters) |
n | index of the coordinate (0 : X, 1 : Y, 2 : Z, 3 : T) |
v | a vector of type Vector (ignored) |
An alias of geo::vect::coordManager(unsigned int)
.
constexpr auto geo::vect::coordManagers | ( | ) |
Returns an array with all coordinate managers for a type of vector.
Definition at line 1690 of file geo_vectors_utils.h.
constexpr auto geo::vect::coordManagers | ( | Vector && | ) |
Returns an array with all coordinate managers for a type of vector.
Definition at line 1697 of file geo_vectors_utils.h.
constexpr auto geo::vect::coordReaders | ( | ) |
Returns an array with all coordinate readers for a type of vector.
Definition at line 1702 of file geo_vectors_utils.h.
constexpr auto geo::vect::coordReaders | ( | Vector && | ) |
Returns an array with all coordinate readers for a type of vector.
Definition at line 1709 of file geo_vectors_utils.h.
Vector geo::vect::cross | ( | Vector const & | a, |
Vector const & | b | ||
) |
Return cross product of two vectors.
Definition at line 986 of file geo_vectors_utils.h.
Referenced by export_G4ThreeVector(), geo::GeometryCore::IntersectSegments(), mixedProduct(), and pmtana::AlgoCFD::RecoPulse().
constexpr unsigned int geo::vect::dimension | ( | ) |
Returns the dimension of the specified vector type.
Definition at line 570 of file geo_vectors_utils.h.
constexpr unsigned int geo::vect::dimension | ( | Vector && | ) |
Returns the dimension of the specified vector type.
Definition at line 572 of file geo_vectors_utils.h.
References indices().
constexpr auto geo::vect::dot | ( | Vector const & | a, |
Vector const & | b | ||
) |
Return cross product of two vectors.
Definition at line 990 of file geo_vectors_utils.h.
Referenced by geo::details::ActiveAreaCalculator::adjustCorners(), checkTPCcoords(), detectGlobalDriftDir(), export_G4ThreeVector(), export_G4TwoVector(), geo::GeometryCore::IntersectSegments(), mixedProduct(), geo::TPCGeo::SortPlanes(), geo::PlaneGeo::UpdateView(), geo::PlaneDecomposer< Direction_t, Position_t, Projection_t >::VectorMainComponent(), geo::Decomposer< Direction_t, Position_t, Projection_t >::VectorNormalComponent(), and geo::PlaneDecomposer< Direction_t, Position_t, Projection_t >::VectorSecondaryComponent().
constexpr std::array< std::size_t, geo::vect::dimension< Vector >)> geo::vect::indices | ( | ) |
Returns a sequence of indices valid for a vector of the specified type.
Definition at line 1656 of file geo_vectors_utils.h.
Referenced by art::PtrVector< recob::EndPoint2D >::Class_Version(), util::CreateAssn(), evgb::util::CreateAssn(), dimension(), evgb::GENIEHelper::ExpandFluxFilePatternsDirect(), evgb::GENIEHelper::ExpandFluxFilePatternsIFDH(), fhicl::detail::get_sequence_indices(), util::GridContainerIndicesBase1D< DIMS >::hasX(), util::GridContainerBase1D< PointIter, IXMAN >::hasX(), util::GridContainerIndicesBase2D< DIMS >::hasY(), util::GridContainerBase2D< PointIter, IXMAN >::hasY(), util::GridContainerIndicesBase3D< DIMS >::hasZ(), util::GridContainerBase3D< PointIter >::hasZ(), art::Wrapper< T >::isPresent_(), fhicl::detail::SequenceKey::SequenceKey(), util::GridContainerIndicesBase1D< DIMS >::sizeX(), util::GridContainerBase1D< PointIter, IXMAN >::sizeX(), util::GridContainerIndicesBase2D< DIMS >::sizeY(), util::GridContainerBase2D< PointIter, IXMAN >::sizeY(), util::GridContainerIndicesBase3D< DIMS >::sizeZ(), util::GridContainerBase3D< PointIter >::sizeZ(), and art::EDProduct::typeInfo().
constexpr auto geo::vect::indices | ( | Vector const & | ) | -> decltype(indices<Vector>()) |
Returns a sequence of indices valid for a vector of the specified type.
Definition at line 1662 of file geo_vectors_utils.h.
bool geo::vect::isfinite | ( | Vector const & | v | ) |
Returns whether all components of the vector are finite.
Definition at line 1759 of file geo_vectors_utils.h.
References geo::vect::details::isfiniteImpl().
Referenced by cluster::ClusterParamsAlg::GetRoughAxis(), geo::vect::details::isfiniteImpl(), trkf::KTrack::isValid(), round01(), and pma::Track3D::TuneFullTree().
auto geo::vect::mag2 | ( | Vector const & | v | ) |
Return norm of the specified vector.
Definition at line 994 of file geo_vectors_utils.h.
Referenced by export_G4ThreeVector(), and export_G4TwoVector().
|
inline |
Definition at line 116 of file geo_vectors_utils_TVector.h.
constexpr Vector geo::vect::makeFromCoords | ( | Coords && | coords | ) |
Creates a Vector
object with coordinates from coords
.
Vector | the type of vector to be created |
Coords | type of object holding the value of the needed coordinates |
coords | object holding the value of the needed coordinates |
Vector
object with coordinates from coords
To create a vector of dimension N, the first N values are extracted from coords
using Coords::operator[](std::size_t)
. For example:
will set p
as constexpr geo::Point_t {2.0, 5.0, 7.0 }
, ignoring the additional data. Likewise, it will set v
to geo::Vector_t{ 5.0, 7.0, 11.0 }
. In both cases, the coordinates are implicitly converted from float
into the scalar type of the target vectors (in both cases, double
).
Definition at line 1668 of file geo_vectors_utils.h.
GENVECTOR_CONSTEXPR ::geo::Point_t geo::vect::makePointFromCoords | ( | Coords && | coords | ) |
Creates a geo::Point_t
from its coordinates (see makeFromCoords()
).
Definition at line 1307 of file geo_vectors_utils.h.
Referenced by geo::BoxBoundedGeo::ContainsPosition(), geo::AuxDetGeo::DistanceToPoint(), geo::AuxDetSensitiveGeo::DistanceToPoint(), geo::GeometryCore::FindAuxDetAtPosition(), geo::GeometryCore::FindAuxDetSensitiveAtPosition(), geo::GeometryCore::FindCryostatAtPosition(), geo::AuxDetGeo::FindSensitiveVolume(), geo::CryostatGeo::FindTPCAtPosition(), geo::GeometryCore::FindTPCAtPosition(), geo::CryostatGeo::GetClosestOpDet(), geo::GeometryCore::GetClosestOpDet(), geo::GeometryCore::MassBetweenPoints(), proxy::SpacePointWithCharge< CollProxy >::position(), geo::GeometryCore::PositionToAuxDet(), geo::GeometryCore::PositionToAuxDetSensitive(), geo::GeometryCore::PositionToCryostat(), geo::AuxDetGeo::PositionToSensitiveVolume(), geo::CryostatGeo::PositionToTPC(), and geo::GeometryCore::PositionToTPC().
GENVECTOR_CONSTEXPR ::geo::Vector_t geo::vect::makeVectorFromCoords | ( | Coords && | coords | ) |
Creates a geo::Vector_t
from its coordinates (see makeFromCoords()
).
Definition at line 1312 of file geo_vectors_utils.h.
geo::Point_t geo::vect::middlePoint | ( | BeginIter | begin, |
EndIter | end | ||
) |
Returns the middle of the specified points.
BeginIter | type of iterator to a point type compatible with add() |
EndIter | type of end iterator |
begin | iterator to the first point to be averaged |
end | iterator after the last point to be averaged |
Point_t
with the value of the middle pointExample of usage:
The variable mp
of the example will be of type geo::Point_t
.
Definition at line 1240 of file geo_vectors_utils.h.
References evd::details::begin(), and evd::details::end().
Point geo::vect::middlePoint | ( | std::initializer_list< Point > | points | ) |
Returns the middle of the specified points.
Point | cartesian-represented point type with 3-component constructor and X(), Y() and Z() accessors. |
points | the list of points to be included |
Example of usage:
The variable mp
will contain the middle point between the two specified in the initializer list.
Definition at line 1260 of file geo_vectors_utils.h.
Point geo::vect::middlePointAs | ( | BeginIter | begin, |
EndIter | end | ||
) |
Returns the middle of the specified points.
Point | cartesian-represented point type with 3-component constructor |
BeginIter | type of iterator to a point type compatible with add() |
EndIter | type of end iterator |
begin | iterator to the first point to be averaged |
end | iterator after the last point to be averaged |
Point
with the value of the middle pointExample of usage:
The variable mp
of the example will be of type geo::Vector_t
(converted component by components from a geo::Point_t
).
Definition at line 1211 of file geo_vectors_utils.h.
References evd::details::begin(), and evd::details::end().
auto geo::vect::mixedProduct | ( | Vector const & | a, |
Vector const & | b, | ||
Vector const & | c | ||
) |
Return "mixed" product of three vectors:
Definition at line 1003 of file geo_vectors_utils.h.
References cross(), and dot().
Referenced by geo::PlaneGeo::UpdateView().
auto geo::vect::norm | ( | Vector const & | v | ) |
Return norm of the specified vector.
Definition at line 998 of file geo_vectors_utils.h.
|
inline |
Definition at line 1335 of file geo_vectors_utils.h.
Vector geo::vect::normalize | ( | Vector const & | v | ) |
Returns a vector parallel to v and with norm 1.
Definition at line 982 of file geo_vectors_utils.h.
Referenced by geo::PlaneBase< geo::Vector_t >::PastorizeUnitVector(), and geo::TPCGeo::SortPlanes().
void geo::vect::round01 | ( | Vector & | v, |
Scalar | tol | ||
) |
Returns a vector with all components rounded if close to 0, -1 or +1.
Definition at line 973 of file geo_vectors_utils.h.
References isfinite(), and rounded01().
Referenced by geo::TPCGeo::ResetDriftDirection(), and geo::PlaneGeo::UpdatePlaneNormal().
Vector geo::vect::rounded01 | ( | Vector const & | v, |
Scalar | tol | ||
) |
Returns a vector with all components rounded if close to 0, -1 or +1.
Definition at line 965 of file geo_vectors_utils.h.
References geo::vect::extra::roundValue01(), and transformCoords().
Referenced by geo::PlaneGeo::DetectGeometryDirections(), geo::PlaneGeo::GetNormalAxis(), groupTPCsByDriftDir(), lar::example::TotallyCheatTrackingAlg::makeTrack(), geo::PlaneBase< geo::Vector_t >::PastorizeUnitVector(), round01(), geo::PlaneGeo::UpdateIncreasingWireDir(), geo::PlaneGeo::UpdateWidthDepthDir(), and geo::PlaneGeo::UpdateWireDir().
auto geo::vect::Tcoord | ( | Vector & | v | ) |
Returns an object to manage the coordinate T of the vector v
.
Vector | the type of vector to be managed |
v | the vector with the coordinate T to be managed |
v
The type Vector
needs to have a double T() const
method and a auto SetT(auto)
method, where the argument is the type of the managed coordinate and the return value is unspecified.
Definition at line 851 of file geo_vectors_utils.h.
References bindCoordManagers(), bindCoordReaders(), convertCollTo(), convertTo(), coord(), n, and transformCoords().
Referenced by geo::vect::details::BindCoordManagersImpl< Vector, 4U >::bind(), and geo::vect::details::ConvertToImpl< Dest, Source, 4U >::convert().
::geo::Point_t geo::vect::toPoint | ( | Point const & | p | ) |
Convert the specified point into a geo::Point_t
.
Definition at line 1281 of file geo_vectors_utils.h.
Referenced by geo::BoxBoundedGeo::ContainsPosition(), geo::TPCGeo::DecomposePoint(), geo::PlaneGeo::DecomposePoint(), geo::PlaneGeo::DecomposePointWidthDepth(), geo::PlaneGeo::DistanceFromPlane(), geo::TPCGeo::DistanceFromReferencePlane(), geo::GeometryCore::FindTPCAtPosition(), geo::PlaneGeo::isProjectionOnPlane(), lar::example::TotallyCheatTrackingAlg::makeTrack(), geo::GeometryCore::MaterialName(), geo::GeometryCore::NearestChannel(), geo::GeometryCore::NearestWire(), geo::PlaneGeo::NearestWireID(), geo::GeometryCore::NearestWireID(), geo::PlaneGeo::PlaneCoordinate(), geo::PlaneGeo::PlaneCoordinateFrom(), geo::TPCGeo::PointProjection(), geo::PlaneGeo::PointProjection(), geo::PlaneGeo::PointWidthDepthProjection(), geo::PlaneGeo::UpdateDecompWireOrigin(), geo::GeometryCore::VolumeName(), and geo::GeometryCore::WireCoordinate().
TVector3 geo::vect::toTVector3 | ( | Vector const & | v | ) |
Converts a vector into a TVector3
.
Definition at line 44 of file geo_vectors_utils_TVector.h.
Referenced by geo::GeometryCore::IntersectSegments().
::geo::Vector_t geo::vect::toVector | ( | Vector const & | v | ) |
Convert the specified vector into a geo::Vector_t
.
Definition at line 1286 of file geo_vectors_utils.h.
References convertCollToPoint().
Referenced by lar::example::TotallyCheatTrackingAlg::makeTrack(), geo::PlaneGeo::UpdateIncreasingWireDir(), geo::PlaneGeo::UpdateWireDir(), geo::TPCGeo::VectorProjection(), geo::PlaneGeo::VectorProjection(), and geo::PlaneGeo::VectorWidthDepthProjection().
Vector geo::vect::transformCoords | ( | Vector const & | v, |
Pred && | pred | ||
) |
Returns a new vector applying a predicate to each component.
Vector | type of the vector in input (and output) |
Pred | type of unary predicate to be applied |
v | the vector to be transformed |
pred | the predicate to be applied |
{ pred(x), pred(y), ... }
The predicate is a "functor" type, taking as the single argument the coordinate to be transformed, and returning the transformed value of it.
Definition at line 1749 of file geo_vectors_utils.h.
References bindCoordReaders().
Referenced by rounded01(), and Tcoord().
auto geo::vect::Xcoord | ( | Vector & | v | ) |
Returns an object to manage the coordinate X of the vector v
.
Vector | the type of vector to be managed |
v | the vector with the coordinate X to be managed |
v
The type Vector
needs to have a double X() const
method and a auto SetX(auto)
method, where the argument is the type of the managed coordinate and the return value is unspecified.
Definition at line 809 of file geo_vectors_utils.h.
References bindCoord().
Referenced by geo::vect::details::BindCoordManagersImpl< Vector, 2U >::bind(), geo::vect::details::BindCoordManagersImpl< Vector, 3U >::bind(), geo::vect::details::BindCoordManagersImpl< Vector, 4U >::bind(), geo::vect::details::ConvertToImpl< Dest, Source, 2U >::convert(), geo::vect::details::ConvertToImpl< Dest, Source, 3U >::convert(), geo::vect::details::ConvertToImpl< Dest, Source, 4U >::convert(), and geo::TPCGeo::GetCathodeCenterImpl().
auto geo::vect::Ycoord | ( | Vector & | v | ) |
Returns an object to manage the coordinate Y of the vector v
.
Vector | the type of vector to be managed |
v | the vector with the coordinate Y to be managed |
v
The type Vector
needs to have a double Y() const
method and a auto SetY(auto)
method, where the argument is the type of the managed coordinate and the return value is unspecified.
Definition at line 823 of file geo_vectors_utils.h.
Referenced by geo::vect::details::BindCoordManagersImpl< Vector, 2U >::bind(), geo::vect::details::BindCoordManagersImpl< Vector, 3U >::bind(), geo::vect::details::BindCoordManagersImpl< Vector, 4U >::bind(), geo::vect::details::ConvertToImpl< Dest, Source, 2U >::convert(), geo::vect::details::ConvertToImpl< Dest, Source, 3U >::convert(), and geo::vect::details::ConvertToImpl< Dest, Source, 4U >::convert().
auto geo::vect::Zcoord | ( | Vector & | v | ) |
Returns an object to manage the coordinate Z of the vector v
.
Vector | the type of vector to be managed |
v | the vector with the coordinate Z to be managed |
v
The type Vector
needs to have a double Z() const
method and a auto SetZ(auto)
method, where the argument is the type of the managed coordinate and the return value is unspecified.
Definition at line 837 of file geo_vectors_utils.h.
Referenced by geo::vect::details::BindCoordManagersImpl< Vector, 3U >::bind(), geo::vect::details::BindCoordManagersImpl< Vector, 4U >::bind(), geo::vect::details::ConvertToImpl< Dest, Source, 3U >::convert(), and geo::vect::details::ConvertToImpl< Dest, Source, 4U >::convert().
|
static |
An object that can be bound to a vector to manage its T coordinate.
geo::vect::XcoordManager
Definition at line 698 of file geo_vectors_utils.h.
|
static |
An object that can be bound to a vector to manage its T coordinate.
geo::vect::XcoordManager
Definition at line 704 of file geo_vectors_utils.h.
|
static |
Object that can be bound to a vector to manage its X coordinate.
Vector | type of vector to get a manager for (mutable type required) |
The manager exposes a read/write interface. Example of usage:
will print something like:
Note that the use in the example, Xcoord()
is preferred.
Definition at line 643 of file geo_vectors_utils.h.
|
static |
Object that can be bound to a vector to access its X coordinate.
Vector | type of vector to get a manager for (constant type required) |
The manager exposes a read-only interface. Example of usage:
will print something like:
Note that the use in the example, Xcoord()
is preferred.
Definition at line 668 of file geo_vectors_utils.h.
|
static |
An object that can be bound to a vector to manage its Y coordinate.
geo::vect::XcoordManager
Definition at line 674 of file geo_vectors_utils.h.
|
static |
An object that can be bound to a vector to manage its Y coordinate.
geo::vect::XcoordManager
Definition at line 680 of file geo_vectors_utils.h.
|
static |
An object that can be bound to a vector to manage its Z coordinate.
geo::vect::XcoordManager
Definition at line 686 of file geo_vectors_utils.h.
|
static |
An object that can be bound to a vector to manage its Z coordinate.
geo::vect::XcoordManager
Definition at line 692 of file geo_vectors_utils.h.