3#include <Core/RaCore.hpp>
5#include <Eigen/Geometry>
14 using Transform = Eigen::Transform<Scalar, 3, Eigen::Affine>;
15 using Aabb = Eigen::AlignedBox<Scalar, 3>;
20 inline Obb() : m_aabb(), m_transform( Transform::Identity() ) {}
23 inline Obb(
const Aabb& aabb,
const Transform& tr ) : m_aabb( aabb ), m_transform( tr ) {}
27 Obb& operator=(
const Obb& other ) =
default;
29 virtual inline ~Obb() {}
33 if ( m_aabb.isEmpty() ) {
return m_aabb; }
35 for (
int i = 0; i < 8; ++i ) {
42 inline void addPoint(
const Eigen::Matrix<Scalar, 3, 1>& p ) { m_aabb.extend( p ); }
45 inline Eigen::Matrix<Scalar, 3, 1>
corner(
int i )
const {
46 return m_aabb.corner(
static_cast<Aabb::CornerType
>( i ) );
50 inline Eigen::Matrix<Scalar, 3, 1>
worldCorner(
int i )
const {
51 return m_transform * m_aabb.corner(
static_cast<Aabb::CornerType
>( i ) );
58 const Transform&
transform()
const {
return m_transform; }
64 Transform m_transform;
An oriented bounding box.
Transform & transform()
Non-const access to the obb transformation.
Eigen::Matrix< Scalar, 3, 1 > corner(int i) const
Returns the position of the i^th corner of AABB (model space)
Obb(const Obb &other)=default
Default copy constructor and assignment operator.
const Transform & transform() const
Const access to the obb transformation.
Aabb toAabb() const
Return the AABB enclosing this.
void addPoint(const Eigen::Matrix< Scalar, 3, 1 > &p)
Extends the OBB with an new point.
Obb(const Aabb &aabb, const Transform &tr)
Initialize an OBB from an AABB and a transform.
Obb()
Constructors and destructor.
Eigen::Matrix< Scalar, 3, 1 > worldCorner(int i) const
Returns the position of the ith corner of the OBB ( world space )
@ Geometry
"Geometry" render objects are those loaded using Radium::IO and generated by GeometrySystem
hepler function to manage enum as underlying types in VariableSet