We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
In order to solve this we must find the tangent of line that is reflected. Incident beam and reflected one form the same angle with the normal to the tangent line in point of reflection. Tangent line has the slope -(a/b) * (x / y) where x and y are point of intersection. Having the slope of reflected beam we can easily find its equation and point where it inercects with the ellipse. You sohuld avoid calculating the next intersection point by solving quadratic equation with delta and square roots. It's better to factorize this equation because we have only multiplying and division.
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Project Euler #144: Investigating multiple reflections of a laser beam.
You are viewing a single comment's thread. Return to all comments →
In order to solve this we must find the tangent of line that is reflected. Incident beam and reflected one form the same angle with the normal to the tangent line in point of reflection. Tangent line has the slope -(a/b) * (x / y) where x and y are point of intersection. Having the slope of reflected beam we can easily find its equation and point where it inercects with the ellipse. You sohuld avoid calculating the next intersection point by solving quadratic equation with delta and square roots. It's better to factorize this equation because we have only multiplying and division.