closest_approach_3D: THEORY %---------------------------------------------------------------------------- % We compute the closest point of approach (CPA) between two % points that are dynamically moving in a straight line. This is % an important computation in collision detection. For example, % to calculate the time and distance of two planes (represented as % line vectors) when they are at their closest point. % % We use time-parametric equations to represent the paths of the % two planes: % % p(t) = p0 + t*u q(t) = q0 + t*v % % Minimum separation occurs at: % % t_cpa = -w0*(u-v)/sq(norm(u-v)) % % where w0 = p0 - q0 % % dist(L1,L2,t): MACRO nnreal = dist(loc(L1)(t),loc(L2)(t)) % dist(L1,L2): nnreal = dist(L1,L2,t_cpa(L1,L2)) % % We also introduce the following convenient predicates % % divergent?(p0,q0,u,v): bool = % FORALL (t: posreal): dist(p0,q0) < dist(p0+t*u,q0+t*v) % % dot_prop?(p0,q0,u,v): bool = (p0-q0)*(u-v) >= 0 % % and we prove there equivalence when u /= v. See "dot_prop_divergent".
% ----- distance at closest point is indeed a minimum -------
t_cpa: VAR real
d_cpa: VAR nnreal
cpa_prep_mono: LEMMA w0 = p0 - q0 AND
a = (u-v)*(u-v) AND
b = 2*w0*(u-v) AND
c = w0*w0 AND
t_cpa = time_closest(p0,q0,u,v) AND
norm(u-v) /= 0AND
t_cpa <= t1 AND t1 < t2 IMPLIES LET D2 = (LAMBDA t: sq_dist(p0+t*u,q0+t*v)) IN
D2(t1) < D2(t2)
dot_prop_divergent: THEOREM u /= v IMPLIES
(dot_prop?(p0,q0,u,v) IFF divergent?(p0,q0,u,v))
% ------ Intersection of dynamic line and a sphere -----
s: VAR Vect3
% The first lemma states that if t1 and t2 are the intersection % points with a sphere of radius D, then the distance for all times % between t1 and t2 is less than D
t1_lt_t2_lt_D : LEMMAFORALL (t,t1,t2,D:real):
v*v /= 0AND
t1 < t2 AND
(s+t1*v)*(s+t1*v) = D AND
(s+t2*v)*(s+t2*v) = D AND
t1 < t AND t < t2 IMPLIES
(s+t*v)*(s+t*v) < D
% The second lemma is the reciprocal of the previous lemma. It states that % if the distance at time t is less than D, then t is between t1 and % t2.
lt_D_t1_lt_t2 : LEMMAFORALL (t,t1,t2,D:real):
v*v /= 0AND
t1 < t2 AND
(s+t1*v)*(s+t1*v) = D AND
(s+t2*v)*(s+t2*v) = D AND
(s+t*v)*(s+t*v) < D IMPLIES
t1 < t AND t < t2
% The third lemma states that if there are no intersection points with % a sphere of radius D then the distance at any time is greater than D.
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.