Photon Quantum 3.0.0

Static Public Member Functions | List of all members
Photon.Deterministic.FPCollision Struct Reference

A collection of collision helper functions. More...

Static Public Member Functions

static Boolean BoxIntersectsBox (FPVector2 aCenter, FPVector2 aExtents, FP aRotation, FPVector2 bCenter, FPVector2 bExtents, FP bRotation)
 Box-Box (2D) intersection test. More...
 
static Boolean CircleContainsPoint (FPVector2 center, FP radius, FPVector2 point)
 Checks if point is inside a circle, including its circumference. Works for CW and CWW. More...
 
static Boolean CircleIntersectsAABB (FPVector2 center, FP radius, FPVector2 min, FPVector2 max)
 Circle-AABB intersection test. More...
 
static Boolean CircleIntersectsCircle (FPVector2 a_origin, FP a_radius, FPVector2 b_origin, FP b_radius)
 Circle-circle intersection test. More...
 
static Boolean CircleIntersectsPolygon (FPVector2 circleCenter, FP circleRadius, FPVector2 polygonPosition, FP polygonRotation, FPVector2[] polygonVertices, FPVector2[] polygonNormals)
 Circle-polygon intersection test. More...
 
static Boolean CircleIntersectsPolygon (FPVector2 circleCenter, FP circleRadius, FPVector2 polygonPosition, FP polygonRotationSinInverse, FP polygonRotationCosInverse, FPVector2[] polygonVertices, FPVector2[] polygonNormals)
 Circle-polygon intersection test. More...
 
static Boolean CircleIntersectsTriangle (FPVector2 center, FP radius, FPVector2 v1, FPVector2 v2, FPVector2 v3)
 Circle-triangle intersection test. More...
 
static bool ClampPointToAABB (FPVector2 point, FPVector2 boxExtents, out FPVector2 clampedPoint)
 Clamps a 2D point to an axis-aligned bounding box (AABB). More...
 
static bool ClampPointToLocalAABB (FPVector3 point, FPVector3 aabbExtents, out FPVector3 clampedPoint)
 Checks if a point is inside the extents of an AABB centered at the origin (local space) and clamp it otherwise. More...
 
static FP ClosestDistanceToTriangle (FPVector3 p, FPVector3 a, FPVector3 b, FPVector3 c, out FPVector3 closestPoint, out FPVector3 barycentricCoordinates)
 Uses barycentric coordinates to calculate the closest point on a triangle. In conjunction with Fixed Point math this can get quite inaccurate when the triangle become large (more than 100 units) or tiny (less then 0.01 units). More...
 
static FPVector2 ClosestPointBetweenSegments (FPVector2 segment1Start, FPVector2 segment1End, FPVector2 segment2Start, FPVector2 segment2End)
 Computes the closes point in segment A to a segment B. More...
 
static FPVector3 ClosestPointBetweenSegments (FPVector3 segmentStartA, FPVector3 segmentEndA, FPVector3 segmentStartB, FPVector3 segmentEndB)
 Computes the closes point in segment A to a segment B. More...
 
static FPVector3 ClosestPointInSegment (FPVector3 point, FPVector3 a, FPVector3 b)
 Calculates the closest point on the line segment defined by two given points to a given point. More...
 
static FPVector2 ClosestPointOnCicle (FPVector2 center, FP radius, FPVector2 pt)
 Casts a point pt on a circle. More...
 
static FPVector2 ClosestPointOnSegment (FPVector2 point, FPVector2 p1, FPVector2 p2)
 Cast point point on a line crossing p1 and p2 . The result is clamped to lie on a segment defined by p1 and p2 . More...
 
static FPVector3 ClosestPointOnSegment (FPVector3 point, FPVector3 p1, FPVector3 p2)
 Returns the closest point on a segment to a given point. More...
 
static FPVector2 ClosestPointOnTriangle (FPVector2 pt, FPVector2 t0, FPVector2 t1, FPVector2 t2)
 Casts a point pt on a triangle defined by three vertices. More...
 
static Boolean InsideAABB (FPVector2 point, FPVector2 extents, out FP penetration)
 Returns true if point is inside centered AABB. More...
 
static bool IsPointOnLine (FPVector2 p1, FPVector2 p2, FPVector2 point)
 Returns true if a point point lies on a line crossing p1 and p2 . More...
 
