3#include "Math/LinePlaneIntersection.h"
4#include "Math/RayTriangleIntersection.h"
6#include "Foundation/Geometry/Frustum.hpp"
14 inline bool intersect(
const Cogs::Geometry::BoundingBox & box,
const glm::vec3 & origin,
const glm::vec3 & direction, glm::vec3 & intersection,
17 glm::vec3 bounds[2] = {
22 glm::vec3 pointOnRay, ptonbox;
23 double sqrmindist = DBL_MAX;
25 for (
int j = 0; j < 2; j++) {
26 for (
int i = 0; i < 3; i++) {
27 glm::vec3 norm(0, 0, 0);
35 plane.distance = bounds[j][i];
37 if (intersect(plane.normal, plane.distance, origin, direction, hitPoint)) {
43 double d = distanceToQuad(
44 bounds[0][i1], bounds[0][i2],
45 bounds[1][i1], bounds[1][i2],
46 hitPoint[i1], hitPoint[i2],
51 intersection = hitPoint;
54 }
else if (d < sqrmindist) {
56 pointOnRay = ptonbox = hitPoint;
58 ptonbox[i1] =
static_cast<float>(x);
59 ptonbox[i2] =
static_cast<float>(y);
@ Geometry
Store entity vector fields (vector<vec3>, vector<vec2>, vector<int>, vector<float>).
Contains all Cogs related functionality.