#include <IntersectSegment.h>
Public Member Functions | |
| SegmentTriangleHitTester (const AZ::Vector3 &p, const AZ::Vector3 &q) | |
| bool | IntersectSegmentTriangleCCW (const AZ::Vector3 &a, const AZ::Vector3 &b, const AZ::Vector3 &c, AZ::Vector3 &normal, float &t) const |
| bool | IntersectSegmentTriangle (const AZ::Vector3 &a, const AZ::Vector3 &b, const AZ::Vector3 &c, AZ::Vector3 &normal, float &t) const |
| AZ::Vector3 | GetIntersectionPoint (float t) const |
SegmentTriangleHitTester is an optimized form of "watertight" segment/triangle collisions that is designed to compare a single segment against multiple triangles. Construction of the class pre-computes information about the segment itself so that each triangle intersection API call can perform less setup work. Usage: SegmentTriangleHitTester hitTester(rayStart, rayEnd); for (auto& tri : triangles) if (hitTester.IntersectSegmentTriangle(tri.a, tri.b, tri.c, outNormal, outT)) hitPoint = rayStart + (rayEnd - rayStart) * outT;
| AZ::Intersect::SegmentTriangleHitTester::SegmentTriangleHitTester | ( | const AZ::Vector3 & | p, |
| const AZ::Vector3 & | q | ||
| ) |
Construct a hit tester for segment pq that can be used to compare against multiple triangles.
| p | Segment start point. |
| q | Segment end point. |
|
inline |
Gets the segment intersection point for a given Time of intersection 't'.
| t | Time of intersection along the segment [0.0 (p), 1.0 (q)]. |
|
inline |
Same as IntersectSegmentTriangleCCW without respecting the triangle (a,b,c) vertex order (i.e. double sided).
| a | Triangle vertex 1. |
| b | Triangle vertex 2. |
| c | Triangle vertex 3. |
| normal | Triangle normal at the intersection point if segment intersects triangle. |
| t | Time of intersection along the segment [0.0 (p), 1.0 (q)] if segment intersects triangle. |
|
inline |
For the given segment pq and a triangle abc (CCW), returns whether the segment intersects the triangle and if so, also returns the time of intersection along the segment and the triangle normal.
| a | Triangle vertex 1. |
| b | Triangle vertex 2. |
| c | Triangle vertex 3. |
| normal | Triangle normal at the intersection point if segment intersects triangle. |
| t | Time of intersection along the segment [0.0 (p), 1.0 (q)] if segment intersects triangle. |