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

inet::Box::Box ( const Coord min,
const Coord max 
)

Referenced by computeBoundingBox().

24  :
25  min(min),
26  max(max)
27 {
28 }
Coord min
Definition: Box.h:32
Coord max
Definition: Box.h:33

Member Function Documentation

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

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

31 {
32  Coord min = Coord::NIL;
33  Coord max = Coord::NIL;
34  if (points.begin() != points.end())
35  {
36  min = *points.begin();
37  max = min;
38  }
39  for (const auto & point : points)
40  {
41  min = min.min(point);
42  max = max.max(point);
43  }
44  return Box(min, max);
45 }
static const Coord NIL
Constant with all values set to 0.
Definition: Coord.h:40
Coord min
Definition: Box.h:32
Coord max(const Coord &a)
Returns the maximal coordinates.
Definition: Coord.h:275
Box(const Coord &min, const Coord &max)
Definition: Box.cc:24
Coord max
Definition: Box.h:33
Coord min(const Coord &a)
Returns the minimal coordinates.
Definition: Coord.h:265
Coord inet::Box::getCenter ( ) const
inline

Referenced by inet::physicalenvironment::PhysicalEnvironment::convertPoints().

44 { return (min + max) / 2; }
Coord min
Definition: Box.h:32
Coord max
Definition: Box.h:33
const Coord& inet::Box::getMax ( ) const
inline
41 { return max; }
Coord max
Definition: Box.h:33
const Coord& inet::Box::getMin ( ) const
inline
40 { return min; }
Coord min
Definition: Box.h:32
Coord inet::Box::getSize ( ) const
inline

Referenced by inet::physicalenvironment::PhysicalEnvironment::parseObjects().

43 { return max - min; }
Coord min
Definition: Box.h:32
Coord max
Definition: Box.h:33
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.

46 { return this == &NIL; }
static const Box NIL
Definition: Box.h:29
virtual bool inet::Box::isUnspecified ( ) const
inlineoverridevirtual

Returns true if this geometric object is not completely specified.

Implements inet::GeometricObjectBase.

47 { return min.isUnspecified() || max.isUnspecified(); }
bool isUnspecified() const
Returns true if this coordinate is unspecified.
Definition: Coord.h:257
Coord min
Definition: Box.h:32
Coord max
Definition: Box.h:33

Member Data Documentation

Coord inet::Box::max
protected

Referenced by computeBoundingBox().

Coord inet::Box::min
protected

Referenced by computeBoundingBox().

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

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