1 #ifndef BLANK_GEOMETRY_PRIMITIVE_HPP_
2 #define BLANK_GEOMETRY_PRIMITIVE_HPP_
14 void Adjust() noexcept {
15 if (max.x < min.x) std::swap(max.x, min.x);
16 if (max.y < min.y) std::swap(max.y, min.y);
17 if (max.z < min.z) std::swap(max.z, min.z);
20 glm::vec3 Center() const noexcept {
21 return min + (max - min) * 0.5f;
24 /// return distance between origin and farthest vertex
25 float OriginRadius() const noexcept {
26 glm::vec3 high(glm::max(abs(min), abs(max)));
40 float *dist = nullptr,
41 glm::vec3 *normal = nullptr) noexcept;
43 /// matrices may translate and rotate, but must not scale/shear/etc
44 /// (basically the first three columns must have unit length)
51 glm::vec3 &normal) noexcept;
53 bool CullTest(const AABB &box, const glm::mat4 &MVP) noexcept;