MeVisLab Toolbox Reference
CSOBoundingBox.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
15
16#pragma once
17
18
19#include "MLCSOIncludes.h"
20
21
22ML_START_NAMESPACE
23
24class CSO;
25
27
28
31{
32
33public:
34
40 CSOBoundingBox(const Vector3& bbv1, const Vector3& bbv2);
43
46
49
51 bool isEmpty() const;
52
54 void makeEmpty();
55
57 void correct();
58
60 bool intersects(const CSOBoundingBox& bBox) const;
61
63 bool intersects(const Vector3& argv1, const Vector3& argv2) const;
64
66 bool intersects(const Vector3& center, double radius) const;
67
70 void set(const Vector3& argv1, const Vector3& argv2);
71
74
77
79 bool containsPoint(double x, double y, double z) const;
80
82 bool enclosesSlabWithZPosition(double z) const;
83
85 bool containsBoundingBox(const CSOBoundingBox& innerBoundingBox, const double epsilon=0.0) const;
86
88 void augment(float value);
89
91 CSOBoundingBox getShifted(double dx, double dy, double dz) const;
92
94 void makeCubic();
95
97 double getSize() const;
98
101
103 inline void print() { CSO_PRINT(v1[0] << ", " << v1[1] << ", " << v1[2]);
104 CSO_PRINT(v2[0] << ", " << v2[1] << ", " << v2[2]); CSO_PRINT("");}
105
110
111private:
112
114 void _computeBB(CSO* cso);
115};
116
118
119ML_END_NAMESPACE
#define CSO_PRINT(msg)
Output macro for testing.
#define MLCSO_EXPORT
Defines export symbols for classes, so they can be used in other DLLs.
Definition MLCSOSystem.h:23
The CSOBoundingBox defines an axis-parallel bounding box with double precision.
CSOBoundingBox(const Vector3 &bbv1, const Vector3 &bbv2)
Constructor.
~CSOBoundingBox()
Destructor.
void correct()
Corrects all coordinates, so that the min values are indeed smaller than the max values.
bool enclosesSlabWithZPosition(double z) const
Returns whether the specified z-value is in the same slice/slab as this bounding box encloses.
Vector3 getCenterPoint() const
Returns the center point of the bounding box.
bool containsPoint(double x, double y, double z) const
Returns whether this bounding box contains the specified point.
void set(const Vector3 &argv1, const Vector3 &argv2)
Sets starting and ending vector for this bounding box.
bool intersects(const Vector3 &argv1, const Vector3 &argv2) const
Returns whether this bounding box intersects with a bounding box specified by its two vectors.
Vector3 v1
The x/y/z min values.
void print()
Prints the v1/v2 coordinates to the console. For debugging convenience.
void makeCubic()
Modifies the bounding box so it becomes cubic with all sides as long as the former longest.
Vector3 v2
the x/y/z max values.
bool intersects(const Vector3 &center, double radius) const
Returns whether this bounding box intersects a specified sphere.
double getSize() const
Returns the volume or the area of the bounding box, or 0 if empty.
CSOBoundingBox unify(const CSOBoundingBox &bBox) const
Returns the union bounding box of this BB and the specified one.
CSOBoundingBox(const CSOBoundingBox &bBox)
Copy constructor.
CSOBoundingBox getShifted(double dx, double dy, double dz) const
Returns a bounding box shifted by the specified values.
bool containsBoundingBox(const CSOBoundingBox &innerBoundingBox, const double epsilon=0.0) const
Returns whether this bounding box encloses the specified bounding box fully.
void makeEmpty()
Empties this bounding box (set all values to +/- ML_FLOAT_MAX).
bool intersects(const CSOBoundingBox &bBox) const
Returns whether this bounding box intersects with the specified bounding box.
CSOBoundingBox(CSO *cso)
Constructor.
CSOBoundingBox & operator=(const CSOBoundingBox &)=default
Default assignment operator.
CSOBoundingBox()
Constructor.
bool isEmpty() const
Returns whether this bounding box is empty.
void augment(float value)
Augments this bounding box by the specified value in all directions.
CSOBoundingBox intersect(const CSOBoundingBox &bBox) const
Returns the intersection bounding box of this BB and the specified one.
The CSO represents a contour segmentation object.
Definition CSO.h:44