| 206 | } |
| 207 | |
| 208 | std::array<glm::dvec3, 4> computeEdgeNormals( |
| 209 | const Plane& plane, |
| 210 | const std::array<glm::dvec3, 4>& vertices, |
| 211 | bool invert) { |
| 212 | std::array<glm::dvec3, 4> result = { |
| 213 | glm::normalize(glm::cross(plane.getNormal(), vertices[1] - vertices[0])), |
| 214 | glm::normalize(glm::cross(plane.getNormal(), vertices[2] - vertices[1])), |
| 215 | glm::normalize(glm::cross(plane.getNormal(), vertices[3] - vertices[2])), |
| 216 | glm::normalize(glm::cross(plane.getNormal(), vertices[0] - vertices[3]))}; |
| 217 | |
| 218 | if (invert) { |
| 219 | result[0] = -result[0]; |
| 220 | result[1] = -result[1]; |
| 221 | result[2] = -result[2]; |
| 222 | result[3] = -result[3]; |
| 223 | } |
| 224 | |
| 225 | return result; |
| 226 | } |
| 227 | |
| 228 | /** |
| 229 | * Finds point on a line segment closest to a given point. |
no test coverage detected