static Int32 LineIntersectsAABB (FPVector2 p1, FPVector2 p2, FPVector2 aabbCenter, FPVector2 aabbExtents, out FPVector2 i1, out FPVector2 i2, out FP penetration)
 Line segment-AABB intersection test in world space with computation of intersection points and penetration. More...
 
static Int32 LineIntersectsAABB (FPVector2 p1, FPVector2 p2, FPVector2 aabbExtents, out FPVector2 i1, out FPVector2 i2, out FP penetration)
 Line segment-AABB intersection test in the LOCAL space of the AABB with computation of intersection points and penetration. More...
 
static Boolean LineIntersectsAABB2 (FPVector2 p1, FPVector2 p2, FPVector2 normal, FPVector2 aabbCenter, FPVector2 aabbExtents, out FPVector2 i1, out FPVector2 i2, out FP penetration)
 Line segment-AABB intersection test in world space with computation of intersection points, normal and penetration. If an intersection is detected, the test always returns two intersection points, which can be either intersections between the line segment and an edge of the AABB or a segment point itself, if inside the AABB. More...
 
static Boolean LineIntersectsAABB2 (FPVector2 p1, FPVector2 p2, FPVector2 normal, FPVector2 aabbExtents, out FPVector2 i1, out FPVector2 i2, out FP penetration)
 Line segment-AABB intersection test in the LOCAL space of the AABB with computation of intersection points, normal and penetration. If an intersection is detected, the test always returns two intersection points, which can be either intersections between the line segment and an edge of the AABB or a segment point itself, if inside the AABB. More...
 
static Boolean LineIntersectsAABB_SAT (FPVector2 p1, FPVector2 p2, FPVector2 aabbCenter, FPVector2 aabbExtents)
 Line segment-AABB intersection test. More...
 
static Boolean LineIntersectsAABB_SAT (FPVector2 p1, FPVector2 p2, FPVector2 aabbExtents)
 Line segment-AABB intersection test in the LOCAL space of the AABB. More...
 
static Boolean LineIntersectsCircle (FPVector2 p1, FPVector2 p2, FPVector2 position, FP radius, bool ignoreIfStartPointInside=false)
 Line segment-circle intersection test. More...
 
static Boolean LineIntersectsCircle (FPVector2 p1, FPVector2 p2, FPVector2 position, FP radius, out FPVector2 point, bool ignoreIfStartPointInside=false)
 Line segment-circle intersection test. More...
 
static Boolean LineIntersectsCircle (FPVector2 p1, FPVector2 p2, FPVector2 position, FP radius, out FPVector2 point, out FP normalizedDist, bool ignoreIfStartPointInside=false)
 Line segment-circle intersection test. More...
 
static Boolean LineIntersectsCircleManifold (FPVector2 p1, FPVector2 p2, FPVector2 position, FP radius, out FPVector2 point)
 Line segment-circle intersection test. More...
 
static bool LineIntersectsLine (FPVector2 p1, FPVector2 p2, FPVector2 q1, FPVector2 q2)
 Line segment-line segment intersection test. More...
 
static bool LineIntersectsLine (FPVector2 p1, FPVector2 p2, FPVector2 q1, FPVector2 q2, out FPVector2 point)
 Line segment-line segment intersection test. More...
 
static bool LineIntersectsLine (FPVector2 p1, FPVector2 p2, FPVector2 q1, FPVector2 q2, out FPVector2 point, out FP distance)
 Line segment-line segment intersection test. More...
 
static bool LineIntersectsLine (FPVector2 p1, FPVector2 p2, FPVector2 q1, FPVector2 q2, out FPVector2 point, out FP distance, out FP normalizedDist)
 Determines if two lines intersect. More...
 
static void LineIntersectsLineAlwaysHit (FPVector2 p1, FPVector2 p2, FPVector2 q1, FPVector2 q2, out FPVector2 point)
 Line segment-line segment intersection test. Assumes lines are not colinear nor parallel. More...
 
static FPVector2 TriangleCenter (FPVector2 v0, FPVector2 v1, FPVector2 v2)
 Returns the center of a triangle defined by three vertices. More...
 
static Boolean TriangleContainsPointExclusive (FPVector2 pt, FPVector2 v0, FPVector2 v1, FPVector2 v2)
 Checks if pt is inside a triangle, excluding vertices and edges. Works for CW and CWW. More...
 
