Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
1998
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 1998

[Date Index] [Thread Index] [Author Index]

Search the Archive

3D problem solution



Hi all,

With regard to the question I posed about finding line intersections in
3-space, I found the IntersectionPoint function below in one of Tom
Wickham-Jones' excellent graphics packages (available on MathSource).
Tom's function will print "Parallel Lines" if two lines are parallel;
if they are skew, it returns two points, forming the shortest line
connecting the two skew lines; and if the two lines intersect, it
returns the two equal points.

cross[ {ax_, ay_, az_}, {bx_, by_, bz_} ] :=
   {ay bz - az by, az bx - ax bz, ax by - ay bx}

mag[v_] := Sqrt[Plus@@(v^2)]

IntersectionPoint[{a1_, a2_}, {b1_, b2_}] :=
   Block[{v1, v2, c},
   	  v1 = (a2-a1) ;
   	  v2 = (b2-b1) ;
   	  c = cross[ v1,v2] ;
   	  len = Chop[ mag[ c]^2] ;
      If[ len === 0,
			Print[ "Parallel Lines"];
			Return[ {Infinity, Infinity}]] ;
   	  {
   	  a1 + (a2 - a1) Det[ {b1-a1, v2, c}]/len,
   	  b1 + (b2 - b1) Det[ {b1-a1, v1, c}]/len
   	  }
   	  ]

Russell Towle
Giant Gap Press:  books on California history, digital topographic maps
P.O. Box 141
Dutch Flat, California 95714
------------------------------
Voice:  (916) 389-2872
e-mail:  rustybel@foothill.net
------------------------------




  • Prev by Date: help with Mathematica 3.0 'features' under NT
  • Next by Date: Re: Beginner's clothoid
  • Prev by thread: Re: help with Mathematica 3.0 'features' under NT
  • Next by thread: Re: Beginner's clothoid