Search for question
Question

6. [2+2pt] Raytracing is an algorithm that involves finding the point at which a ray (a line with a

direction and an origin) intersects a curve or surface. We will consider a ray intersecting with an

ellipse. The general equation for an ellipse is

2

(²2)² + (²) ²

(²)²-1=0

and the equation for a ray starting from the point Po= [ro, yo] in the direction Vo = [uo, vo], is

R(t) = [ro + tuo, 30 + tvo]

where t = [0, ∞) parameterizes the ray. In this problem we will take a = 3, b = 2, Po = [0, b],

Vo = [1,-0.3]. Using your favorite root finding algorithm write a code which computes the

intersection of the given ray and the ellipse and plot your results..

(a) Plug the equation for the ray, R(t), into the equation for the ellipse and analytically (with

pen and paper) solve for the value of t which gives the point of intersection, call it tį.

(b) Perform the same calculation numerically using your favorite root finder. Report your answer

to within an error of 10-6 and justify how you found the minimum number of iterations

required to achieve this tolerance. Also report the point of intersection P; = R(t₁)

Fig: 1