static Boolean TriangleContainsPointExclusive (FPVector3 pt, FPVector3 v0, FPVector3 v1, FPVector3 v2)
 Checks if pt is inside a triangle, excluding vertices and edges. This only checks the XZ component like the triangle is in 2D! Works for CW and CWW. More...
 
static Boolean TriangleContainsPointInclusive (FPVector2 pt, FPVector2 v0, FPVector2 v1, FPVector2 v2)
 Checks if pt is inside a triangle, including edges and vertices. Works for CW and CWW. More...
 
static Boolean TriangleContainsPointInclusive (FPVector3 pt, FPVector3 v0, FPVector3 v1, FPVector3 v2)
 Checks if pt is inside a triangle, including edges and vertices. This only checks the XZ component like the triangle is in 2D! Works for CW and CWW. More...
 

Detailed Description

A collection of collision helper functions.

Member Function Documentation

◆ TriangleCenter()

static FPVector2 Photon.Deterministic.FPCollision.TriangleCenter ( FPVector2  v0,
FPVector2  v1,
FPVector2  v2 
)
inlinestatic

Returns the center of a triangle defined by three vertices.

Parameters
v0
v1
v2
Returns

◆ IsPointOnLine()

static bool Photon.Deterministic.FPCollision.IsPointOnLine ( FPVector2  p1,
FPVector2  p2,
FPVector2  point 
)
inlinestatic

Returns true if a point point lies on a line crossing p1 and p2 .

Parameters
p1
p2
point
Returns

◆ ClosestPointOnSegment() [1/2]

static FPVector3 Photon.Deterministic.FPCollision.ClosestPointOnSegment ( FPVector3  point,
FPVector3  p1,
FPVector3  p2 
)
inlinestatic

Returns the closest point on a segment to a given point.

Parameters
pointThe point to find the closest point on the segment to.
p1The start point of the segment.
p2The end point of the segment.
Returns
The closest point on the segment to the given point.

◆ ClosestPointOnSegment() [2/2]

static FPVector2 Photon.Deterministic.FPCollision.ClosestPointOnSegment ( FPVector2  point,
FPVector2  p1,
FPVector2  p2 
)
inlinestatic

Cast point point on a line crossing p1 and p2 . The result is clamped to lie on a segment defined by p1 and p2 .

Parameters
point
p1
p2
Returns

◆ ClampPointToAABB()

static bool Photon.Deterministic.FPCollision.ClampPointToAABB ( FPVector2  point,
FPVector2  boxExtents,
out FPVector2  clampedPoint 
)
inlinestatic

Clamps a 2D point to an axis-aligned bounding box (AABB).

Parameters
pointThe point to clamp.
boxExtentsThe half extents of the AABB. The AABB is centered at the origin.
clampedPointThe clamped point will be stored in this output parameter.
Returns
Returns true if the original point is inside the AABB, or false if it is outside. The clamped point will always be inside the AABB.

◆ ClosestPointBetweenSegments() [1/2]

static FPVector2 Photon.Deterministic.FPCollision.ClosestPointBetweenSegments ( FPVector2  segment1Start,
FPVector2  segment1End,
FPVector2  segment2Start,
FPVector2  segment2End 
)
inlinestatic

Computes the closes point in segment A to a segment B.

Parameters
segment1StartStart point of segment A.
segment1EndEnd point of segment A.
segment2StartStart point of segment A.
segment2EndEnd point of segment B.
Returns

◆ ClosestPointOnTriangle()

static FPVector2 Photon.Deterministic.FPCollision.ClosestPointOnTriangle ( FPVector2  pt,
FPVector2  t0,
FPVector2  t1,
FPVector2  t2 
)
inlinestatic

Casts a point pt on a triangle defined by three vertices.

Parameters
pt
t0
t1
t2
Returns

◆ ClosestPointOnCicle()

static FPVector2 Photon.Deterministic.FPCollision.ClosestPointOnCicle ( FPVector2  center,
FP  radius,
FPVector2  pt 
)
inlinestatic

Casts a point pt on a circle.

Parameters
center
radius
pt
Returns

◆ TriangleContainsPointExclusive() [1/2]

static Boolean Photon.Deterministic.FPCollision.TriangleContainsPointExclusive ( FPVector2  pt,
FPVector2  v0,
FPVector2  v1,
FPVector2  v2 
)
inlinestatic

Checks if pt is inside a triangle, excluding vertices and edges. Works for CW and CWW.

