gwnavruntime/navmesh/closestpoint.h Source File
Go to the documentation of this file.
12 #ifndef Navigation_ClosestPoint_H
13 #define Navigation_ClosestPoint_H
26 static void OnSegmentVsPoint2d(
const Vec3f& a,
const Vec3f& b,
const Vec3f& p, Vec3f& closestPointOnSegment,
KyFloat32& squareDist2d);
30 static void OnTriangleVsPoint2d(
const Vec3f& v1,
const Vec3f& v2,
const Vec3f& v3,
const Vec3f& p, Vec3f& closestPointOnTriangle,
KyFloat32& squareDist2d);
33 static void OnSegmentVsSegmentCast2d(
const Vec3f& v1,
const Vec3f& v2,
const Vec3f& a,
const Vec3f& b,
36 static void OnTriangleVsSegmentCast2d(
const Vec3f& v1,
const Vec3f& v2,
const Vec3f& v3,
const Vec3f& a,
37 const Vec3f& b,
const KyFloat32 distCast, Vec3f& closestPointonTriangle,
KyFloat32& squareDist2d);
40 static void OnSegmentVsDiskCast2d(
const Vec3f& v1,
const Vec3f& v2,
const Vec3f& center,
const KyFloat32 radius,
41 const Vec2f& normalizedDir2D,
const KyFloat32 distCast, Vec3f& closestPointonTriangle,
KyFloat32& squareDist2d);
43 static void OnTriangleVsDiskCast2d(
const Vec3f& v1,
const Vec3f& v2,
const Vec3f& v3,
const Vec3f& center,
const KyFloat32 radius,
44 const Vec2f& normalizedDir2D,
const KyFloat32 distCast, Vec3f& closestPointonTriangle,
KyFloat32& squareDist2d);
47 static void OnSegmentVsConeCast2d(
const Vec3f& v1,
const Vec3f& v2,
const Vec3f& apex,
const Vec2f& normalizedDir2D,
KyFloat32 length,
48 const KyFloat32 halfAngleSine, Vec3f& closestPointonTriangle,
KyFloat32& squareDist2d);
50 static void OnTriangleVsConeCast2d(
const Vec3f& v1,
const Vec3f& v2,
const Vec3f& v3,
const Vec3f& apex,
const Vec2f& normalizedDir2D,
64 static KyFloat32 GetSquareDistancePointToSegment(
const Vec2f& P,
const Vec2f& A,
const Vec2f& B);
65 static KyFloat32 GetSquareDistancePointToSegment(
const Vec2f& P,
const Vec2f& A,
const Vec2f& B,
const KyFloat32& sqDistAB);
66 static KyFloat32 GetSquareDistancePointToSegmentFactorSegmentSquareLength(
const Vec2f& P,
const Vec2f& A,
const Vec2f& B,
KyFloat32 sqDistAB);
67 static KyFloat32 GetSquareDistanceSegmentToSegment(
const Vec2f& P,
const Vec2f& Q,
const Vec2f& A,
const Vec2f& B);
69 static bool OnSegmentVsDisk2dIfIntersection(
const Vec3f& A,
const Vec3f& B,
const Vec3f& C,
KyFloat32 radius, Vec3f& intersection);
70 static bool OnSegmentCapsule2dIfIntersection(
const Vec3f& P,
const Vec3f& Q,
const Vec3f& A,
const Vec3f& B,
KyFloat32 radius, Vec3f& intersection);
73 KY_INLINE
KyFloat32 ClosestPoint::GetSquareDistancePointToSegment(
const Vec2f& P,
const Vec2f& A,
const Vec2f& B) {
return GetSquareDistancePointToSegment(P, A, B,
SquareDistance(A, B)); }
77 #endif // Navigation_ClosestPoint_H
KyFloat32 SquareDistance(const Vec2f &v1, const Vec2f &v2)
Returns the square of the distance between v1 and v2.
Definition: vec2f.h:194
unsigned __int64 KyUInt64
Type used internally to represent an unsigned 64-bit integer.
Definition: types.h:38
Vec2LL CoordPos64
A type that represents the position of a point within the 2D integer grid.
Definition: navmeshtypes.h:19
Definition: gamekitcrowddispersion.h:20
__int64 KyInt64
Type used internally to represent a 64-bit integer.
Definition: types.h:37
float KyFloat32
Type used internally to represent a 32-bit floating-point number.
Definition: types.h:43