0 Replies Latest reply on Oct 17, 2006 4:43 AM by the real POTMO

    Spline/ray intersection

    the real POTMO Level 1
      HI!

      i got a handler to calculate a spline.

      it looks like this

      on getCubicHermiteSpline n, pt1, pt2, tangent1, tangent2
      if n = 0 then n = 1

      L = []
      repeat with i = 1 to n
      t = i*1.0/n
      g1 = 2*t*t*t-3*t*t+1
      g2 = -2*t*t*t+3*t*t
      g3 = t*t*t-2*t*t+t
      g4 = t*t*t-t*t
      add L, g1*pt1 + g2*pt2 + g3*tangent1 +g4*tangent2
      end repeat
      return L
      end

      called by this
      put getCubicHermiteSpline(10, point(0, 0), point(100, 0), point(10, 20), point(10, -20)

      The problem now is that im not the an math expert but i'd like to know if a ray (i.e [#start:point(10,10) ,#direction: point(10,10) ]) intersects this spline of mine.

      And i dont want to split the spline in smaller lines and check for intersection on them like a numerical solution. I Would like a Analytic solution. (hope i havent got the analytic/numerical wrong)

      i need the EXACT point of intersection.

      Thanks in advance pals. :)