Parameters
ptPoint to check
v0vertex position 0
v1vertex position 1
v2vertex position 2
Returns
true if pt is inside the triangle. false if point is outside or if the point is located on an edge or vertex.

◆ TriangleContainsPointExclusive() [2/2]

static Boolean Photon.Deterministic.FPCollision.TriangleContainsPointExclusive ( FPVector3  pt,
FPVector3  v0,
FPVector3  v1,
FPVector3  v2 
)
inlinestatic

Checks if pt is inside a triangle, excluding vertices and edges. This only checks the XZ component like the triangle is in 2D! Works for CW and CWW.

Parameters
ptPoint to check
v0vertex position 0
v1vertex position 1
v2vertex position 2
Returns
true if pt is inside the triangle. false if point is outside or if the point is located on an edge or vertex.

◆ TriangleContainsPointInclusive() [1/2]

static Boolean Photon.Deterministic.FPCollision.TriangleContainsPointInclusive ( FPVector2  pt,
FPVector2  v0,
FPVector2  v1,
FPVector2  v2 
)
inlinestatic

Checks if pt is inside a triangle, including edges and vertices. Works for CW and CWW.

Parameters
ptPoint to check
v0vertex position 0
v1vertex position 1
v2vertex position 2
Returns
true if pt is inside the triangle or is located on an edge or vertex.

◆ TriangleContainsPointInclusive() [2/2]

static Boolean Photon.Deterministic.FPCollision.TriangleContainsPointInclusive ( FPVector3  pt,
FPVector3  v0,
FPVector3  v1,
FPVector3  v2 
)
inlinestatic

Checks if pt is inside a triangle, including edges and vertices. This only checks the XZ component like the triangle is in 2D! Works for CW and CWW.

Parameters
ptPoint to check
v0vertex position 0
v1vertex position 1
v2vertex position 2
Returns
true if pt is inside the triangle or is located on an edge or vertex.

◆ CircleContainsPoint()

static Boolean Photon.Deterministic.FPCollision.CircleContainsPoint ( FPVector2  center,
FP  radius,
FPVector2  point 
)
inlinestatic

Checks if point is inside a circle, including its circumference. Works for CW and CWW.

Parameters
center
radius
point
Returns
true in point point is inside the circle.

◆ CircleIntersectsCircle()

static Boolean Photon.Deterministic.FPCollision.CircleIntersectsCircle ( FPVector2  a_origin,
FP  a_radius,
FPVector2  b_origin,
FP  b_radius 
)
inlinestatic

Circle-circle intersection test.

Parameters
a_origin
a_radius
b_origin
b_radius
Returns

◆ CircleIntersectsAABB()

static Boolean Photon.Deterministic.FPCollision.CircleIntersectsAABB ( FPVector2  center,
FP  radius,
FPVector2  min,
FPVector2  max 
)
inlinestatic

Circle-AABB intersection test.

Parameters
center
radius
min
max
Returns

◆ CircleIntersectsTriangle()

static Boolean Photon.Deterministic.FPCollision.CircleIntersectsTriangle ( FPVector2  center,
FP  radius,
FPVector2  v1,
FPVector2  v2,
FPVector2  v3 
)
inlinestatic

Circle-triangle intersection test.

Parameters
center
radius
v1
v2
v3
Returns

◆ LineIntersectsAABB_SAT() [1/2]

static Boolean Photon.Deterministic.FPCollision.LineIntersectsAABB_SAT ( FPVector2  p1,
FPVector2  p2,
FPVector2  aabbCenter,
FPVector2  aabbExtents 
)
inlinestatic

Line segment-AABB intersection test.

Parameters
p1First point that defines the line segment in world space.
p2Second point that defines the line segment in world space.
aabbCenterThe center of the AABB in world space.
aabbExtentsThe distance between the AABB center and the max X and Y values in world space.
Returns
true if the line segment intersects the AABB and false otherwise.

◆ LineIntersectsAABB_SAT() [2/2]

static Boolean Photon.Deterministic.FPCollision.LineIntersectsAABB_SAT ( FPVector2  p1,
FPVector2  p2,
FPVector2  aabbExtents 
)
inlinestatic

Line segment-AABB intersection test in the LOCAL space of the AABB.

