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

Volume delimited by two points. More...

#include "SimpleGeo.h"

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

Public Types

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

Public Member Functions

 Volume ()=default
 
 Volume (Point_t const &a, Point_t const &b)
 
auto DeltaZ () const
 
bool isEmptyZ () const
 
unsigned int nonEmptyDims () const
 
bool isNullZ () const
 
bool isNull () const
 
bool isEmpty () const
 
bool isLine () const
 
bool isPlane () const
 
bool isVolume () 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 (Volume_t const &volume)
 
void Intersect (Volume_t const &volume)
 
auto DeltaY () const
 
bool isEmptyY () const
 
bool isNullY () const
 
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 = Area< Point >
 

Detailed Description

template<typename Point = Point3D<double>>
class lar::util::simple_geo::Volume< Point >

Volume delimited by two points.

Definition at line 293 of file SimpleGeo.h.

Member Typedef Documentation

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

Definition at line 236 of file SimpleGeo.h.

template<typename Point = Point3D<double>>
using lar::util::simple_geo::Volume< Point >::Base_t = Area<Point>
private

Definition at line 294 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 195 of file SimpleGeo.h.

template<typename Point = Point3D<double>>
using lar::util::simple_geo::Volume< Point >::Point_t = typename Base_t::Point_t

Definition at line 297 of file SimpleGeo.h.

template<typename Point = Point3D<double>>
using lar::util::simple_geo::Volume< Point >::Volume_t = Volume<Point_t>

Definition at line 298 of file SimpleGeo.h.

Constructor & Destructor Documentation

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

Definition at line 302 of file SimpleGeo.h.

References z.

302  : Base_t(a, b)
303  {
305  }
Double_t z
Definition: plot.C:276
static void set_sorted(Data_t &min_var, Data_t &max_var, Data_t a, Data_t b)
Definition: SimpleGeo.h:215

Member Function Documentation

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

Definition at line 161 of file SimpleGeo.h.

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

Definition at line 163 of file SimpleGeo.h.

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

Definition at line 245 of file SimpleGeo.h.

245 { return Base_t::Max().y - Base_t::Min().y; }
Point_t const & Min() const
Definition: SimpleGeo.h:159
Point_t const & Max() const
Definition: SimpleGeo.h:160
template<typename Point = Point3D<double>>
auto lar::util::simple_geo::Volume< Point >::DeltaZ ( ) const
inline

Definition at line 307 of file SimpleGeo.h.

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

Definition at line 268 of file SimpleGeo.h.

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

269  {
270  IncludePoint(area.min);
271  IncludePoint(area.max);
272  }
void IncludePoint(Point_t const &point)
Definition: SimpleGeo.h:262
template<typename Point = Point3D<double>>
void lar::util::simple_geo::Volume< Point >::Include ( Volume_t const &  volume)
inline

Definition at line 331 of file SimpleGeo.h.

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

332  {
333  IncludePoint(volume.min);
334  IncludePoint(volume.max);
335  }
void IncludePoint(Point_t const &point)
Definition: SimpleGeo.h:325
template<typename Point = Point3D<double>>
void lar::util::simple_geo::Volume< Point >::IncludePoint ( Point_t const &  point)
inline

Definition at line 325 of file SimpleGeo.h.

References z.

326  {
327  Base_t::IncludePoint(point);
329  }
Double_t z
Definition: plot.C:276
static void set_min_max(Data_t &min_var, Data_t &max_var, Data_t val)
Definition: SimpleGeo.h:209
void IncludePoint(Point_t const &point)
Definition: SimpleGeo.h:262
template<typename Point = Point2D<double>>
void lar::util::simple_geo::Area< Point >::Intersect ( Area_t const &  area)
inlineinherited

Definition at line 274 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.

275  {
276  Base_t::Intersect(area);
277  Base_t::set_max(Base_t::min.y, area.min.y);
278  Base_t::set_min(Base_t::max.y, area.max.y);
279  if (isNullY()) throw typename Base_t::NullIntersection("null y dimension");
280  }
void Intersect(Area_t const &area)
Definition: SimpleGeo.h:184
Float_t y
Definition: compare.C:6
static void set_min(Data_t &var, Data_t val)
Definition: SimpleGeo.h:199
static void set_max(Data_t &var, Data_t val)
Definition: SimpleGeo.h:204
template<typename Point = Point3D<double>>
void lar::util::simple_geo::Volume< Point >::Intersect ( Volume_t const &  volume)
inline

Definition at line 337 of file SimpleGeo.h.

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

