-
-
Notifications
You must be signed in to change notification settings - Fork 117
GJK implementation
Given two sets of points in nd (possibly lifted from a 2d space):
- separation problem: are they linearly separable ?
- distance problem: they are separable, but how far they are from each other ?
Let X1 and X2, two sets of points in nd, of size m1 and m2. The set difference is denoted by X = X1 - X2. Then: dist(X1, X2) = dist(X,o), where o is the origin. To compute dist(X,o), the idea is to generate a sequence of polytope Vk contained in conv(X) (having at most n+1 affinely independent points), such that dist(Vk,o) converges towards (and reaches) dist(X,o):
- k = 0, Vk has v points in X (1 <= v <= n+1).
- if Vk contains o, then stop, else go to 3.
- find V'k in Vk, which must be the closest polytope to o (of at most n affinely independent points).
- set Vk+1 to V'k U farthest( normal( V'k ) ), k++, go to 2.
NB: in 4. farthest( normal( V'k ) ) returns one of the points in X, which are the farthest along the direction normal to V'k (affine subspace of dimension at most m-1). This can be computed in O(m1+m2) from points of X1 and X2 by determinant computations (or even determinant sign evaluations).
NB: Most difficult tasks are 2. and 3.
At least determinant computation (or determinant signs computation)