cesium-native
0.41.0
|
Functions for computing the intersection between geometries such as rays, planes, triangles, and ellipsoids. More...
#include <CesiumGeometry/IntersectionTests.h>
Static Public Member Functions | |
static std::optional< glm::dvec3 > | rayPlane (const Ray &ray, const Plane &plane) noexcept |
Computes the intersection of a ray and a plane. More... | |
static std::optional< glm::dvec2 > | rayEllipsoid (const Ray &ray, const glm::dvec3 &radii) noexcept |
Computes the intersection of a ray and an ellipsoid with the given radii, centered at the origin. More... | |
static bool | pointInTriangle (const glm::dvec2 &point, const glm::dvec2 &triangleVertA, const glm::dvec2 &triangleVertB, const glm::dvec2 &triangleVertC) noexcept |
Determines whether a given point is completely inside a triangle defined by three 2D points. More... | |
static bool | pointInTriangle (const glm::dvec3 &point, const glm::dvec3 &triangleVertA, const glm::dvec3 &triangleVertB, const glm::dvec3 &triangleVertC) noexcept |
Determines whether a given point is completely inside a triangle defined by three 3D points. More... | |
static bool | pointInTriangle (const glm::dvec3 &point, const glm::dvec3 &triangleVertA, const glm::dvec3 &triangleVertB, const glm::dvec3 &triangleVertC, glm::dvec3 &barycentricCoordinates) noexcept |
Determines whether the point is completely inside a triangle defined by three 3D points. If the point is inside, this also outputs the barycentric coordinates for the point. More... | |
static std::optional< glm::dvec3 > | rayTriangle (const Ray &ray, const glm::dvec3 &p0, const glm::dvec3 &p1, const glm::dvec3 &p2, bool cullBackFaces=false) |
Tests if a ray hits a triangle and returns the hit point. More... | |
static std::optional< double > | rayTriangleParametric (const Ray &ray, const glm::dvec3 &p0, const glm::dvec3 &p1, const glm::dvec3 &p2, bool cullBackFaces=false) |
Tests if an infinite ray hits a triangle and returns the parametric hit position. More... | |
static std::optional< glm::dvec3 > | rayAABB (const Ray &ray, const AxisAlignedBox &aabb) |
Computes the intersection of a ray and an axis aligned bounding box. More... | |
static std::optional< double > | rayAABBParametric (const Ray &ray, const AxisAlignedBox &aabb) |
Computes the intersection of an infinite ray and an axis aligned bounding box and returns the parametric hit position. More... | |
static std::optional< glm::dvec3 > | rayOBB (const Ray &ray, const OrientedBoundingBox &obb) |
Computes the intersection of a ray and an oriented bounding box. More... | |
static std::optional< double > | rayOBBParametric (const Ray &ray, const OrientedBoundingBox &obb) |
Computes the intersection of an infinite ray and an oriented bounding box and returns the parametric hit position. More... | |
static std::optional< glm::dvec3 > | raySphere (const Ray &ray, const BoundingSphere &sphere) |
Computes the intersection of a ray and a bounding sphere. More... | |
static std::optional< double > | raySphereParametric (const Ray &ray, const BoundingSphere &sphere) |
Computes the intersection of an infinite ray and a bounding sphere and returns the parametric hit position. More... | |
Functions for computing the intersection between geometries such as rays, planes, triangles, and ellipsoids.
Definition at line 21 of file IntersectionTests.h.
|
staticnoexcept |
Determines whether a given point is completely inside a triangle defined by three 2D points.
This function does not check for degeneracy of the triangle.
point | The point to check. |
triangleVertA | The first vertex of the triangle. |
triangleVertB | The second vertex of the triangle. |
triangleVertC | The third vertex of the triangle. |
|
staticnoexcept |
Determines whether a given point is completely inside a triangle defined by three 3D points.
Returns false for degenerate triangles.
point | The point to check. |
triangleVertA | The first vertex of the triangle. |
triangleVertB | The second vertex of the triangle. |
triangleVertC | The third vertex of the triangle. |
|
staticnoexcept |
Determines whether the point is completely inside a triangle defined by three 3D points. If the point is inside, this also outputs the barycentric coordinates for the point.
Returns false for degenerate triangles.
point | The point to check. |
triangleVertA | The first vertex of the triangle. |
triangleVertB | The second vertex of the triangle. |
triangleVertC | The third vertex of the triangle. |
|
static |
Computes the intersection of a ray and an axis aligned bounding box.
ray | The ray. |
aabb | The axis aligned bounding box. |
std::nullopt
if there is no intersection.
|
static |
Computes the intersection of an infinite ray and an axis aligned bounding box and returns the parametric hit position.
The return value is positive if the intersection point is in front of the ray origin, negative if it is behind it, or zero if the two points coincide.
ray | The ray. |
aabb | The axis aligned bounding box. |
|
staticnoexcept |
Computes the intersection of a ray and an ellipsoid with the given radii, centered at the origin.
Returns false if any of the radii are 0.
ray | The ray. |
radii | The radii of ellipsoid. |
std::nullopt
if there are no intersections. X is the entry, and y is the exit.
|
static |
Computes the intersection of a ray and an oriented bounding box.
ray | The ray. |
obb | The oriented bounding box. |
std::nullopt
if there is no intersection.
|
static |
Computes the intersection of an infinite ray and an oriented bounding box and returns the parametric hit position.
The return parameter is positive if the intersection point is in front of the ray origin, negative if it is behind it, or zero if the two points coincide.
ray | The ray. |
obb | The oriented bounding box. |
|
staticnoexcept |
Computes the intersection of a ray and a plane.
ray | The ray. |
plane | The plane. |
std::nullopt
if there is no intersection.
|
static |
Computes the intersection of a ray and a bounding sphere.
ray | The ray. |
sphere | The bounding sphere. |
std::nullopt
if there is no intersection.
|
static |
Computes the intersection of an infinite ray and a bounding sphere and returns the parametric hit position.
The return parameter is positive if the intersection point is in front of the ray origin, negative if it is behind it, or zero if the two points coincide.
ray | The ray. |
sphere | The bounding sphere. |
|
static |
Tests if a ray hits a triangle and returns the hit point.
ray | The ray. |
p0 | The first vertex of the triangle. |
p1 | The second vertex of the triangle. |
p2 | The third vertex of the triangle. |
cullBackFaces | Ignore triangles that face away from ray. Front faces use CCW winding order. |
std::nullopt
if there is no intersection.
|
static |
Tests if an infinite ray hits a triangle and returns the parametric hit position.
The return parameter is positive if the intersection point is in front of the ray origin, negative if it is behind it, or zero if the two points coincide.
ray | The ray. |
p0 | The first vertex of the triangle. |
p1 | The second vertex of the triangle. |
p2 | The third vertex of the triangle. |
cullBackFaces | Ignore triangles that face away from ray. Front faces use CCW winding order. |