- #1
mj878
- 1
- 0
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 I am 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]
and
[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?
So far I had the following
[itex]| (O + D . t1) - (A + B . t2 ) | = r[/itex]
and
[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?