Search for question
Question

4. [5pt] 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 \left(\frac{x}{\alpha}\right)^{2}+\left(\frac{y}{\beta}\right)^{2}-1=0 and the equation for a ray starting from the point Po = [xo, Yo] in the direction Vo = [u0, vo], is \mathbf{R}(t)=\left[x_{0}+t u_{0}, y_{0}+t v_{0}\right] where t e [0, x) 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 theintersection 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 ti. li.(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 P1 = R(t1)

Fig: 1

Fig: 2

Fig: 3

Fig: 4

Fig: 5

Fig: 6

Fig: 7