LArSoft  v06_85_00
Liquid Argon Software toolkit - http://larsoft.org/
lar::util::Vector2DComparison< RealType > Struct Template Reference

Class comparing 2D vectors. More...

#include "RealComparisons.h"

Public Types

using Comp_t = RealComparisons< RealType >
 

Public Member Functions

constexpr Vector2DComparison (Comp_t const &comparer)
 Copy the specified comparison. More...
 
 Vector2DComparison (Comp_t &&comparer)
 Steal the specified comparison. More...
 
constexpr Vector2DComparison (RealType threshold)
 Use the specified threshold. More...
 
constexpr Comp_t comp () const
 Returns the basic value comparer. More...
 
template<typename Vect >
constexpr bool zero (Vect const &v) const
 Returns whether the specified vector is null (within tolerance). More...
 
template<typename Vect >
constexpr bool nonZero (Vect const &v) const
 Returns whether the specified vector is not null (within tolerance). More...
 
template<typename VectA , typename VectB >
constexpr bool equal (VectA const &a, VectB const &b) const
 Returns whether the specified vectors match (within tolerance). More...
 
template<typename VectA , typename VectB >
constexpr bool nonEqual (VectA const &a, VectB const &b) const
 Returns whether the specified vectors do not match (within tolerance). More...
 

Private Attributes

Comp_t const comparer
 Comparison object. More...
 

Detailed Description

template<typename RealType>
struct lar::util::Vector2DComparison< RealType >

Class comparing 2D vectors.

Definition at line 142 of file RealComparisons.h.

Member Typedef Documentation

template<typename RealType>
using lar::util::Vector2DComparison< RealType >::Comp_t = RealComparisons<RealType>

Definition at line 144 of file RealComparisons.h.

Constructor & Destructor Documentation

template<typename RealType>
constexpr lar::util::Vector2DComparison< RealType >::Vector2DComparison ( Comp_t const &  comparer)
inline

Copy the specified comparison.

Definition at line 147 of file RealComparisons.h.

148  : comparer(comparer) {}
Comp_t const comparer
Comparison object.
template<typename RealType>
lar::util::Vector2DComparison< RealType >::Vector2DComparison ( Comp_t &&  comparer)
inline

Steal the specified comparison.

Definition at line 151 of file RealComparisons.h.

151 : comparer(std::move(comparer)) {}
Comp_t const comparer
Comparison object.
template<typename RealType>
constexpr lar::util::Vector2DComparison< RealType >::Vector2DComparison ( RealType  threshold)
inline

Use the specified threshold.

Definition at line 154 of file RealComparisons.h.

154 : comparer(threshold) {}
Comp_t const comparer
Comparison object.

Member Function Documentation

template<typename RealType>
constexpr Comp_t lar::util::Vector2DComparison< RealType >::comp ( ) const
inline

Returns the basic value comparer.

Definition at line 157 of file RealComparisons.h.

157 { return comparer; }
Comp_t const comparer
Comparison object.
template<typename RealType>
template<typename VectA , typename VectB >
constexpr bool lar::util::Vector2DComparison< RealType >::equal ( VectA const &  a,
VectB const &  b 
) const
inline

Returns whether the specified vectors match (within tolerance).

Definition at line 170 of file RealComparisons.h.

171  { return comp().equal(a.X(), b.X()) && comp().equal(a.Y(), b.Y()); }
constexpr Comp_t comp() const
Returns the basic value comparer.
constexpr bool equal(Value_t a, Value_t b) const
Returns whether a and b are no farther than the threshold.
template<typename RealType>
template<typename VectA , typename VectB >
constexpr bool lar::util::Vector2DComparison< RealType >::nonEqual ( VectA const &  a,
VectB const &  b 
) const
inline

Returns whether the specified vectors do not match (within tolerance).

Definition at line 175 of file RealComparisons.h.

176  { return !equal(a, b); }
constexpr bool equal(VectA const &a, VectB const &b) const
Returns whether the specified vectors match (within tolerance).
template<typename RealType>
template<typename Vect >
constexpr bool lar::util::Vector2DComparison< RealType >::nonZero ( Vect const &  v) const
inline

Returns whether the specified vector is not null (within tolerance).

Definition at line 166 of file RealComparisons.h.

166 { return !zero(v); }
constexpr bool zero(Vect const &v) const
Returns whether the specified vector is null (within tolerance).
template<typename RealType>
template<typename Vect >
constexpr bool lar::util::Vector2DComparison< RealType >::zero ( Vect const &  v) const
inline

Returns whether the specified vector is null (within tolerance).

Definition at line 161 of file RealComparisons.h.

162  { return comp().zero(v.X()) && comp().zero(v.Y()); }
constexpr Comp_t comp() const
Returns the basic value comparer.
constexpr bool zero(Value_t value) const
Returns whether the value is no farther from 0 than the threshold.

Member Data Documentation

template<typename RealType>
Comp_t const lar::util::Vector2DComparison< RealType >::comparer
private

Comparison object.

Definition at line 179 of file RealComparisons.h.


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