338  {
339  Base_t::Intersect(volume);
340  Base_t::set_max(Base_t::min.z, volume.min.z);
341  Base_t::set_min(Base_t::max.z, volume.max.z);
342  if (isNullZ()) throw typename Base_t::NullIntersection("null z dimension");
343  }
Double_t z
Definition: plot.C:276
void Intersect(Area_t const &area)
Definition: SimpleGeo.h:274
static void set_min(Data_t &var, Data_t val)
Definition: SimpleGeo.h:199
static void set_max(Data_t &var, Data_t val)
Definition: SimpleGeo.h:204
template<typename Point = Point3D<double>>
bool lar::util::simple_geo::Volume< Point >::isEmpty ( ) const
inline

Definition at line 312 of file SimpleGeo.h.

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

Definition at line 164 of file SimpleGeo.h.

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

Definition at line 246 of file SimpleGeo.h.

246 { return DeltaY() == 0; }
template<typename Point = Point3D<double>>
bool lar::util::simple_geo::Volume< Point >::isEmptyZ ( ) const
inline

Definition at line 308 of file SimpleGeo.h.

308 { return DeltaZ() == 0; }
template<typename Point = Point3D<double>>
bool lar::util::simple_geo::Volume< Point >::isLine ( ) const
inline

Definition at line 313 of file SimpleGeo.h.

313 { return nonEmptyDims() == 1; }
unsigned int nonEmptyDims() const
Definition: SimpleGeo.h:309
template<typename Point = Point3D<double>>
bool lar::util::simple_geo::Volume< Point >::isNull ( ) const
inline

Definition at line 311 of file SimpleGeo.h.

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

Definition at line 165 of file SimpleGeo.h.

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

Definition at line 248 of file SimpleGeo.h.

248 { return Base_t::Max().y < Base_t::Min().y; }
Point_t const & Min() const
Definition: SimpleGeo.h:159
Point_t const & Max() const
Definition: SimpleGeo.h:160
template<typename Point = Point3D<double>>
bool lar::util::simple_geo::Volume< Point >::isNullZ ( ) const
inline

Definition at line 310 of file SimpleGeo.h.

310 { return Base_t::Max().z < Base_t::Min().z; }
Point_t const & Min() const
Definition: SimpleGeo.h:159
Point_t const & Max() const
Definition: SimpleGeo.h:160
template<typename Point = Point3D<double>>
bool lar::util::simple_geo::Volume< Point >::isPlane ( ) const
inline

Definition at line 314 of file SimpleGeo.h.

314 { return nonEmptyDims() == 2; }
unsigned int nonEmptyDims() const
Definition: SimpleGeo.h:309
template<typename Point = Point3D<double>>
bool lar::util::simple_geo::Volume< Point >::isVolume ( ) const
inline

Definition at line 315 of file SimpleGeo.h.

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

Definition at line 160 of file SimpleGeo.h.

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

Definition at line 159 of file SimpleGeo.h.

159 { return min; }
template<typename Point = Point3D<double>>
unsigned int lar::util::simple_geo::Volume< Point >::nonEmptyDims ( ) const
inline

Definition at line 309 of file SimpleGeo.h.

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

Definition at line 192 of file SimpleGeo.h.

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

192 { 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 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 >
static void lar::util::simple_geo::AreaBase< Point >::set_max ( Data_t var,
Data_t  val 
)
inlinestaticprotectedinherited

Definition at line 204 of file SimpleGeo.h.

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

Definition at line 199 of file SimpleGeo.h.

200  {
201  if (val < var) var = val;
202  }
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 209 of file SimpleGeo.h.

210  {
211  set_min(min_var, val);
212  set_max(max_var, val);
213  }
static void set_min(Data_t &var, Data_t val)
Definition: SimpleGeo.h:199
static void set_max(Data_t &var, Data_t val)
Definition: SimpleGeo.h:204
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 215 of file SimpleGeo.h.

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

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

Definition at line 320 of file SimpleGeo.h.

321  {
322  return (DeltaZ() < Base_t::thinnestSize()) ? 2 : Base_t::thinnestSide();
323  }
auto thinnestSize() const
Definition: SimpleGeo.h:254
unsigned int thinnestSide() const
Returns the index of the thinnest side (0 is x, 1 is y)
Definition: SimpleGeo.h:257
template<typename Point = Point3D<double>>
auto lar::util::simple_geo::Volume< Point >::thinnestSize ( ) const
inline

Definition at line 317 of file SimpleGeo.h.

317 { return std::min(DeltaZ(), Base_t::thinnestSize()); }
auto thinnestSize() const
Definition: SimpleGeo.h:254

Member Data Documentation


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