intersections_2D: THEORY %-------------------------------------------------------------------------- % % Derived from paper "Intersection of Linear and Circular Components in 2D" % by David Eberly. Available at: % % www.magic-software.com % % Author: Ricky Butler NASA Langley Research Center % %-------------------------------------------------------------------------- BEGIN
% | Basic | Parametric % |------------------|----------------- % Line : TYPE = [# p: Vect2, | point on the line| position at time 0 % v: Nz_vect2 #] | direction vector | velocity vector
% Three cases % intersecting : det(L0`v,L1`v) /= 0 % parallel : det(L0`v,L1`v) = 0 AND det(DELTA,L0`v) /= 0 % same_line : det(L0`v,L1`v) = 0 AND det(DELTA,L0`v) = 0
intersect?(L0,L1): bool = det(L0`v,L1`v) /= 0
same_line?(L0,L1): bool = LET DELTA = L1`p - L0`p IN
det(L0`v,L1`v) = 0 AND det(DELTA,L0`v) = 0 % ----------- function to return intersection point --------------
intersect_pt(L0:Line2D,L1: Line2D | det(L0`v,L1`v) /= 0): Vect2 = LET DELTA = L1`p - L0`p,
ss = det(DELTA,L1`v)/det(L0`v,L1`v) IN
L0`p + ss*L0`v
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 ist noch experimentell.