14#include <lagrange/ui/api.h>
15#include <lagrange/ui/utils/math.h>
24class LA_UI_API
AABB :
public Eigen::AlignedBox3f
27 using Super = Eigen::AlignedBox3f;
31 AABB(Eigen::AlignedBox3f box)
32 : Super(std::move(box))
36 template <
typename Derived>
39 const auto d = diagonal();
40 return Eigen::Vector3f(
41 (
float(pt.x()) - min().x()) / d.x(),
42 (
float(pt.y()) - min().y()) / d.y(),
43 (
float(pt.z()) - min().z()) / d.z());
47 template <
typename Scalar>
50 const auto d = diagonal();
51 return Eigen::Vector3f(
52 (
float(pt.x()) - min().x()) / d.x(),
53 (
float(pt.y()) - min().y()) / d.y(),
57 Eigen::Affine3f get_cube_transform()
const;
59 Eigen::Affine3f get_normalization_transform(
bool preserve_aspect =
true)
const;
61 AABB transformed(
const Eigen::Affine3f& transform)
const;
64 Eigen::Vector3f origin,
66 float* tmin_out =
nullptr,
67 float* tmax_out =
nullptr)
const;
69 bool intersects_frustum(
const Frustum& f)
const;
Eigen::Vector3f normalize_point(const Eigen::MatrixBase< Derived > &pt) const
Normalizes point to [0.0f,1.0f]^3 in AABB's bounds.
Definition: AABB.h:37
Eigen::Vector3f normalize_point(const Eigen::Matrix< Scalar, 2, 1 > &pt) const
Overload for 2D mesh.
Definition: AABB.h:48
Frustum defined using 6 planes.
Definition: Frustum.h:43
Lagrange UI Viewer and mini 3D engine.
Definition: AcceleratedPicking.h:22
Main namespace for Lagrange.
Definition: AABBIGL.h:30