Parameters
p1First point that defines the line segment, relative to the AABB center.
p2Second point that defines the line segment, relative to the AABB center.
aabbExtentsThe distance between the AABB center and the max X and Y values.
Returns
true if the line segment intersects the AABB and false otherwise.

◆ LineIntersectsAABB2() [1/2]

static Boolean Photon.Deterministic.FPCollision.LineIntersectsAABB2 ( FPVector2  p1,
FPVector2  p2,
FPVector2  normal,
FPVector2  aabbCenter,
FPVector2  aabbExtents,
out FPVector2  i1,
out FPVector2  i2,
out FP  penetration 
)
inlinestatic

Line segment-AABB intersection test in world space with computation of intersection points, normal and penetration. If an intersection is detected, the test always returns two intersection points, which can be either intersections between the line segment and an edge of the AABB or a segment point itself, if inside the AABB.

Parameters
p1First point that defines the line segment in world space.
p2Second point that defines the line segment in world space.
normalNormal along which the line segment penetration will be computed.
aabbCenterThe center of the AABB in world space.
aabbExtentsThe distance between the AABB center and the max X and Y values in world space.
i1First intersection point.
i2Second intersection point.
penetrationThe penetration of the line segment along the normal .
Returns
true if the line segment intersects the AABB and false otherwise.

◆ LineIntersectsAABB2() [2/2]

static Boolean Photon.Deterministic.FPCollision.LineIntersectsAABB2 ( FPVector2  p1,
FPVector2  p2,
FPVector2  normal,
FPVector2  aabbExtents,
out FPVector2  i1,
out FPVector2  i2,
out FP  penetration 
)
inlinestatic

Line segment-AABB intersection test in the LOCAL space of the AABB with computation of intersection points, normal and penetration. If an intersection is detected, the test always returns two intersection points, which can be either intersections between the line segment and an edge of the AABB or a segment point itself, if inside the AABB.

Parameters
p1First point that defines the line segment, relative to the AABB center.
p2Second point that defines the line segment, relative to the AABB center.
normalNormal along which the line segment penetration will be computed.
aabbExtentsThe distance between the AABB center and the max X and Y values in world space.
i1First intersection point, relative to the AABB center.
i2Second intersection point, relative to the AABB center.
penetrationThe penetration of the line segment along the normal .
Returns
true if the line segment intersects the AABB and false otherwise.

◆ LineIntersectsAABB() [1/2]

static Int32 Photon.Deterministic.FPCollision.LineIntersectsAABB ( FPVector2  p1,
FPVector2  p2,
FPVector2  aabbCenter,
FPVector2  aabbExtents,
out FPVector2  i1,
out FPVector2  i2,
out FP  penetration 
)
inlinestatic

Line segment-AABB intersection test in world space with computation of intersection points and penetration.

Parameters
p1First point that defines the line segment in world space.
p2Second point that defines the line segment in world space.
aabbCenterThe center of the AABB in world space.
aabbExtentsThe distance between the AABB center and the max X and Y values in world space.
i1First intersection point in world space.
i2Second intersection point in world space.
penetrationThe penetration of the line segment along the closest AABB normal.
Returns
The number of intersections found between the line segment and the AABB edges. If less than 2, the respective intersection point will be default.

◆ LineIntersectsAABB() [2/2]

static Int32 Photon.Deterministic.FPCollision.LineIntersectsAABB ( FPVector2  p1,
FPVector2  p2,
FPVector2  aabbExtents,
out FPVector2  i1,
out FPVector2  i2,
out FP  penetration 
)
inlinestatic

Line segment-AABB intersection test in the LOCAL space of the AABB with computation of intersection points and penetration.

Parameters
p1First point that defines the line segment, relative to the AABB center.
p2Second point that defines the line segment, relative to the AABB center.
aabbExtentsThe distance between the AABB center and the max X and Y values in world space.
i1First intersection point, relative to the AABB center.
i2Second intersection point, relative to the AABB center.
penetrationThe penetration of the line segment along the closest AABB normal.
Returns
The number of intersections found between the line segment and the AABB edges. If less than 2, the respective intersection point will be default.

◆ LineIntersectsLine() [1/4]

static bool Photon.Deterministic.FPCollision.LineIntersectsLine ( FPVector2  p1,
FPVector2  p2,
FPVector2  q1,
FPVector2  q2 
)
inlinestatic

Line segment-line segment intersection test.

Parameters
p1
p2
q1
q2
Returns

