Classes | Public Types | Public Member Functions | Protected Types | Static Protected Member Functions | Protected Attributes | List of all members
lar::util::simple_geo::AreaBase< Point > Class Template Reference

Area/volume delimited by points: base/1D implementation. More...

#include <SimpleGeo.h>

Inheritance diagram for lar::util::simple_geo::AreaBase< Point >:
lar::util::simple_geo::Area< Point > lar::util::simple_geo::Volume< Point >

Classes

class  NullIntersection
 Exception thrown when result of intersection is null. More...
 

Public Types

using Point_t = Point
 
using Area_t = AreaBase< Point >
 

Public Member Functions

 AreaBase ()=default
 
 AreaBase (Point_t const &a, Point_t const &b)
 
Point_t const & Min () const
 
Point_t const & Max () const
 
Point_t Center () const
 
auto DeltaX () const
 
bool isEmptyX () const
 
bool isNullX () const
 
bool isNull () const
 
unsigned int nonEmptyDims () const
 
bool isEmpty () const
 
bool isLine () const
 
auto thinnestSize () const
 
unsigned int thinnestSide () const
 Returns the index of the thinnest side (0 is x) More...
 
void IncludePoint (Point_t const &point)
 
void Include (Area_t const &area)
 
void Intersect (Area_t const &area)
 
bool operator== (Area_t const &as) const
 
bool operator!= (Area_t const &as) const
 

Protected Types

using Data_t = typename Point_t::Data_t
 

Static Protected Member Functions

static void set_min (Data_t &var, Data_t val)
 
static void set_max (Data_t &var, Data_t val)
 
static void set_min_max (Data_t &min_var, Data_t &max_var, Data_t val)
 
static void set_sorted (Data_t &min_var, Data_t &max_var, Data_t a, Data_t b)
 

Protected Attributes

Point_t min
 
Point_t max
 

Detailed Description

template<typename Point>
class lar::util::simple_geo::AreaBase< Point >

Area/volume delimited by points: base/1D implementation.

Definition at line 125 of file SimpleGeo.h.

Member Typedef Documentation

template<typename Point >
using lar::util::simple_geo::AreaBase< Point >::Area_t = AreaBase<Point>

Definition at line 128 of file SimpleGeo.h.

template<typename Point >
using lar::util::simple_geo::AreaBase< Point >::Data_t = typename Point_t::Data_t
protected

Definition at line 176 of file SimpleGeo.h.

template<typename Point >
using lar::util::simple_geo::AreaBase< Point >::Point_t = Point

Definition at line 127 of file SimpleGeo.h.

Constructor & Destructor Documentation

template<typename Point >
lar::util::simple_geo::AreaBase< Point >::AreaBase ( )
default
template<typename Point >
lar::util::simple_geo::AreaBase< Point >::AreaBase ( Point_t const &  a,
Point_t const &  b 
)
inline

Definition at line 137 of file SimpleGeo.h.

138  { set_sorted(min.x, max.x, a.x, b.x); }
const double a
static bool * b
Definition: config.cpp:1043
static void set_sorted(Data_t &min_var, Data_t &max_var, Data_t a, Data_t b)
Definition: SimpleGeo.h:190

Member Function Documentation

template<typename Point >
Point_t lar::util::simple_geo::AreaBase< Point >::Center ( ) const
inline

Definition at line 142 of file SimpleGeo.h.

142 { return (min + max) * 0.5; }
template<typename Point >
auto lar::util::simple_geo::AreaBase< Point >::DeltaX ( ) const
inline

Definition at line 144 of file SimpleGeo.h.

144 { return Max().x - Min().x; }
Point_t const & Min() const
Definition: SimpleGeo.h:140
Point_t const & Max() const
Definition: SimpleGeo.h:141
template<typename Point >
void lar::util::simple_geo::AreaBase< Point >::Include ( Area_t const &  area)
inline

Definition at line 160 of file SimpleGeo.h.

161  { IncludePoint(area.min); IncludePoint(area.max); }
void IncludePoint(Point_t const &point)
Definition: SimpleGeo.h:157
template<typename Point >
void lar::util::simple_geo::AreaBase< Point >::IncludePoint ( Point_t const &  point)
inline

Definition at line 157 of file SimpleGeo.h.

158  { set_min_max(min.x, max.x, point.x); }
static void set_min_max(Data_t &min_var, Data_t &max_var, Data_t val)
Definition: SimpleGeo.h:186
template<typename Point >
void lar::util::simple_geo::AreaBase< Point >::Intersect ( Area_t const &  area)
inline

Definition at line 163 of file SimpleGeo.h.

164  {
165  set_max(min.x, area.min.x);
166  set_min(max.x, area.max.x);
167  if (isNullX()) throw NullIntersection("null x dimension");
168  }
static void set_min(Data_t &var, Data_t val)
Definition: SimpleGeo.h:180
static void set_max(Data_t &var, Data_t val)
Definition: SimpleGeo.h:183
template<typename Point >
bool lar::util::simple_geo::AreaBase< Point >::isEmpty ( ) const
inline

