Celeritas
0.5.0-86+4a8eea4
|
#include "BoundingBoxUtils.hh"
#include <iostream>
#include "corecel/Assert.hh"
#include "corecel/cont/ArrayIO.hh"
#include "corecel/math/ArrayOperators.hh"
#include "corecel/math/NumericLimits.hh"
#include "transform/Transformation.hh"
#include "transform/Translation.hh"
Functions | |
BBox | celeritas::calc_transform (Translation const &tr, BBox const &a) |
Calculate the bounding box of a translated box. | |
BBox | celeritas::calc_transform (Transformation const &tr, BBox const &a) |
Calculate the axis-aligned bounding box of a transformed box. More... | |
template<class T > | |
std::ostream & | celeritas::operator<< (std::ostream &os, BoundingBox< T > const &bbox) |
Write a bounding box to a stream. | |
template std::ostream & | celeritas::operator<< (std::ostream &, BoundingBox< float > const &) |
template std::ostream & | celeritas::operator<< (std::ostream &, BoundingBox< double > const &) |
BBox celeritas::calc_transform | ( | Transformation const & | tr, |
BBox const & | a | ||
) |
Calculate the axis-aligned bounding box of a transformed box.
Transforming a box usually results in an oriented bounding box, but sometimes that OBB is also an AABB. This function implicitly creates the transformed bounding box and creates an AABB that encompasses that box.
The result returns an exactly transformed bounding box for axis-aligned rotations. To achieve exactness for semi-infinite bounding boxes, this method has a custom implementation of GEMV for applying exact rotations if the matrix representation simply switches vector entries or flips their sign. Without the complication, floating point arithmetic results in NaN from multiplying zeroes (in the matrix) by the infinite values.