Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Arbitrary vector intersect sphere

  1. Feb 2, 2012 #1
    It says Sphere in the title but I actually meant Cylinder (Ive been working on it a few hours and brains gone numb). The problem is to do with an algorithm for a game im making in openGL. I need the points of intersect of a vector (O+Dt) and a cylinder with radius r, direction A and point on the cylinder core B (we can assume infinite height).

    So far I had the following

    [itex]| (O + D . t1) - (A + B . t2 ) | = r[/itex]


    [itex]B . ( (O + D . t1) - (A + B . t2 ) ) = 0[/itex]

    and then tried to solve it, but the equation became quite long and I likely made an error along the way.

    Does anyone have an easier way of solving it, or has anyone solved it before?
  2. jcsd
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook

Can you offer guidance or do you also need help?
Draft saved Draft deleted