34 glm::vec2
toUV(
const glm::vec3 pos);
glm::vec3 getClosestPoint(const glm::vec3 pointPos, Triangle triangle)
Find the closest point between a point and a triangle.
Definition: triangle.cpp:55
std::optional< float > rayTriangleIntersection(const glm::vec3 &origin, const glm::vec3 &rayDirection, Triangle triangle)
Find the intersection time t where a ray and triangle intersects. Does not detect intersections to th...
Definition: triangle.cpp:37
Represents a 3D triangle, equipped with some utility functions.
Definition: triangle.h:13
glm::vec2 toUV(const glm::vec3 pos)
Convert a point from cartesian to UV coordinate.
Definition: triangle.cpp:25
glm::vec3 a
Definition: triangle.h:14
glm::vec3 getNormal()
Get the normal of this triangle.
Definition: triangle.cpp:30
std::optional< glm::vec3 > normal_cached
Definition: triangle.h:16
glm::vec3 b
Definition: triangle.h:14
glm::vec3 c
Definition: triangle.h:14
glm::vec3 toBarycentric(const glm::vec3 pos)
Convert a point from cartesian to barycentric coordinate with respect to the current triangle.
Definition: triangle.cpp:7