Skip to content

lainventora/Reflecting-Light

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Solution

Ray_trace.py -> I propagated vectors under the given conditions. Formulas below.

Reflecting Light

By: Tonylicoding, codewars.com

Four mirrors are placed in a way that they form a rectangle with corners at coordinates (0, 0), (max_x, 0), (0, max_y), and (max_x, max_y). A light ray enters this rectangle through a hole at the position (0, 0) and moves at an angle of 45 degrees relative to the axes. Each time it hits one of the mirrors, it gets reflected. In the end, the light ray hits one of the rectangle's corners, and flies out. Your function must determine whether the exit point is either (0, 0) or (max_x, max_y). If it is either (0, 0) or (max_x, max_y), return True, and False otherwise.

Here is an image of the light being reflected:

ReflectingLightExample


Formulas:

Formulas-reflection

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages