18 PRECICE_ASSERT((boundMin.rows() == 2 && boundMax.rows() == 2) || (boundMin.rows() == 3 && boundMax.rows() == 3),
19 "Dimension of min {} and max {} vertices should be the same and both 2 or 3.", boundMin.rows(), boundMax.rows());
20 PRECICE_ASSERT((boundMin - boundMax).maxCoeff() <= 0,
"Each component of min vertex {} must be <= max vertex {} in the same axis direction.", boundMin, boundMax);
29 PRECICE_ASSERT((
int) bounds.
size() == 4 || (
int) bounds.
size() == 6,
"Dimension of a bounding box can only be 2 or 3. The dimension is {}.", bounds.
size() / 2);
41 : _dimensions(dimension)
43 PRECICE_ASSERT(dimension == 2 || dimension == 3,
"Dimension of a bounding box can only be 2 or 3 (in this case, it is {}).", dimension);
116 double meshArea = 1.0;
132 bounds.
insert(bounds.end(), {_boundMin[2], _boundMax[2]});
149 const auto coords = vertices.
getCoords();
166 _boundMax.array() += safetyFactor * maxSideLength;
167 _boundMin.array() -= safetyFactor * maxSideLength;
#define PRECICE_DEBUG(...)
#define PRECICE_ASSERT(...)
An axis-aligned bounding box around a (partition of a) mesh.
bool contains(const Vertex &vertex) const
Checks if vertex in contained in _bb.
Eigen::VectorXd maxCorner() const
the max corner of the bounding box
void print(std::ostream &out) const
Print bounds of bounding box, output operator overload.
Eigen::VectorXd minCorner() const
the min corner of the bounding box
bool empty() const
Check if every dimension's length is equal to zero.
double longestEdgeLength() const
returns the maximum length of the bounding box in any dimension
Eigen::VectorXd _boundMax
static logging::Logger _log
double getArea(std::vector< bool > deadAxis)
Calculate the area of bounding box.
void expandBy(const BoundingBox &otherBB)
Expand bounding box using another bounding box.
BoundingBox(int dimension)
const std::vector< double > dataVector() const
Return data as std::vector.
bool overlapping(const BoundingBox &otherBB) const
Checks whether two bounding boxes are overlapping.
Eigen::VectorXd _boundMin
bool operator==(const BoundingBox &otherBB) const
Comparison Operator.
int getDimension() const
Getter dimension of the bounding box.
int _dimensions
Number of dimensions (2 or 3)
void scaleBy(double safetyFactor)
Increase the size of bounding box by safety margin.
Eigen::VectorXd center() const
Returns the Center Of Gravity of the mesh.
double getEdgeLength(int axis) const
returns the edge length of a specific axis
const RawCoords & rawCoords() const
Direct access to the coordinates.
int getDimensions() const
Returns spatial dimensionality of vertex.
Eigen::VectorXd getCoords() const
Returns the coordinates of the vertex.
provides Mesh, Data and primitives.
std::ostream & operator<<(std::ostream &os, const BoundingBox &bb)