MeVisLab Toolbox Reference
WEMBoundingBox.h
Go to the documentation of this file.
1/*************************************************************************************
2**
3** Copyright 2007, MeVis Medical Solutions AG
4**
5** The user may use this file in accordance with the license agreement provided with
6** the Software or, alternatively, in accordance with the terms contained in a
7** written agreement between the user and MeVis Medical Solutions AG.
8**
9** For further information use the contact form at https://www.mevislab.de/contact
10**
11**************************************************************************************/
12
13#pragma once
14
15#include "MLWEMIncludes.h"
16
18
20
23{
24public:
26 bool contains(const Vector3& position) const;
28 Vector3 getMin() const { return _min; }
30 Vector3 getMax() const{ return _max; }
32 Vector3 getCenter() const { return (_min + _max) * 0.5; }
34 double getRadius() const { return (_max - getCenter()).length(); }
36 bool isCentered() const { return (getCenter() == NULL_VEC); }
38 bool isScalable() const { return (getRadius() > WEM_EPSILON); }
40 void reset();
42 void setExtents(const Vector3& min, const Vector3& max);
44 bool isValid() const;
47
48private:
50 Vector3 _min = Vector3(std::numeric_limits<double>::max(), std::numeric_limits<double>::max(),
51 std::numeric_limits<double>::max());
53 Vector3 _max = Vector3(std::numeric_limits<double>::min(), std::numeric_limits<double>::min(),
54 std::numeric_limits<double>::min());
55};
56
59
60
62
const double WEM_EPSILON
Epsilon value used in Vector3 comparisons.
#define NULL_VEC
#define MLWEM_EXPORT
Definition MLWEMSystem.h:18
This class represents an axis aligned bounding box for a WEMPatch.
Vector3 getMin() const
Returns minimum bounding box extent.
Vector3 getMax() const
Returns maximum bounding box extent.
void reset()
Resets object to the default constructed state.
bool contains(const Vector3 &position) const
Returns whether the bounding box contains the given position.
double getRadius() const
Returns radius.
Vector3 getCenter() const
Returns center of bounding box.
bool isValid() const
Returns whether this is valid.
bool isScalable() const
Returns whether the bounding box is scalable.
WEMBoundingBox & operator&=(const WEMBoundingBox &other)
Returns the union bounding box of this and other.
void setExtents(const Vector3 &min, const Vector3 &max)
Sets extents minimum and maximum and updates center and radius.
bool isCentered() const
Returns whether the bounding box is centered.
Target mlrange_cast(Source arg)
Generic version of checked ML casts.
WEMBoundingBox MLWEM_EXPORT operator&(WEMBoundingBox x, const WEMBoundingBox &y)
Returns the union bounding box of x and y.