GJK algorithm and EPA for narrow-phase collision detection.

Static methods

staticinlinegetInstance():GjkEpa

Returns an instance of GjkEpa.

Constructor

new()

Default constructor. Consider using GjkEpa.getInstance instead of creating a new instance.

Variables

closestPoint1:Vec3

Computed closest point of the first geometry in world coordinate system.

closestPoint2:Vec3

Computed closest point of the second geometry in world coordinate system.

distance:Float

Computed distance between two geometries. This value may be negative if two geometries are overlapping.

Methods

inlinecomputeClosestPoints(c1:ConvexGeometry, c2:ConvexGeometry, tf1:Transform, tf2:Transform, cache:CachedDetectorData):Int

Computes the closest points of two convex geometries c1 and c2 with transforms tf1 and tf2 respectively, and returns the status of the result (see GjkEpaResultState for details). If cached data cache is not null, this tries to exploit the previous result in cache to improve performance, and stores the new result to cache.

Set the compiler option OIMO_GJK_EPA_DEBUG for debugging (warning: massive logging).

inlinecomputeDistance(c1:ConvexGeometry, c2:ConvexGeometry, tf1:Transform, tf2:Transform, cache:CachedDetectorData):Int

Computes the distance between two convex geometries c1 and c2 with transforms tf1 and tf2 respectively, and returns the status of the result (see GjkEpaResultState for details). Different from GjkEpa.computeClosestPoints, this does not compute negative distances and closest points if two geometries are overlapping. If cached data cache is not null, this tries to exploit the previous result in cache to improve performance, and stores the new result to cache.

Set the compiler option OIMO_GJK_EPA_DEBUG for debugging (warning: massive logging).

convexCast(c1:ConvexGeometry, c2:ConvexGeometry, tf1:Transform, tf2:Transform, tl1:Vec3, tl2:Vec3, hit:RayCastHit):Bool

Performs a convex casting between c1 and c2. Returns true and sets the result information to hit if the convex geometries intersect. Each convex geometries translates by tl1 and tl2, starting from the beginning transforms tf1 and tf2 respectively.

Set the compiler option OIMO_GJK_EPA_DEBUG for debugging (warning: massive logging).

rayCast(c:ConvexGeometry, tf:Transform, begin:Vec3, end:Vec3, hit:RayCastHit):Bool

Performs ray cansting against the convex geometry c with transform tf. Returns true and sets the result information to hit if the line segment from begin to end intersects the convex geometry. Otherwise returns false.

Set the compiler option OIMO_GJK_EPA_DEBUG for debugging (warning: massive logging).