Represents a 3D triangle, equipped with some utility functions.
More...
#include <triangle.h>
|
glm::vec3 | toBarycentric (const glm::vec3 pos) |
| Convert a point from cartesian to barycentric coordinate with respect to the current triangle.
|
|
glm::vec2 | toUV (const glm::vec3 pos) |
| Convert a point from cartesian to UV coordinate.
|
|
glm::vec3 | getNormal () |
| Get the normal of this triangle.
|
|
Represents a 3D triangle, equipped with some utility functions.
◆ getNormal()
glm::vec3 Saga::Geometry::Triangle::getNormal |
( |
| ) |
|
Get the normal of this triangle.
- Returns
- glm::vec3 the normal of this triangle in the direction of cross(b-a, c-a).
◆ toBarycentric()
glm::vec3 Saga::Geometry::Triangle::toBarycentric |
( |
const glm::vec3 |
pos | ) |
|
Convert a point from cartesian to barycentric coordinate with respect to the current triangle.
- Parameters
-
pos | the position in cartesian space. |
- Returns
- glm::vec3 the barycentric coordinate (u,v,w) such that p projected onto the plane of a,b,c is = u * a + v * b + w * c.
◆ toUV()
glm::vec2 Saga::Geometry::Triangle::toUV |
( |
const glm::vec3 |
pos | ) |
|
Convert a point from cartesian to UV coordinate.
- Parameters
-
pos | the position in cartesian space. |
- Returns
- glm::vec3 the barycentric coordinate (u,v,w) such that p = u * a + v * b + w * c.
glm::vec3 Saga::Geometry::Triangle::a |
glm::vec3 Saga::Geometry::Triangle::b |
glm::vec3 Saga::Geometry::Triangle::c |
◆ normal_cached
std::optional<glm::vec3> Saga::Geometry::Triangle::normal_cached |
The documentation for this struct was generated from the following files: