19 #ifndef HEADER_NODE_BOUNDING_BOX_3D_HPP 20 #define HEADER_NODE_BOUNDING_BOX_3D_HPP 22 #include "utils/vec3.hpp" 41 float box_high = 5.0f;
43 box_corners[0] = p0 + box_high * normal;
44 box_corners[1] = p1 + box_high * normal;
45 box_corners[2] = p2 + box_high * normal;
46 box_corners[3] = p3 + box_high * normal;
47 box_corners[4] = p0 - box_low * normal;
48 box_corners[5] = p1 - box_low * normal;
49 box_corners[6] = p2 - box_low * normal;
50 box_corners[7] = p3 - box_low * normal;
52 Vec3 box_faces[6][4] =
54 { box_corners[0], box_corners[1], box_corners[2], box_corners[3] },
55 { box_corners[3], box_corners[2], box_corners[6], box_corners[7] },
56 { box_corners[7], box_corners[6], box_corners[5], box_corners[4] },
57 { box_corners[1], box_corners[0], box_corners[4], box_corners[5] },
58 { box_corners[4], box_corners[0], box_corners[3], box_corners[7] },
59 { box_corners[1], box_corners[5], box_corners[6], box_corners[2] }
62 for (
unsigned int i = 0; i < 6 ; i++)
64 for (
unsigned int j = 0; j < 4; j++)
65 m_box_faces[i][j] = box_faces[i][j];
69 bool pointInside(
const Vec3& p,
bool ignore_vertical =
false)
const 71 float side = p.sideofPlane(m_box_faces[0][0], m_box_faces[0][1],
73 for (
int i = 1; i < 6; i++)
75 if (side * p.sideofPlane(m_box_faces[i][0], m_box_faces[i][1],
76 m_box_faces[i][2]) < 0)
Definition: bounding_box_3d.hpp:27
A wrapper around bullets btVector3 to include conventient conversion functions (e.g.
Definition: vec3.hpp:34
Vec3 m_box_faces[6][4]
A 3D box using to check if a point lies inside a quad.
Definition: bounding_box_3d.hpp:32