LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
lar::util::simple_geo Namespace Reference

Simple class definitions for geometry concepts. More...

Classes

class  Area
 Area delimited by two points. More...
 
class  AreaBase
 Area/volume delimited by points: base/1D implementation. More...
 
struct  Point2D
 2D point (x, y) (by default, with double precision) More...
 
struct  Point3D
 3D point (x, y, z) (by default, with double precision) More...
 
struct  Range
 Definition of a range along one dimension. More...
 
struct  Rectangle
 Definition of a rectangle from dimension ranges. More...
 
class  Volume
 Volume delimited by two points. More...
 

Functions

Dimensionless objects (points)
template<typename T >
bool operator== (Point2D< T > const &a, Point2D< T > const &b)
 
template<typename T >
bool operator!= (Point2D< T > const &a, Point2D< T > const &b)
 
template<typename T >
Point2D< T > operator+ (Point2D< T > const &a, Point2D< T > const &b)
 
template<typename T >
Point2D< T > operator* (Point2D< T > const &p, typename Point2D< T >::Data_t f)
 
template<typename T >
Point2D< T > operator/ (Point2D< T > const &p, typename Point2D< T >::Data_t f)
 
template<typename Stream , typename T >
Stream & operator<< (Stream &&out, Point2D< T > const &p)
 
template<typename T >
bool operator== (Point3D< T > const &a, Point3D< T > const &b)
 
template<typename T >
bool operator!= (Point3D< T > const &a, Point3D< T > const &b)
 
template<typename T >
Point3D< T > operator+ (Point3D< T > const &a, Point3D< T > const &b)
 
template<typename T >
Point3D< T > operator* (Point3D< T > const &p, typename Point2D< T >::Data_t f)
 
template<typename T >
Point3D< T > operator/ (Point3D< T > const &p, typename Point2D< T >::Data_t f)
 
template<typename Stream , typename T >
Stream & operator<< (Stream &&out, Point3D< T > const &p)
 
Point-bounded volumes
template<typename Stream , typename Point >
Stream & operator<< (Stream &&out, AreaBase< Point > const &area)
 
Dimension-bounded volumes
template<typename Stream , typename Data >
Stream & operator<< (Stream &&out, Range< Data > const &range)
 Prints the specified range to a stream: "( lower -- upper )". More...
 
template<typename Stream , typename Data >
Stream & operator<< (Stream &&out, Rectangle< Data > const &rect)
 Prints the specified rectangle to a stream: "w=Wrange d=Drange". More...
 

Detailed Description

Simple class definitions for geometry concepts.

This namespace provides data structures for "points" and extended structures.

Points are either 2D (Point2D) or 3D (Point3D).

The extended structures are offered in two flavours:

  • point-based (area, volume): definitions of the boundaries are provided as two points of proper dimensionality: Point2D for Area, pOint3D for Volume
  • dimension-based (area only so far): definitions of the boundaries are provided as one range (Range) per dimension

Function Documentation

template<typename T >
bool lar::util::simple_geo::operator!= ( Point2D< T > const &  a,
Point2D< T > const &  b 
)

Definition at line 67 of file SimpleGeo.h.

68  {
69  return (a.x != b.x) || (a.y != b.y);
70  }
template<typename T >
bool lar::util::simple_geo::operator!= ( Point3D< T > const &  a,
Point3D< T > const &  b 
)

Definition at line 112 of file SimpleGeo.h.

References lar::util::simple_geo::Point3D< Data >::x, lar::util::simple_geo::Point3D< Data >::y, and lar::util::simple_geo::Point3D< Data >::z.

113  {
114  return (a.x != b.x) || (a.y != b.y) || (a.z != b.z);
115  }
template<typename T >
Point2D<T> lar::util::simple_geo::operator* ( Point2D< T > const &  p,
typename Point2D< T >::Data_t  f 
)

Definition at line 77 of file SimpleGeo.h.

References f.

78  {
79  return {p.x * f, p.y * f};
80  }
TFile f
Definition: plotHisto.C:6
template<typename T >
Point3D<T> lar::util::simple_geo::operator* ( Point3D< T > const &  p,
typename Point2D< T >::Data_t  f 
)

Definition at line 122 of file SimpleGeo.h.