◆ LineIntersectsLine() [2/4]

static bool Photon.Deterministic.FPCollision.LineIntersectsLine ( FPVector2  p1,
FPVector2  p2,
FPVector2  q1,
FPVector2  q2,
out FPVector2  point,
out FP  distance 
)
inlinestatic

Line segment-line segment intersection test.

Parameters
p1
p2
q1
q2
pointPoint of collision
distanceDistance along p segment where the collision happens
Returns

◆ LineIntersectsLine() [3/4]

static bool Photon.Deterministic.FPCollision.LineIntersectsLine ( FPVector2  p1,
FPVector2  p2,
FPVector2  q1,
FPVector2  q2,
out FPVector2  point,
out FP  distance,
out FP  normalizedDist 
)
inlinestatic

Determines if two lines intersect.

Parameters
p1The starting point of the first line.
p2The ending point of the first line.
q1The starting point of the second line.
q2The ending point of the second line.
pointThe intersection point, if the lines intersect.
distanceThe distance between the intersection point and point p1, if the lines intersect.
normalizedDistThe normalized distance between the intersection point and point p1, if the lines intersect.
Returns
true if the lines intersect, false otherwise.

◆ LineIntersectsLine() [4/4]

static bool Photon.Deterministic.FPCollision.LineIntersectsLine ( FPVector2  p1,
FPVector2  p2,
FPVector2  q1,
FPVector2  q2,
out FPVector2  point 
)
inlinestatic

Line segment-line segment intersection test.

Parameters
p1
p2
q1
q2
pointPoint of collision
Returns

◆ LineIntersectsLineAlwaysHit()

static void Photon.Deterministic.FPCollision.LineIntersectsLineAlwaysHit ( FPVector2  p1,
FPVector2  p2,
FPVector2  q1,
FPVector2  q2,
out FPVector2  point 
)
inlinestatic

Line segment-line segment intersection test. Assumes lines are not colinear nor parallel.

Parameters
p1
p2
q1
q2
point

◆ InsideAABB()

static Boolean Photon.Deterministic.FPCollision.InsideAABB ( FPVector2  point,
FPVector2  extents,
out FP  penetration 
)
inlinestatic

Returns true if point is inside centered AABB.

Parameters
point
extents
penetration
Returns

◆ LineIntersectsCircleManifold()

static Boolean Photon.Deterministic.FPCollision.LineIntersectsCircleManifold ( FPVector2  p1,
FPVector2  p2,
FPVector2  position,
FP  radius,
out FPVector2  point 
)
inlinestatic

Line segment-circle intersection test.

Parameters
p1
p2
position
radius
point
Returns

◆ LineIntersectsCircle() [1/3]

static Boolean Photon.Deterministic.FPCollision.LineIntersectsCircle ( FPVector2  p1,
FPVector2  p2,
FPVector2  position,
FP  radius,
bool  ignoreIfStartPointInside = false 
)
inlinestatic

Line segment-circle intersection test.

Parameters
p1Start point of the line segment.
p2End point of the line segment.
positionPosition of the center of the circle in world space.
radiusRadius of the circle.
ignoreIfStartPointInsideIf the intersection should be ignored if the start point of the line segment (p1 ) is inside the circle.
Returns
true if an intersection is detected. false otherwise.

◆ LineIntersectsCircle() [2/3]

static Boolean Photon.Deterministic.FPCollision.LineIntersectsCircle ( FPVector2  p1,
FPVector2  p2,
FPVector2  position,
FP  radius,
out FPVector2  point,
bool  ignoreIfStartPointInside = false 
)
inlinestatic

Line segment-circle intersection test.

Parameters
p1Start point of the line segment.
p2End point of the line segment.
positionPosition of the center of the circle in world space.
radiusRadius of the circle.
pointIntersection point, if intersecting. Default otherwise.
ignoreIfStartPointInsideIf the intersection should be ignored if the start point of the line segment (p1 ) is inside the circle.
Returns
true if an intersection is detected. false otherwise.

◆ LineIntersectsCircle() [3/3]

static Boolean Photon.Deterministic.FPCollision.LineIntersectsCircle ( FPVector2  p1,
FPVector2  p2,
FPVector2  position,
FP  radius,
out FPVector2  point,
out FP  normalizedDist,
bool  ignoreIfStartPointInside = false 
)
inlinestatic

Line segment-circle intersection test.

