LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
lar::util::simple_geo::Rectangle< Data > Struct Template Reference

Definition of a rectangle from dimension ranges. More...

#include "SimpleGeo.h"

Public Types

using Data_t = Data
 Numerical type for boundaries. More...
 
using Rectangle_t = Rectangle< Data >
 This type. More...
 
using Range_t = Range< Data_t >
 Type for dimension boundaries. More...
 

Public Member Functions

 Rectangle ()=default
 Default constructor: an empty rectangle. More...
 
 Rectangle (Range_t const &width, Range_t const &depth)
 Constructor from width and depth ranges. More...
 
bool isNull () const
 Returns whether the rectangle has null area. More...
 
bool contains (Data_t w, Data_t d) const
 Returns whether the specified point is in the area. More...
 
bool overlaps (Rectangle_t const &r) const
 Returns whether this and the specified rectangle overlap. More...
 
void extendToInclude (Rectangle_t const &r)
 Extends the range to include the specified point. More...
 

Public Attributes

Range_t width
 Range along width direction. More...
 
Range_t depth
 Range along depth direction. More...
 

Detailed Description

template<typename Data = double>
struct lar::util::simple_geo::Rectangle< Data >

Definition of a rectangle from dimension ranges.

Template Parameters
Datanumerical type for boundary coordinates
See also
Range, Area

This object defines a 2D area (rectangle) as a list of one range for each dimension. Dimensions are called "width" and "depth".

If the use case asks for point-driven area rather than a dimension-driven area, use Area instead.

Definition at line 424 of file SimpleGeo.h.

Member Typedef Documentation

template<typename Data = double>
using lar::util::simple_geo::Rectangle< Data >::Data_t = Data

Numerical type for boundaries.

Definition at line 425 of file SimpleGeo.h.

template<typename Data = double>
using lar::util::simple_geo::Rectangle< Data >::Range_t = Range<Data_t>

Type for dimension boundaries.

Definition at line 427 of file SimpleGeo.h.

template<typename Data = double>
using lar::util::simple_geo::Rectangle< Data >::Rectangle_t = Rectangle<Data>

This type.

Definition at line 426 of file SimpleGeo.h.

Constructor & Destructor Documentation

template<typename Data = double>
lar::util::simple_geo::Rectangle< Data >::Rectangle ( )
default

Default constructor: an empty rectangle.

template<typename Data = double>
lar::util::simple_geo::Rectangle< Data >::Rectangle ( Range_t const &  width,
Range_t const &  depth 
)
inline

Constructor from width and depth ranges.

Definition at line 436 of file SimpleGeo.h.

436 : width(width), depth(depth) {}
Range_t width
Range along width direction.
Definition: SimpleGeo.h:429
Range_t depth
Range along depth direction.
Definition: SimpleGeo.h:430

Member Function Documentation

template<typename Data = double>
bool lar::util::simple_geo::Rectangle< Data >::contains ( Data_t  w,
Data_t  d 
) const
inline

Returns whether the specified point is in the area.

Definition at line 442 of file SimpleGeo.h.

Referenced by geo::part::AreaOwner::contains().

442 { return width.contains(w) && depth.contains(d); }
Float_t d
Definition: plot.C:235
bool contains(Data_t v) const
Returns whether the specified value is within the range.
Definition: SimpleGeo.h:377
Range_t width
Range along width direction.
Definition: SimpleGeo.h:429
Range_t depth
Range along depth direction.
Definition: SimpleGeo.h:430
Float_t w
Definition: plot.C:20
template<typename Data >
void lar::util::simple_geo::Rectangle< Data >::extendToInclude ( Rectangle_t const &  r)

Extends the range to include the specified point.

Definition at line 545 of file SimpleGeo.h.

References lar::util::simple_geo::Rectangle< Data >::depth, and lar::util::simple_geo::Rectangle< Data >::width.

Referenced by computeTotalArea().

546 {
547  width.extendToInclude(r.width);
548  depth.extendToInclude(r.depth);
549 } // lar::util::simple_geo::Rectangle<Data>::extendToInclude()
TRandom r
Definition: spectrum.C:23
void extendToInclude(Data_t)
Extends the range to include the specified point.
Definition: SimpleGeo.h:484
Range_t width
Range along width direction.
Definition: SimpleGeo.h:429
Range_t depth
Range along depth direction.
Definition: SimpleGeo.h:430
template<typename Data = double>
bool lar::util::simple_geo::Rectangle< Data >::isNull ( ) const
inline

Returns whether the rectangle has null area.

Definition at line 439 of file SimpleGeo.h.

Referenced by lar::util::simple_geo::Rectangle< Data >::overlaps().

439 { return width.isNull() || depth.isNull(); }
Range_t width
Range along width direction.
Definition: SimpleGeo.h:429
Range_t depth
Range along depth direction.
Definition: SimpleGeo.h:430
bool isNull() const
Returns whether the range is empty.
Definition: SimpleGeo.h:371
template<typename Data >
bool lar::util::simple_geo::Rectangle< Data >::overlaps ( Rectangle_t const &  r) const

Returns whether this and the specified rectangle overlap.

Definition at line 553 of file SimpleGeo.h.

References lar::util::simple_geo::Rectangle< Data >::depth, lar::util::simple_geo::Rectangle< Data >::isNull(), and lar::util::simple_geo::Rectangle< Data >::width.

554 {
555  if (isNull() || r.isNull()) return false;
556  return width.overlap(r.width) && depth.overlap(r.depth);
557 } // lar::util::simple_geo::Rectangle<Data>::overlaps()
TRandom r
Definition: spectrum.C:23
bool isNull() const
Returns whether the rectangle has null area.
Definition: SimpleGeo.h:439
Range_t width
Range along width direction.
Definition: SimpleGeo.h:429
Range_t depth
Range along depth direction.
Definition: SimpleGeo.h:430

Member Data Documentation


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