References f, lar::util::simple_geo::Point3D< Data >::x, lar::util::simple_geo::Point3D< Data >::y, and lar::util::simple_geo::Point3D< Data >::z.

123  {
124  return {p.x * f, p.y * f, p.z * f};
125  }
TFile f
Definition: plotHisto.C:6
template<typename T >
Point2D<T> lar::util::simple_geo::operator+ ( Point2D< T > const &  a,
Point2D< T > const &  b 
)

Definition at line 72 of file SimpleGeo.h.

73  {
74  return {a.x + b.x, a.y + b.y};
75  }
template<typename T >
Point3D<T> lar::util::simple_geo::operator+ ( Point3D< T > const &  a,
Point3D< T > const &  b 
)

Definition at line 117 of file SimpleGeo.h.

References lar::util::simple_geo::Point3D< Data >::x, lar::util::simple_geo::Point3D< Data >::y, and lar::util::simple_geo::Point3D< Data >::z.

118  {
119  return {a.x + b.x, a.y + b.y, a.z + b.z};
120  }
template<typename T >
Point2D<T> lar::util::simple_geo::operator/ ( Point2D< T > const &  p,
typename Point2D< T >::Data_t  f 
)

Definition at line 82 of file SimpleGeo.h.

References f.

83  {
84  return {p.x / f, p.y / f};
85  }
TFile f
Definition: plotHisto.C:6
template<typename T >
Point3D<T> lar::util::simple_geo::operator/ ( Point3D< T > const &  p,
typename Point2D< T >::Data_t  f 
)

Definition at line 127 of file SimpleGeo.h.

References f, lar::util::simple_geo::Point3D< Data >::x, lar::util::simple_geo::Point3D< Data >::y, and lar::util::simple_geo::Point3D< Data >::z.

128  {
129  return {p.x / f, p.y / f, p.z / f};
130  }
TFile f
Definition: plotHisto.C:6
template<typename Stream , typename T >
Stream& lar::util::simple_geo::operator<< ( Stream &&  out,
Point2D< T > const &  p 
)

Definition at line 87 of file SimpleGeo.h.

88  {
89  out << "( " << p.x << " ; " << p.y << " )";
90  return out;
91  }
template<typename Stream , typename T >
Stream& lar::util::simple_geo::operator<< ( Stream &&  out,
Point3D< T > const &  p 
)

Definition at line 132 of file SimpleGeo.h.

133  {
134  out << "( " << p.x << " ; " << p.y << " ; " << p.z << " )";
135  return out;
136  }
template<typename Stream , typename Point >
Stream& lar::util::simple_geo::operator<< ( Stream &&  out,
AreaBase< Point > const &  area 
)

Definition at line 285 of file SimpleGeo.h.

286  {
287  out << area.Min() << " - " << area.Max();
288  return out;
289  }
template<typename Stream , typename Data >
Stream & lar::util::simple_geo::operator<< ( Stream &&  out,
Range< Data > const &  range 
)

Prints the specified range to a stream: "( lower -- upper )".

Definition at line 537 of file SimpleGeo.h.

538 {
539  out << "( " << range.lower << " -- " << range.upper << " )";
540  return out;
541 } // operator<< (Range)
template<typename Stream , typename Data >
Stream & lar::util::simple_geo::operator<< ( Stream &&  out,
Rectangle< Data > const &  rect 
)

Prints the specified rectangle to a stream: "w=Wrange d=Drange".

Definition at line 561 of file SimpleGeo.h.

562 {
563  out << "w=" << rect.width << " d=" << rect.depth;
564  return out;
565 } // operator<< (Rectangle)
template<typename T >
bool lar::util::simple_geo::operator== ( Point2D< T > const &  a,
Point2D< T > const &  b 
)

Definition at line 62 of file SimpleGeo.h.

63  {
64  return (a.x == b.x) && (a.y == b.y);
65  }
template<typename T >
bool lar::util::simple_geo::operator== ( Point3D< T > const &  a,
Point3D< T > const &  b 
)

Definition at line 107 of file SimpleGeo.h.

References lar::util::simple_geo::Point3D< Data >::x, lar::util::simple_geo::Point3D< Data >::y, and lar::util::simple_geo::Point3D< Data >::z.

108  {
109  return (a.x == b.x) && (a.y == b.y) && (a.z == b.z);
110  }