1require_relative "../physics"23question :critical_angle do4 describes "Light in water meets air at %{angle}. %{critical_angle}?"5 given :angle6 asks critical_angle: "At what angle does it stop getting out"7end
1require_relative "../questions/critical_angle"2require_relative "../science/ray_optics_and_optical_instruments/reflection"3require_relative "../science/ray_optics_and_optical_instruments/refraction"4require_relative "../science/ray_optics_and_optical_instruments/refractive_media"56solve :critical_angle, using: [ Reflection, Refraction ] do7 take angle: :i8 deduce_from "water", mu_1: REFRACTIVE_MEDIA.fetch("water")9 deduce_from "air", mu_2: REFRACTIVE_MEDIA.fetch("air")10 take critical_angle: :c11 find_value :critical_angle12 find_value :r_r13 find_whether :no_refracted_ray?1415 conclusion "It is Snell's law with the refracted ray lying flat along the surface. Past it, no " \16 "angle of refraction satisfies the law, so none leaves."17end
1require_relative "../solutions/critical_angle"2require_relative "../science/ray_optics_and_optical_instruments/refractive_media"3require_relative "../pictures/light"45play_with :critical_angle do6 title "Critical Angle"78 input :i, default: 30.deg910 output :c11 output :r_r12 output :no_refracted_ray?, alarm: true1314 draw Light::Picture, rising: true do15 media "water", "air"16 ray "incident", arriving_at: :i, angle: true17 ray "reflected", leaving_at: :r_l18 ray "refracted", crossing_at: :r_r, angle: true, unless: :no_refracted_ray?19 mark "critical", arriving_at: :c20 note "all of it turns back", when: :no_refracted_ray?21 end22end