Parameters
p1Start point of the line segment.
p2End point of the line segment.
positionPosition of the center of the circle in world space.
radiusRadius of the circle.
pointIntersection point, if intersecting. Default otherwise.
normalizedDistNormalize distance from p1 to p2 of the intersection point, if intersecting. Default otherwise.
ignoreIfStartPointInsideIf the intersection should be ignored if the start point of the line segment (p1 ) is inside the circle.
Returns
true if an intersection is detected. false otherwise.

◆ CircleIntersectsPolygon() [1/2]

static Boolean Photon.Deterministic.FPCollision.CircleIntersectsPolygon ( FPVector2  circleCenter,
FP  circleRadius,
FPVector2  polygonPosition,
FP  polygonRotationSinInverse,
FP  polygonRotationCosInverse,
FPVector2[]  polygonVertices,
FPVector2[]  polygonNormals 
)
inlinestatic

Circle-polygon intersection test.

Parameters
circleCenter
circleRadius
polygonPosition
polygonRotationSinInverse
polygonRotationCosInverse
polygonVertices
polygonNormals
Returns

◆ CircleIntersectsPolygon() [2/2]

static Boolean Photon.Deterministic.FPCollision.CircleIntersectsPolygon ( FPVector2  circleCenter,
FP  circleRadius,
FPVector2  polygonPosition,
FP  polygonRotation,
FPVector2[]  polygonVertices,
FPVector2[]  polygonNormals 
)
inlinestatic

Circle-polygon intersection test.

Parameters
circleCenter
circleRadius
polygonPosition
polygonRotation
polygonVertices
polygonNormals
Returns

◆ BoxIntersectsBox()

static Boolean Photon.Deterministic.FPCollision.BoxIntersectsBox ( FPVector2  aCenter,
FPVector2  aExtents,
FP  aRotation,
FPVector2  bCenter,
FPVector2  bExtents,
FP  bRotation 
)
inlinestatic

Box-Box (2D) intersection test.

Parameters
aCenter
aExtents
aRotation
bCenter
bExtents
bRotation
Returns

◆ ClosestDistanceToTriangle()

static FP Photon.Deterministic.FPCollision.ClosestDistanceToTriangle ( FPVector3  p,
FPVector3  a,
FPVector3  b,
FPVector3  c,
out FPVector3  closestPoint,
out FPVector3  barycentricCoordinates 
)
inlinestatic

Uses barycentric coordinates to calculate the closest point on a triangle. In conjunction with Fixed Point math this can get quite inaccurate when the triangle become large (more than 100 units) or tiny (less then 0.01 units).

Parameters
pPoint
aVertex 0
bVertex 1
cVertex 2
closestPointResulting point on the triangle
barycentricCoordinatesBarycentric coordinates of the point inside the triangle.
Returns
Squared distance to point on the triangle.

◆ ClampPointToLocalAABB()

static bool Photon.Deterministic.FPCollision.ClampPointToLocalAABB ( FPVector3  point,
FPVector3  aabbExtents,
out FPVector3  clampedPoint 
)
inlinestatic

Checks if a point is inside the extents of an AABB centered at the origin (local space) and clamp it otherwise.

Parameters
pointPoint in the local space of the AABB.
aabbExtentsExtents of the AABB.
clampedPointClamped point inside the AABB. Equals to point if it is already inside the AABB.
Returns
true if the point is already inside the AABB.

◆ ClosestPointInSegment()

static FPVector3 Photon.Deterministic.FPCollision.ClosestPointInSegment ( FPVector3  point,
FPVector3  a,
FPVector3  b 
)
inlinestatic

Calculates the closest point on the line segment defined by two given points to a given point.

Parameters
pointThe point to which the closest point on the segment is calculated.
aThe first point of the line segment.
bThe second point of the line segment.
Returns
The closest point on the line segment to the given point.

◆ ClosestPointBetweenSegments() [2/2]

static FPVector3 Photon.Deterministic.FPCollision.ClosestPointBetweenSegments ( FPVector3  segmentStartA,
FPVector3  segmentEndA,
FPVector3  segmentStartB,
FPVector3  segmentEndB 
)
inlinestatic

Computes the closes point in segment A to a segment B.

Parameters
segmentStartAStart point of segment A.
segmentEndAEnd point of segment A.
segmentStartBStart point of segment A.
segmentEndBEnd point of segment B.
Returns