|
Open 3D Engine AzCore API Reference
2205.0
O3DE is an open-source, fully-featured, high-fidelity, modular 3D engine for building games and simulations, available to every industry.
|
Enumerations | |
| enum | RayAABBIsectTypes : AZ::s32 { ISECT_RAY_AABB_NONE = 0, ISECT_RAY_AABB_SA_INSIDE, ISECT_RAY_AABB_ISECT } |
| Ray aabb intersection result types. More... | |
| enum | SphereIsectTypes : AZ::s32 { ISECT_RAY_SPHERE_SA_INSIDE = -1, ISECT_RAY_SPHERE_NONE, ISECT_RAY_SPHERE_ISECT } |
| Ray sphere intersection result types. More... | |
| enum | CylinderIsectTypes : AZ::s32 { RR_ISECT_RAY_CYL_SA_INSIDE = -1, RR_ISECT_RAY_CYL_NONE, RR_ISECT_RAY_CYL_PQ, RR_ISECT_RAY_CYL_P_SIDE, RR_ISECT_RAY_CYL_Q_SIDE } |
| Ray cylinder intersection types. More... | |
| enum | CapsuleIsectTypes { ISECT_RAY_CAPSULE_SA_INSIDE = -1, ISECT_RAY_CAPSULE_NONE, ISECT_RAY_CAPSULE_PQ, ISECT_RAY_CAPSULE_P_SIDE, ISECT_RAY_CAPSULE_Q_SIDE } |
| Capsule ray intersect types. More... | |
Functions | |
| AZ_MATH_INLINE Vector3 | Barycentric (const Vector3 &a, const Vector3 &b, const Vector3 &c, const Vector3 &p) |
| AZ_MATH_INLINE int | TestPointTriangle (const Vector3 &p, const Vector3 &a, const Vector3 &b, const Vector3 &c) |
| Test if point p lies inside the triangle (a,b,c). | |
| AZ_MATH_INLINE int | TestPointTriangleCCW (const Vector3 &p, const Vector3 &a, const Vector3 &b, const Vector3 &c) |
| Test if point p lies inside the counter clock wise triangle (a,b,c). | |
| AZ_MATH_INLINE float | ClosestPointPlane (const Vector3 &p, const Plane &plane, Vector3 &ptOnPlane) |
| Vector3 | ClosestPointTriangle (const Vector3 &p, const Vector3 &a, const Vector3 &b, const Vector3 &c) |
| AZ_INLINE bool | PointSphere (const Vector3 ¢erPosition, float radiusSquared, const Vector3 &testPoint) |
| This method checks if a point is inside a sphere or outside it. More... | |
| AZ_INLINE bool | PointCylinder (const AZ::Vector3 &baseCenterPoint, const AZ::Vector3 &axisVector, float axisLengthSquared, float radiusSquared, const AZ::Vector3 &testPoint) |
| This method checks if a point is inside a cylinder or outside it. More... | |
| float | LineToPointDistanceTime (const Vector3 &s1, const Vector3 &s21, const Vector3 &p) |
| Vector3 | LineToPointDistance (const Vector3 &s1, const Vector3 &s2, const Vector3 &p, float &u) |
| bool | IntersectSegmentTriangleCCW (const Vector3 &p, const Vector3 &q, const Vector3 &a, const Vector3 &b, const Vector3 &c, Vector3 &normal, float &t) |
| bool | IntersectSegmentTriangle (const Vector3 &p, const Vector3 &q, const Vector3 &a, const Vector3 &b, const Vector3 &c, Vector3 &normal, float &t) |
| RayAABBIsectTypes | IntersectRayAABB (const Vector3 &rayStart, const Vector3 &dir, const Vector3 &dirRCP, const Aabb &aabb, float &tStart, float &tEnd, Vector3 &startNormal) |
| RayAABBIsectTypes | IntersectRayAABB2 (const Vector3 &rayStart, const Vector3 &dirRCP, const Aabb &aabb, float &start, float &end) |
| bool | ClipRayWithAabb (const Aabb &aabb, Vector3 &rayStart, Vector3 &rayEnd, float &tClipStart, float &tClipEnd) |
| bool | TestSegmentAABBOrigin (const Vector3 &midPoint, const Vector3 &halfVector, const Vector3 &aabbExtends) |
| bool | TestSegmentAABB (const Vector3 &p0, const Vector3 &p1, const Aabb &aabb) |
| SphereIsectTypes | IntersectRaySphereOrigin (const Vector3 &rayStart, const Vector3 &rayDirNormalized, const float sphereRadius, float &t) |
| SphereIsectTypes | IntersectRaySphere (const Vector3 &rayStart, const Vector3 &rayDirNormalized, const Vector3 &sphereCenter, const float sphereRadius, float &t) |
| bool | IntersectRayDisk (const Vector3 &rayOrigin, const Vector3 &rayDir, const Vector3 &diskCenter, const float diskRadius, const AZ::Vector3 &diskNormal, float &t) |
| int | IntersectRayCappedCylinder (const Vector3 &rayOrigin, const Vector3 &rayDir, const Vector3 &cylinderEnd1, const Vector3 &cylinderDir, float cylinderHeight, float cylinderRadius, float &t1, float &t2) |
| int | IntersectRayCone (const Vector3 &rayOrigin, const Vector3 &rayDir, const Vector3 &coneApex, const Vector3 &coneDir, float coneHeight, float coneBaseRadius, float &t1, float &t2) |
| int | IntersectRayPlane (const Vector3 &rayOrigin, const Vector3 &rayDir, const Vector3 &planePos, const Vector3 &planeNormal, float &t) |
| int | IntersectRayQuad (const Vector3 &rayOrigin, const Vector3 &rayDir, const Vector3 &vertexA, const Vector3 &vertexB, const Vector3 &vertexC, const Vector3 &vertexD, float &t) |
| bool | IntersectRayBox (const Vector3 &rayOrigin, const Vector3 &rayDir, const Vector3 &boxCenter, const Vector3 &boxAxis1, const Vector3 &boxAxis2, const Vector3 &boxAxis3, float boxHalfExtent1, float boxHalfExtent2, float boxHalfExtent3, float &t) |
| bool | IntersectRayObb (const Vector3 &rayOrigin, const Vector3 &rayDir, const Obb &obb, float &t) |
| CylinderIsectTypes | IntersectSegmentCylinder (const Vector3 &sa, const Vector3 &dir, const Vector3 &p, const Vector3 &q, const float r, float &t) |
| CapsuleIsectTypes | IntersectSegmentCapsule (const Vector3 &sa, const Vector3 &dir, const Vector3 &p, const Vector3 &q, const float r, float &t) |
| bool | IntersectSegmentPolyhedron (const Vector3 &sa, const Vector3 &dir, const Plane p[], int numPlanes, float &tfirst, float &tlast, int &iFirstPlane, int &iLastPlane) |
| void | ClosestSegmentSegment (const Vector3 &segment1Start, const Vector3 &segment1End, const Vector3 &segment2Start, const Vector3 &segment2End, float &segment1Proportion, float &segment2Proportion, Vector3 &closestPointSegment1, Vector3 &closestPointSegment2, float epsilon=1e-4f) |
| void | ClosestSegmentSegment (const Vector3 &segment1Start, const Vector3 &segment1End, const Vector3 &segment2Start, const Vector3 &segment2End, Vector3 &closestPointSegment1, Vector3 &closestPointSegment2, float epsilon=1e-4f) |
| void | ClosestPointSegment (const Vector3 &point, const Vector3 &segmentStart, const Vector3 &segmentEnd, float &proportion, Vector3 &closestPointOnSegment) |
This namespace contains, primitive intersections and overlapping tests. reference RealTimeCollisionDetection, CollisionDetection in interactive 3D environments, etc.
| enum AZ::Intersect::CylinderIsectTypes : AZ::s32 |
| enum AZ::Intersect::RayAABBIsectTypes : AZ::s32 |
| enum AZ::Intersect::SphereIsectTypes : AZ::s32 |
| AZ_MATH_INLINE Vector3 AZ::Intersect::Barycentric | ( | const Vector3 & | a, |
| const Vector3 & | b, | ||
| const Vector3 & | c, | ||
| const Vector3 & | p | ||
| ) |
Compute barycentric coordinates (u,v,w) for a point P with respect to triangle (a,b,c)
| AZ_MATH_INLINE bool AZ::Intersect::ClipRayWithAabb | ( | const Aabb & | aabb, |
| Vector3 & | rayStart, | ||
| Vector3 & | rayEnd, | ||
| float & | tClipStart, | ||
| float & | tClipEnd | ||
| ) |
Clip a ray to an aabb. return true if ray was clipped. The ray can be inside so don't use the result if the ray intersect the box.
| aabb | Bounds to test against. | |
| rayStart | The start of the ray. | |
| rayEnd | The end of the ray. | |
| [out] | tClipStart | The proportion where the ray enters the Aabb. |
| [out] | tClipEnd | The proportion where the ray exits the Aabb. |
| AZ_MATH_INLINE float AZ::Intersect::ClosestPointPlane | ( | const Vector3 & | p, |
| const Plane & | plane, | ||
| Vector3 & | ptOnPlane | ||
| ) |
Find the closest point to 'p' on a plane 'plane'.
| ptOnPlane | closest point on the plane. |
| void AZ::Intersect::ClosestPointSegment | ( | const Vector3 & | point, |
| const Vector3 & | segmentStart, | ||
| const Vector3 & | segmentEnd, | ||
| float & | proportion, | ||
| Vector3 & | closestPointOnSegment | ||
| ) |
Calculate the point (closestPointOnSegment) that is the closest point on segment segmentStart/segmentEnd to point. Also calculate the value of proportion where closestPointOnSegment = segmentStart + (proportion * (segmentEnd - segmentStart))
| point | The point to test | |
| segmentStart | The start of the segment | |
| segmentEnd | The end of the segment | |
| [out] | proportion | The proportion of the segment L(t) = (end - start) * t |
| [out] | closestPointOnSegment | The point along the line segment |
|
inline |
Find the closest point to 'p' on a triangle (a,b,c).
| void AZ::Intersect::ClosestSegmentSegment | ( | const Vector3 & | segment1Start, |
| const Vector3 & | segment1End, | ||
| const Vector3 & | segment2Start, | ||
| const Vector3 & | segment2End, | ||
| float & | segment1Proportion, | ||
| float & | segment2Proportion, | ||
| Vector3 & | closestPointSegment1, | ||
| Vector3 & | closestPointSegment2, | ||
| float | epsilon = 1e-4f |
||
| ) |
Calculate the line segment closestPointSegment1<->closestPointSegment2 that is the shortest route between two segments segment1Start<->segment1End and segment2Start<->segment2End. Also calculate the values of segment1Proportion and segment2Proportion where closestPointSegment1 = segment1Start + (segment1Proportion * (segment1End - segment1Start)) closestPointSegment2 = segment2Start + (segment2Proportion * (segment2End - segment2Start)) If segments are parallel returns a solution.
| segment1Start | Start of segment 1. | |
| segment1End | End of segment 1. | |
| segment2Start | Start of segment 2. | |
| segment2End | End of segment 2. | |
| [out] | segment1Proportion | The proporition along segment 1 [0..1] |
| [out] | segment2Proportion | The proporition along segment 2 [0..1] |
| [out] | closestPointSegment1 | Closest point on segment 1. |
| [out] | closestPointSegment2 | Closest point on segment 2. |
| epsilon | The minimum square distance where a line segment can be treated as a single point. |
| void AZ::Intersect::ClosestSegmentSegment | ( | const Vector3 & | segment1Start, |
| const Vector3 & | segment1End, | ||
| const Vector3 & | segment2Start, | ||
| const Vector3 & | segment2End, | ||
| Vector3 & | closestPointSegment1, | ||
| Vector3 & | closestPointSegment2, | ||
| float | epsilon = 1e-4f |
||
| ) |
Calculate the line segment closestPointSegment1<->closestPointSegment2 that is the shortest route between two segments segment1Start<->segment1End and segment2Start<->segment2End. If segments are parallel returns a solution.
| segment1Start | Start of segment 1. | |
| segment1End | End of segment 1. | |
| segment2Start | Start of segment 2. | |
| segment2End | End of segment 2. | |
| [out] | closestPointSegment1 | Closest point on segment 1. |
| [out] | closestPointSegment2 | Closest point on segment 2. |
| epsilon | The minimum square distance where a line segment can be treated as a single point. |
| RayAABBIsectTypes AZ::Intersect::IntersectRayAABB | ( | const Vector3 & | rayStart, |
| const Vector3 & | dir, | ||
| const Vector3 & | dirRCP, | ||
| const Aabb & | aabb, | ||
| float & | tStart, | ||
| float & | tEnd, | ||
| Vector3 & | startNormal | ||
| ) |
Intersect ray R(t) = rayStart + t*d against AABB a. When intersecting, return intersection distance tmin and point q of intersection.
| rayStart | Ray starting point |
| dir | Ray direction and length (dir = rayEnd - rayStart) |
| dirRCP | 1/dir (reciprocal direction - we cache this result very often so we don't need to compute it multiple times, otherwise just use dir.GetReciprocal()) |
| aabb | Axis aligned bounding box to intersect against |
| tStart | Time on ray of the first intersection [0,1] or 0 if the ray starts inside the aabb - check the return value |
| tEnd | Time of the of the second intersection [0,1] (it can be > 1 if intersects after the rayEnd) |
| startNormal | Normal at the start point. |
| RayAABBIsectTypes AZ::Intersect::IntersectRayAABB2 | ( | const Vector3 & | rayStart, |
| const Vector3 & | dirRCP, | ||
| const Aabb & | aabb, | ||
| float & | start, | ||
| float & | end | ||
| ) |
Intersect ray against AABB.
| rayStart | Ray starting point. |
| dir | Ray reciprocal direction. |
| aabb | Axis aligned bounding box to intersect against. |
| start | Length on ray of the first intersection. |
| end | Length of the of the second intersection. |
| bool AZ::Intersect::IntersectRayBox | ( | const Vector3 & | rayOrigin, |
| const Vector3 & | rayDir, | ||
| const Vector3 & | boxCenter, | ||
| const Vector3 & | boxAxis1, | ||
| const Vector3 & | boxAxis2, | ||
| const Vector3 & | boxAxis3, | ||
| float | boxHalfExtent1, | ||
| float | boxHalfExtent2, | ||
| float | boxHalfExtent3, | ||
| float & | t | ||
| ) |
Test intersection between a ray and an oriented box in 3D.
| rayOrigin | The origin of the ray to test intersection with. | |
| rayDir | The direction of the ray to test intersection with. | |
| boxCenter | The position of the center of the box. | |
| boxAxis1 | An axis along one dimension of the oriented box. | |
| boxAxis2 | An axis along one dimension of the oriented box. | |
| boxAxis3 | An axis along one dimension of the oriented box. | |
| boxHalfExtent1 | The half extent of the box on the dimension of boxAxis1. | |
| boxHalfExtent2 | The half extent of the box on the dimension of boxAxis2. | |
| boxHalfExtent3 | The half extent of the box on the dimension of boxAxis3. | |
| [out] | t | The coefficient in the ray's explicit equation from which the intersecting point is calculated as "rayOrigin + t * rayDirection". |
| int AZ::Intersect::IntersectRayCappedCylinder | ( | const Vector3 & | rayOrigin, |
| const Vector3 & | rayDir, | ||
| const Vector3 & | cylinderEnd1, | ||
| const Vector3 & | cylinderDir, | ||
| float | cylinderHeight, | ||
| float | cylinderRadius, | ||
| float & | t1, | ||
| float & | t2 | ||
| ) |
If there is only one intersecting point, the coefficient is stored in t1.
| rayOrigin | The origin of the ray to test. | |
| rayDir | The direction of the ray to test. It has to be unit length. | |
| cylinderEnd1 | The center of the circle on one end of the cylinder. | |
| cylinderDir | The direction pointing from cylinderEnd1 to the other end of the cylinder. It has to be unit length. | |
| cylinderHeight | The distance between two centers of the circles on two ends of the cylinder respectively. | |
| [out] | t1 | A possible coefficient in the ray's explicit equation from which an intersecting point is calculated as "rayOrigin + t1 * rayDir". |
| [out] | t2 | A possible coefficient in the ray's explicit equation from which an intersecting point is calculated as "rayOrigin + t2 * rayDir". |
| int AZ::Intersect::IntersectRayCone | ( | const Vector3 & | rayOrigin, |
| const Vector3 & | rayDir, | ||
| const Vector3 & | coneApex, | ||
| const Vector3 & | coneDir, | ||
| float | coneHeight, | ||
| float | coneBaseRadius, | ||
| float & | t1, | ||
| float & | t2 | ||
| ) |
If there is only one intersecting point, the coefficient is stored in t1.
| rayOrigin | The origin of the ray to test. | |
| rayDir | The direction of the ray to test. It has to be unit length. | |
| coneApex | The apex of the cone. | |
| coneDir | The unit-length direction from the apex to the base. | |
| coneHeight | The height of the cone, from the apex to the base. | |
| coneBaseRadius | The radius of the cone base circle. | |
| [out] | t1 | A possible coefficient in the ray's explicit equation from which an intersecting point is calculated as "rayOrigin + t1 * rayDir". |
| [out] | t2 | A possible coefficient in the ray's explicit equation from which an intersecting point is calculated as "rayOrigin + t2 * rayDir". |
| bool AZ::Intersect::IntersectRayDisk | ( | const Vector3 & | rayOrigin, |
| const Vector3 & | rayDir, | ||
| const Vector3 & | diskCenter, | ||
| const float | diskRadius, | ||
| const AZ::Vector3 & | diskNormal, | ||
| float & | t | ||
| ) |
Intersect ray (rayStarty, rayDirNormalized) and disk (center, radius, normal)
| rayOrigin | The origin of the ray to test. | |
| rayDir | The direction of the ray to test. It has to be unit length. | |
| diskCenter | Center point of the disk. | |
| diskRadius | Radius of the disk. | |
| diskNormal | A normal perpendicular to the disk. | |
| [out] | t | If returning 1 (indicating a hit), this contains distance from rayOrigin along the normalized rayDir that the hit occured at. |
| bool AZ::Intersect::IntersectRayObb | ( | const Vector3 & | rayOrigin, |
| const Vector3 & | rayDir, | ||
| const Obb & | obb, | ||
| float & | t | ||
| ) |
Test intersection between a ray and an OBB.
| rayOrigin | The origin of the ray to test intersection with. | |
| rayDir | The direction of the ray to test intersection with. | |
| obb | The OBB to test for intersection with the ray. | |
| [out] | t | The coefficient in the ray's explicit equation from which the intersecting point is calculated as "rayOrigin + t * rayDirection". |
| int AZ::Intersect::IntersectRayPlane | ( | const Vector3 & | rayOrigin, |
| const Vector3 & | rayDir, | ||
| const Vector3 & | planePos, | ||
| const Vector3 & | planeNormal, | ||
| float & | t | ||
| ) |
Test intersection between a ray and a plane in 3D.
| rayOrigin | The origin of the ray to test intersection with. | |
| rayDir | The direction of the ray to test intersection with. | |
| planePos | A point on the plane to test intersection with. | |
| planeNormal | The normal of the plane to test intersection with. | |
| [out] | t | The coefficient in the ray's explicit equation from which the intersecting point is calculated as "rayOrigin + t * rayDirection". |
| int AZ::Intersect::IntersectRayQuad | ( | const Vector3 & | rayOrigin, |
| const Vector3 & | rayDir, | ||
| const Vector3 & | vertexA, | ||
| const Vector3 & | vertexB, | ||
| const Vector3 & | vertexC, | ||
| const Vector3 & | vertexD, | ||
| float & | t | ||
| ) |
Test intersection between a ray and a two-sided quadrilateral defined by four points in 3D. The four points that define the quadrilateral could be passed in with either counter clock-wise winding or clock-wise winding.
| rayOrigin | The origin of the ray to test intersection with. | |
| rayDir | The direction of the ray to test intersection with. | |
| vertexA | One of the four points that define the quadrilateral. | |
| vertexB | One of the four points that define the quadrilateral. | |
| vertexC | One of the four points that define the quadrilateral. | |
| vertexD | One of the four points that define the quadrilateral. | |
| [out] | t | The coefficient in the ray's explicit equation from which the intersecting point is calculated as "rayOrigin + t * rayDirection". |
| AZ_MATH_INLINE SphereIsectTypes AZ::Intersect::IntersectRaySphere | ( | const Vector3 & | rayStart, |
| const Vector3 & | rayDirNormalized, | ||
| const Vector3 & | sphereCenter, | ||
| const float | sphereRadius, | ||
| float & | t | ||
| ) |
Intersect ray (rayStart,rayDirNormalized) and sphere (sphereCenter,sphereRadius) IntersectRaySphereOrigin
| rayStart | The start of the ray. | |
| rayDirNormalized | The direction of the ray normalized. | |
| sphereCenter | The center of the sphere. | |
| sphereRadius | Radius of the sphere. | |
| [out] | t | Coefficient in the ray's explicit equation from which an intersecting point is calculated as "rayOrigin + t1 * rayDir". |
| AZ_MATH_INLINE SphereIsectTypes AZ::Intersect::IntersectRaySphereOrigin | ( | const Vector3 & | rayStart, |
| const Vector3 & | rayDirNormalized, | ||
| const float | sphereRadius, | ||
| float & | t | ||
| ) |
IntersectRaySphereOrigin return time t>=0 but not limited, so if you check a segment make sure t <= segmentLen.
| rayStart | ray start point. |
| rayDirNormalized | ray direction normalized. |
| shereRadius | Radius of sphere at origin. |
| time | of closest intersection [0,+INF] in relation to the normalized direction. |
| CapsuleIsectTypes AZ::Intersect::IntersectSegmentCapsule | ( | const Vector3 & | sa, |
| const Vector3 & | dir, | ||
| const Vector3 & | p, | ||
| const Vector3 & | q, | ||
| const float | r, | ||
| float & | t | ||
| ) |
This is a quick implementation of segment capsule based on segment cylinder IntersectSegmentCylinder segment sphere intersection. We can optimize it a lot once we fix the ray cylinder intersection.
| sa | The beginning of the line segment. | |
| dir | The direction and length of the segment. | |
| p | Center point of side 1 capsule. | |
| q | Center point of side 1 capsule. | |
| r | The radius of the capsule. | |
| [out] | t | Proporition along line segment. |
| CylinderIsectTypes AZ::Intersect::IntersectSegmentCylinder | ( | const Vector3 & | sa, |
| const Vector3 & | dir, | ||
| const Vector3 & | p, | ||
| const Vector3 & | q, | ||
| const float | r, | ||
| float & | t | ||
| ) |
Reference: Real-Time Collision Detection - 5.3.7 Intersecting Ray or Segment Against Cylinder Intersect segment S(t)=sa+t(dir), 0<=t<=1 against cylinder specified by p, q and r.
| sa | The initial point. | |
| dir | Magnitude and direction for sa. | |
| p | Center point of side 1 cylinder. | |
| q | Center point of side 2 cylinder. | |
| r | Radius of cylinder. | |
| [out] | t | Proporition along line segment. |
| bool AZ::Intersect::IntersectSegmentPolyhedron | ( | const Vector3 & | sa, |
| const Vector3 & | dir, | ||
| const Plane | p[], | ||
| int | numPlanes, | ||
| float & | tfirst, | ||
| float & | tlast, | ||
| int & | iFirstPlane, | ||
| int & | iLastPlane | ||
| ) |
Intersect segment S(t)=A+t(B-A), 0<=t<=1 against convex polyhedron specified by the n halfspaces defined by the planes p[]. On exit tfirst and tlast define the intersection, if any.
| sa | The beggining of the line segment. | |
| dir | The direction and length of the segment. | |
| p | Planes that compose a convex ponvex polyhedron. | |
| numPlanes | number of planes. | |
| [out] | tfirst | Proportion along the line segment where the line enters. |
| [out] | tlast | Proportion along the line segment where the line exits. |
| [out] | iFirstPlane | The plane where the line enters. |
| [out] | iLastPlane | The plane where the line exits. |
| bool AZ::Intersect::IntersectSegmentTriangle | ( | const Vector3 & | p, |
| const Vector3 & | q, | ||
| const Vector3 & | a, | ||
| const Vector3 & | b, | ||
| const Vector3 & | c, | ||
| Vector3 & | normal, | ||
| float & | t | ||
| ) |
Same as IntersectSegmentTriangleCCW without respecting the triangle (a,b,c) vertex order (double sided).
| p | Segment start point. |
| q | Segment end point. |
| a | Triangle point 1. |
| b | Triangle point 2. |
| c | Triangle point 3. |
| normal | At the intersection point. |
| t | Time of intersection along the segment [0.0 (p), 1.0 (q)]. |
| bool AZ::Intersect::IntersectSegmentTriangleCCW | ( | const Vector3 & | p, |
| const Vector3 & | q, | ||
| const Vector3 & | a, | ||
| const Vector3 & | b, | ||
| const Vector3 & | c, | ||
| Vector3 & | normal, | ||
| float & | t | ||
| ) |
Given segment pq and triangle abc (CCW), returns whether segment intersects triangle and if so, also returns the barycentric coordinates (u,v,w) of the intersection point.
| p | Segment start point. |
| q | Segment end point. |
| a | Triangle point 1. |
| b | Triangle point 2. |
| c | Triangle point 3. |
| normal | At the intersection point. |
| t | Time of intersection along the segment [0.0 (p), 1.0 (q)]. |
| AZ_MATH_INLINE Vector3 AZ::Intersect::LineToPointDistance | ( | const Vector3 & | s1, |
| const Vector3 & | s2, | ||
| const Vector3 & | p, | ||
| float & | u | ||
| ) |
LineToPointDistance computes the closest point to 'p' from a segment (s1,s2).
| s1 | Segment start point |
| s2 | Segment end point |
| p | Point to find the closest time to. |
| u | Time (on the segment) for the shortest distance from 'p' to (s1,s2) [0.0f (s1),1.0f (s2)] |
| AZ_MATH_INLINE float AZ::Intersect::LineToPointDistanceTime | ( | const Vector3 & | s1, |
| const Vector3 & | s21, | ||
| const Vector3 & | p | ||
| ) |
LineToPointDistanceTime computes the time of the shortest distance from point 'p' to segment (s1,s2). To calculate the point of intersection: P = s1 + u (s2 - s1)
| s1 | Segment start point. |
| s2 | Segment end point. |
| p | Point to find the closest time to. |
| AZ_INLINE bool AZ::Intersect::PointCylinder | ( | const AZ::Vector3 & | baseCenterPoint, |
| const AZ::Vector3 & | axisVector, | ||
| float | axisLengthSquared, | ||
| float | radiusSquared, | ||
| const AZ::Vector3 & | testPoint | ||
| ) |
This method checks if a point is inside a cylinder or outside it.
| baseCenterPoint | Vector to the base of the cylinder |
| axisVector | Non normalized vector from the base of the cylinder to the other end |
| axisLengthSquared | square of length of "axisVector" |
| radiusSquared | square of cylinder radius |
| testPoint | Point to be tested |
| AZ_INLINE bool AZ::Intersect::PointSphere | ( | const Vector3 & | centerPosition, |
| float | radiusSquared, | ||
| const Vector3 & | testPoint | ||
| ) |
This method checks if a point is inside a sphere or outside it.
| centerPosition | Position of the center of the sphere |
| radiusSquared | square of cylinder radius |
| testPoint | Point to be tested |
| AZ_MATH_INLINE bool AZ::Intersect::TestSegmentAABB | ( | const Vector3 & | p0, |
| const Vector3 & | p1, | ||
| const Aabb & | aabb | ||
| ) |
Test if segment specified by points p0 and p1 intersects AABB. TestSegmentAABBOrigin.
| p0 | Segment start point. |
| p1 | Segment end point. |
| aabb | Bounded box to test against. |
| bool AZ::Intersect::TestSegmentAABBOrigin | ( | const Vector3 & | midPoint, |
| const Vector3 & | halfVector, | ||
| const Vector3 & | aabbExtends | ||
| ) |
Test segment and aabb where the segment is defined by midpoint midPoint = (p1-p0) * 0.5f and half vector halfVector = p1 - midPoint. the aabb is at the origin and defined by half extents only.
| midPoint | Midpoint of a line segment. |
| halfVector | Half vector of an aabb. |
| aabbExtends | The extends of a bounded box. |
1.8.17