LArSoft  v10_04_05
Liquid Argon Software toolkit - https://larsoft.org/
lar::util::simple_geo::Area< Point > Class Template Reference

Area delimited by two points. More...

#include "SimpleGeo.h"

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

Public Types

using Point_t = typename Base_t::Point_t
 
using Area_t = Area< Point_t >
 

Public Member Functions

 Area ()=default
 
 Area (Point_t const &a, Point_t const &b)
 
auto DeltaY () const
 
bool isEmptyY () const
 
unsigned int nonEmptyDims () const
 
bool isNullY () const
 
bool isNull () const
 
bool isEmpty () const
 
bool isLine () const
 
bool isPlane () const
 
auto thinnestSize () const
 
unsigned int thinnestSide () const
 Returns the index of the thinnest side (0 is x, 1 is y) More...
 
void IncludePoint (Point_t const &point)
 
void Include (Area_t const &area)
 
void Intersect (Area_t const &area)
 
Point_t const & Min () const
 
Point_t const & Max () const
 
Point_t Center () const
 
auto DeltaX () const
 
bool isEmptyX () const
 
bool isNullX () const
 
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
 

Private Types

using Base_t = AreaBase< Point >
 

Detailed Description

template<typename Point = Point2D<double>>
class lar::util::simple_geo::Area< Point >

Area delimited by two points.

Definition at line 230 of file SimpleGeo.h.

Member Typedef Documentation

template<typename Point = Point2D<double>>
using lar::util::simple_geo::Area< Point >::Area_t = Area<Point_t>

Definition at line 235 of file SimpleGeo.h.

template<typename Point = Point2D<double>>
using lar::util::simple_geo::Area< Point >::Base_t = AreaBase<Point>
private

Definition at line 231 of file SimpleGeo.h.

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

Definition at line 194 of file SimpleGeo.h.

template<typename Point = Point2D<double>>
using lar::util::simple_geo::Area< Point >::Point_t = typename Base_t::Point_t

Definition at line 234 of file SimpleGeo.h.

Constructor & Destructor Documentation

template<typename Point = Point2D<double>>
lar::util::simple_geo::Area< Point >::Area ( )
default
template<typename Point = Point2D<double>>
lar::util::simple_geo::Area< Point >::Area ( Point_t const &  a,
Point_t const &  b 
)
inline

Definition at line 239 of file SimpleGeo.h.

References lar::util::simple_geo::Point2D< Data >::y.

239  : Base_t(a, b)
240  {
242  }
Float_t y
Definition: compare.C:6
AreaBase< Point > Base_t
Definition: SimpleGeo.h:231
static void set_sorted(Data_t &min_var, Data_t &max_var, Data_t a, Data_t b)
Definition: SimpleGeo.h:214

Member Function Documentation

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

Definition at line 160 of file SimpleGeo.h.

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

Definition at line 162 of file SimpleGeo.h.

162 { return Max().x - Min().x; }
Point_t const & Min() const
Definition: SimpleGeo.h:158
Point_t const & Max() const
Definition: SimpleGeo.h:159
template<typename Point = Point2D<double>>
auto lar::util::simple_geo::Area< Point >::DeltaY ( ) const
inline

Definition at line 244 of file SimpleGeo.h.

244 { return Base_t::Max().y - Base_t::Min().y; }
Point_t const & Min() const
Definition: SimpleGeo.h:158
Point_t const & Max() const
Definition: SimpleGeo.h:159
template<typename Point = Point2D<double>>
void lar::util::simple_geo::Area< Point >::Include ( Area_t const &  area)
inline

Definition at line 267 of file SimpleGeo.h.

References lar::util::simple_geo::AreaBase< Point >::max, and lar::util::simple_geo::AreaBase< Point >::min.

268  {
269  IncludePoint(area.min);
270  IncludePoint(area.max);
271  }
void IncludePoint(Point_t const &point)
Definition: SimpleGeo.h:261
template<typename Point = Point2D<double>>
void lar::util::simple_geo::Area< Point >::IncludePoint ( Point_t const &  point)
inline

Definition at line 261 of file SimpleGeo.h.

References lar::util::simple_geo::Point2D< Data >::y.

262  {
263  Base_t::IncludePoint(point);
265  }
Float_t y
Definition: compare.C:6
static void set_min_max(Data_t &min_var, Data_t &max_var, Data_t val)
Definition: SimpleGeo.h:208
void IncludePoint(Point_t const &point)
Definition: SimpleGeo.h:175
template<typename Point = Point2D<double>>
void lar::util::simple_geo::Area< Point >::Intersect ( Area_t const &  area)
inline

Definition at line 273 of file SimpleGeo.h.

References lar::util::simple_geo::AreaBase< Point >::max, lar::util::simple_geo::AreaBase< Point >::min, and lar::util::simple_geo::Point2D< Data >::y.

274  {
275  Base_t::Intersect(area);
276  Base_t::set_max(Base_t::min.y, area.min.y);
277  Base_t::set_min(Base_t::max.y, area.max.y);
278  if (isNullY()) throw typename Base_t::NullIntersection("null y dimension");
279  }
void Intersect(Area_t const &area)
Definition: SimpleGeo.h:183
Float_t y
Definition: compare.C:6
static void set_min(Data_t &var, Data_t val)
Definition: SimpleGeo.h:198
static void set_max(Data_t &var, Data_t val)
Definition: SimpleGeo.h:203
template<typename Point = Point2D<double>>
bool lar::util::simple_geo::Area< Point >::isEmpty ( ) const
inline

