26 #ifndef WFMATH_ROT_BOX_FUNCS_H
27 #define WFMATH_ROT_BOX_FUNCS_H
29 #include <wfmath/rotbox.h>
31 #include <wfmath/vector.h>
32 #include <wfmath/point.h>
33 #include <wfmath/axisbox.h>
34 #include <wfmath/ball.h>
41 inline Point<dim> RotBox<dim>::getCorner(
size_t i)
const
43 assert(i >= 0 && i < (1 << dim));
50 for(
int j = 0; j < dim; ++j)
51 dist[j] = (i & (1 << j)) ? m_size[j] : 0;
53 dist.setValid(m_size.isValid());
55 return m_corner0 +
Prod(dist, m_orient);
59 AxisBox<dim> RotBox<dim>::boundingBox()
const
61 Point<dim> min = m_corner0, max = m_corner0;
81 for(
int i = 0; i < dim; ++i) {
82 for(
int j = 0; j < dim; ++j) {
83 CoordType value = m_orient.elem(j, i) * m_size[j];
91 bool valid = isValid();
96 return AxisBox<dim>(min, max,
true);
103 Point<dim> Point<dim>::toParentCoords(
const RotBox<dim>& coords)
const
105 return coords.corner0() + (*
this - Point().setToOrigin()) * coords.orientation();
109 Point<dim> Point<dim>::toLocalCoords(
const RotBox<dim>& coords)
const
111 return Point().setToOrigin() + coords.orientation() * (*
this - coords.corner0());
116 #endif // WFMATH_ROT_BOX_FUNCS_H