Definition at line 149 of file SimpleGeo.h.

149 { return nonEmptyDims() == 0; }
unsigned int nonEmptyDims() const
Definition: SimpleGeo.h:148
template<typename Point >
bool lar::util::simple_geo::AreaBase< Point >::isEmptyX ( ) const
inline

Definition at line 145 of file SimpleGeo.h.

145 { return (DeltaX() == 0); }
template<typename Point >
bool lar::util::simple_geo::AreaBase< Point >::isLine ( ) const
inline

Definition at line 150 of file SimpleGeo.h.

150 { return nonEmptyDims() == 1; }
unsigned int nonEmptyDims() const
Definition: SimpleGeo.h:148
template<typename Point >
bool lar::util::simple_geo::AreaBase< Point >::isNull ( ) const
inline

Definition at line 147 of file SimpleGeo.h.

147 { return isNullX(); }
template<typename Point >
bool lar::util::simple_geo::AreaBase< Point >::isNullX ( ) const
inline

Definition at line 146 of file SimpleGeo.h.

146 { return Max().x < Min().x; }
Point_t const & Min() const
Definition: SimpleGeo.h:140
Point_t const & Max() const
Definition: SimpleGeo.h:141
template<typename Point >
Point_t const& lar::util::simple_geo::AreaBase< Point >::Max ( ) const
inline

Definition at line 141 of file SimpleGeo.h.

141 { return max; }
template<typename Point >
Point_t const& lar::util::simple_geo::AreaBase< Point >::Min ( ) const
inline

Definition at line 140 of file SimpleGeo.h.

140 { return min; }
template<typename Point >
unsigned int lar::util::simple_geo::AreaBase< Point >::nonEmptyDims ( ) const
inline

Definition at line 148 of file SimpleGeo.h.

148 { return isEmptyX()? 0: 1; }
template<typename Point >
bool lar::util::simple_geo::AreaBase< Point >::operator!= ( Area_t const &  as) const
inline

Definition at line 172 of file SimpleGeo.h.

173  { return (min != as.min) || (max != as.max); }
static constexpr double as
Definition: Units.h:101
template<typename Point >
bool lar::util::simple_geo::AreaBase< Point >::operator== ( Area_t const &  as) const
inline

Definition at line 170 of file SimpleGeo.h.

171  { return (min == as.min) && (max == as.max); }
static constexpr double as
Definition: Units.h:101
template<typename Point >
static void lar::util::simple_geo::AreaBase< Point >::set_max ( Data_t var,
Data_t  val 
)
inlinestaticprotected

Definition at line 183 of file SimpleGeo.h.

184  { if (val > var) var = val; }
int var
Definition: 018_def.c:9
template<typename Point >
static void lar::util::simple_geo::AreaBase< Point >::set_min ( Data_t var,
Data_t  val 
)
inlinestaticprotected

Definition at line 180 of file SimpleGeo.h.

181  { if (val < var) var = val; }
int var
Definition: 018_def.c:9
template<typename Point >
static void lar::util::simple_geo::AreaBase< Point >::set_min_max ( Data_t min_var,
Data_t max_var,
Data_t  val 
)
inlinestaticprotected

Definition at line 186 of file SimpleGeo.h.

187  { set_min(min_var, val); set_max(max_var, val); }
static void set_min(Data_t &var, Data_t val)
Definition: SimpleGeo.h:180
static void set_max(Data_t &var, Data_t val)
Definition: SimpleGeo.h:183
template<typename Point >
static void lar::util::simple_geo::AreaBase< Point >::set_sorted ( Data_t min_var,
Data_t max_var,
Data_t  a,
Data_t  b 
)
inlinestaticprotected

Definition at line 190 of file SimpleGeo.h.

191  {
192  if (a > b) { min_var = b; max_var = a; }
193  else { min_var = a; max_var = b; }
194  }
const double a
static bool * b
Definition: config.cpp:1043
template<typename Point >
unsigned int lar::util::simple_geo::AreaBase< Point >::thinnestSide ( ) const
inline

Returns the index of the thinnest side (0 is x)

Definition at line 155 of file SimpleGeo.h.

155 { return 0; }
template<typename Point >
auto lar::util::simple_geo::AreaBase< Point >::thinnestSize ( ) const
inline

Definition at line 152 of file SimpleGeo.h.

152 { return DeltaX(); }

Member Data Documentation

template<typename Point >
Point_t lar::util::simple_geo::AreaBase< Point >::max
protected

Definition at line 178 of file SimpleGeo.h.

template<typename Point >
Point_t lar::util::simple_geo::AreaBase< Point >::min
protected

Definition at line 178 of file SimpleGeo.h.


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