Definition at line 249 of file SimpleGeo.h.

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

Definition at line 163 of file SimpleGeo.h.

163 { return (DeltaX() == 0); }
template<typename Point = Point2D<double>>
bool lar::util::simple_geo::Area< Point >::isEmptyY ( ) const
inline

Definition at line 245 of file SimpleGeo.h.

245 { return DeltaY() == 0; }
template<typename Point = Point2D<double>>
bool lar::util::simple_geo::Area< Point >::isLine ( ) const
inline

Definition at line 250 of file SimpleGeo.h.

250 { return nonEmptyDims() == 1; }
unsigned int nonEmptyDims() const
Definition: SimpleGeo.h:246
template<typename Point = Point2D<double>>
bool lar::util::simple_geo::Area< Point >::isNull ( ) const
inline

Definition at line 248 of file SimpleGeo.h.

248 { return Base_t::isNull() || isNullY(); }
template<typename Point >
bool lar::util::simple_geo::AreaBase< Point >::isNullX ( ) const
inlineinherited

Definition at line 164 of file SimpleGeo.h.

164 { return Max().x < Min().x; }
Point_t const & Min() const
Definition: SimpleGeo.h:158
Point_t const & Max() const
Definition: SimpleGeo.h:159
template<typename Point = Point2D<double>>
bool lar::util::simple_geo::Area< Point >::isNullY ( ) const
inline

Definition at line 247 of file SimpleGeo.h.

247 { return Base_t::Max().y < Base_t::Min().y; }
Point_t const & Min() const
Definition: SimpleGeo.h:158
Point_t const & Max() const
Definition: SimpleGeo.h:159
template<typename Point = Point2D<double>>
bool lar::util::simple_geo::Area< Point >::isPlane ( ) const
inline

Definition at line 251 of file SimpleGeo.h.

251 { return nonEmptyDims() == 2; }
unsigned int nonEmptyDims() const
Definition: SimpleGeo.h:246
template<typename Point >
Point_t const& lar::util::simple_geo::AreaBase< Point >::Max ( ) const
inlineinherited

Definition at line 159 of file SimpleGeo.h.

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

Definition at line 158 of file SimpleGeo.h.

158 { return min; }
template<typename Point = Point2D<double>>
unsigned int lar::util::simple_geo::Area< Point >::nonEmptyDims ( ) const
inline

Definition at line 246 of file SimpleGeo.h.

246 { return Base_t::nonEmptyDims() + (isEmptyY() ? 0 : 1); }
unsigned int nonEmptyDims() const
Definition: SimpleGeo.h:166
template<typename Point >
bool lar::util::simple_geo::AreaBase< Point >::operator!= ( Area_t const &  as) const
inlineinherited

Definition at line 191 of file SimpleGeo.h.

References lar::util::simple_geo::AreaBase< Point >::max, and lar::util::simple_geo::AreaBase< Point >::min.

191 { return (min != as.min) || (max != as.max); }
template<typename Point >
bool lar::util::simple_geo::AreaBase< Point >::operator== ( Area_t const &  as) const
inlineinherited

Definition at line 190 of file SimpleGeo.h.

References lar::util::simple_geo::AreaBase< Point >::max, and lar::util::simple_geo::AreaBase< Point >::min.

190 { return (min == as.min) && (max == as.max); }
template<typename Point >
static void lar::util::simple_geo::AreaBase< Point >::set_max ( Data_t var,
Data_t  val 
)
inlinestaticprotectedinherited

Definition at line 203 of file SimpleGeo.h.

204  {
205  if (val > var) var = val;
206  }
template<typename Point >
static void lar::util::simple_geo::AreaBase< Point >::set_min ( Data_t var,
Data_t  val 
)
inlinestaticprotectedinherited

Definition at line 198 of file SimpleGeo.h.

199  {
200  if (val < var) var = val;
201  }
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 
)
inlinestaticprotectedinherited

Definition at line 208 of file SimpleGeo.h.

209  {
210  set_min(min_var, val);
211  set_max(max_var, val);
212  }
static void set_min(Data_t &var, Data_t val)
Definition: SimpleGeo.h:198
static void set_max(Data_t &var, Data_t val)
Definition: SimpleGeo.h:203
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 
)
inlinestaticprotectedinherited

Definition at line 214 of file SimpleGeo.h.

215  {
216  if (a > b) {
217  min_var = b;
218  max_var = a;
219  }
220  else {
221  min_var = a;
222  max_var = b;
223  }
224  }
template<typename Point = Point2D<double>>
unsigned int lar::util::simple_geo::Area< Point >::thinnestSide ( ) const
inline

Returns the index of the thinnest side (0 is x, 1 is y)

Definition at line 256 of file SimpleGeo.h.

257  {
258  return (DeltaY() < Base_t::thinnestSize()) ? 1 : Base_t::thinnestSide();
259  }
unsigned int thinnestSide() const
Returns the index of the thinnest side (0 is x)
Definition: SimpleGeo.h:173
template<typename Point = Point2D<double>>
auto lar::util::simple_geo::Area< Point >::thinnestSize ( ) const
inline

Definition at line 253 of file SimpleGeo.h.

253 { return std::min(DeltaY(), Base_t::thinnestSize()); }

Member Data Documentation


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