Public Types | Public Member Functions | Public Attributes | List of all members
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 388 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 389 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 391 of file SimpleGeo.h.

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

This type.

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

401  : width(width), depth(depth)
402  {}
Range_t width
Range along width direction.
Definition: SimpleGeo.h:393
Range_t depth
Range along depth direction.
Definition: SimpleGeo.h:394

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 408 of file SimpleGeo.h.

409  { return width.contains(w) && depth.contains(d); }
bool contains(Data_t v) const
Returns whether the specified value is within the range.
Definition: SimpleGeo.h:344
Range_t width
Range along width direction.
Definition: SimpleGeo.h:393
Range_t depth
Range along depth direction.
Definition: SimpleGeo.h:394
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 517 of file SimpleGeo.h.

518 {
519  width.extendToInclude(r.width);
520  depth.extendToInclude(r.depth);
521 } // lar::util::simple_geo::Rectangle<Data>::extendToInclude()
void extendToInclude(Data_t)
Extends the range to include the specified point.
Definition: SimpleGeo.h:456
Range_t width
Range along width direction.
Definition: SimpleGeo.h:393
Range_t depth
Range along depth direction.
Definition: SimpleGeo.h:394
template<typename Data = double>
bool lar::util::simple_geo::Rectangle< Data >::isNull ( ) const
inline

Returns whether the rectangle has null area.

Definition at line 405 of file SimpleGeo.h.

405 { return width.isNull() || depth.isNull(); }
Range_t width
Range along width direction.
Definition: SimpleGeo.h:393
Range_t depth
Range along depth direction.
Definition: SimpleGeo.h:394
bool isNull() const
Returns whether the range is empty.
Definition: SimpleGeo.h:338
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 527 of file SimpleGeo.h.

528 {
529  if (isNull() || r.isNull()) return false;
530  return width.overlap(r.width) && depth.overlap(r.depth);
531 } // lar::util::simple_geo::Rectangle<Data>::overlaps()
bool isNull() const
Returns whether the rectangle has null area.
Definition: SimpleGeo.h:405
Range_t width
Range along width direction.
Definition: SimpleGeo.h:393
Range_t depth
Range along depth direction.
Definition: SimpleGeo.h:394

Member Data Documentation

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

Range along depth direction.

Definition at line 394 of file SimpleGeo.h.

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

Range along width direction.

Definition at line 393 of file SimpleGeo.h.


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