INET Framework for OMNeT++/OMNEST
inet::Box Class Reference

#include <Box.h>

Inheritance diagram for inet::Box:
inet::GeometricObjectBase

Public Member Functions

 Box (const Coord &min, const Coord &max)
 
const CoordgetMin () const
 
const CoordgetMax () const
 
Coord getSize () const
 
Coord getCenter () const
 
virtual bool isNil () const override
 Returns true if this geometric object is the same as the unspecified singleton instance of this type. More...
 
virtual bool isUnspecified () const override
 Returns true if this geometric object is not completely specified. More...
 
- Public Member Functions inherited from inet::GeometricObjectBase
 GeometricObjectBase ()
 
virtual ~GeometricObjectBase ()
 

Static Public Member Functions

static Box computeBoundingBox (const std::vector< Coord > &points)
 

Static Public Attributes

static const Box NIL = Box(Coord::NIL, Coord::NIL)
 

Protected Attributes

Coord min
 
Coord max
 

Constructor & Destructor Documentation

◆ Box()

inet::Box::Box ( const Coord min,
const Coord max 
)
14  :
15  min(min),
16  max(max)
17 {
18 }

Referenced by computeBoundingBox().

Member Function Documentation

◆ computeBoundingBox()

Box inet::Box::computeBoundingBox ( const std::vector< Coord > &  points)
static
21 {
22  Coord min = Coord::NIL;
23  Coord max = Coord::NIL;
24  if (points.begin() != points.end()) {
25  min = *points.begin();
26  max = min;
27  }
28  for (const auto& point : points) {
29  min = min.min(point);
30  max = max.max(point);
31  }
32  return Box(min, max);
33 }

Referenced by inet::physicalenvironment::PhysicalEnvironment::convertPoints(), and inet::physicalenvironment::PhysicalEnvironment::parseObjects().

◆ getCenter()

Coord inet::Box::getCenter ( ) const
inline

◆ getMax()

const Coord& inet::Box::getMax ( ) const
inline

◆ getMin()

const Coord& inet::Box::getMin ( ) const
inline

◆ getSize()

Coord inet::Box::getSize ( ) const
inline

◆ isNil()

virtual bool inet::Box::isNil ( ) const
inlineoverridevirtual

Returns true if this geometric object is the same as the unspecified singleton instance of this type.

Implements inet::GeometricObjectBase.

36 { return this == &NIL; }

◆ isUnspecified()

virtual bool inet::Box::isUnspecified ( ) const
inlineoverridevirtual

Returns true if this geometric object is not completely specified.

Implements inet::GeometricObjectBase.

37 { return min.isUnspecified() || max.isUnspecified(); }

Member Data Documentation

◆ max

Coord inet::Box::max
protected

Referenced by computeBoundingBox().

◆ min

Coord inet::Box::min
protected

Referenced by computeBoundingBox().

◆ NIL

const Box inet::Box::NIL = Box(Coord::NIL, Coord::NIL)
static

The documentation for this class was generated from the following files:
inet::Coord::min
Coord min(const Coord &a) const
Returns the minimal coordinates.
Definition: Coord.h:310
inet::Coord::isUnspecified
bool isUnspecified() const
Returns true if this coordinate is unspecified.
Definition: Coord.h:303
inet::Coord::max
Coord max(const Coord &a) const
Returns the maximal coordinates.
Definition: Coord.h:317
inet::Box::NIL
static const Box NIL
Definition: Box.h:19
inet::Box::Box
Box(const Coord &min, const Coord &max)
Definition: Box.cc:14
inet::Coord::NIL
static const Coord NIL
Constant with all values set to 0.
Definition: Coord.h:26
inet::Box::min
Coord min
Definition: Box.h:22
inet::Box::max
Coord max
Definition: Box.h:23