Interactive Optics & Light Ray Simulator
Geometric and physical optics form the cornerstone of modern optical engineering, astronomy, photography, telecommunications, and vision science. Whether engineering high-speed fiber-optic data transmission, designing multi-element camera objectives, understanding human eye accommodation, or analyzing spectral rainbows produced by raindrops and prisms, optical phenomena are governed by precise mathematical laws of electromagnetic wave propagation.
The DwellixTools Interactive Optics & Light Ray Simulator provides a laboratory-grade, real-time optical bench studio directly in your web browser. Built on an interactive vector ray-tracing engine, this educational workspace enables students, educators, physics enthusiasts, and engineers to manipulate incident light beams, adjust refractive indices across diverse media (from air and water to dense flint glass and diamond), test total internal reflection, observe chromatic rainbow dispersion through triangular prisms, calculate thin-lens Gaussian equations, and test their optics knowledge with an interactive physics quiz.
Key Features & Scientific Capabilities
- HiDPI Vector Optical Bench: Manipulate incident laser beams with a responsive radial angle dial or direct cursor dragging across 5 preset experimental configurations.
- Snell’s Law & Refraction Lab: Explore light ray bending across planar boundaries separating optical media with dynamic normal lines, incident angle (θ₁), refracted angle (θ₂), and reflected ray readouts.
- Total Internal Reflection (TIR) & Critical Angle: Observe light transitioning from optically dense media into rarer media (n₁ > n₂). The simulator dynamically computes the exact critical angle (θ_c) and switches smoothly from partial transmission to 100% total internal reflection.
- Cauchy Prism Chromatic Dispersion: Model the wavelength dependence of refractive index across the visible spectrum (400 nm violet to 700 nm red). Trace 7 distinct spectral wavelengths splitting and fanning out as light refracts twice through triangular prism faces.
- Converging & Diverging Thin Lenses: Visualize parallel laser ray bundles passing through convex (converging) and concave (diverging) lenses, with real-time principal focus points, focal lengths, and virtual backward ray traces.
- Plane Mirror Law of Reflection: Verify the fundamental law of reflection (angle of incidence equals angle of reflection: θᵢ = θᵣ) with specular surface ray tracing.
- Speed of Light in Media: Calculate the phase velocity of light inside the active medium in kilometers per second (km/s) and as an exact percentage of the vacuum speed of light (c = 299,792 km/s).
- Thin Lens Equation Calculator: Compute exact image distances (dᵢ), linear magnification factors (M), image orientations (upright vs inverted), image natures (real vs virtual), and optical power in diopters (D) using the Gaussian lens equation.
- Optics Concept Quiz Challenge: Solidify theoretical understanding with 5 randomized multiple-choice physics questions covering critical angles, prism dispersion, fiber optics, and lens equations with instant step-by-step explanations.
- High-Resolution Diagram Export: Export clean PNG diagrams of your ray-tracing bench with a single click for lab reports, problem sets, and presentations.
- Private Browser Execution: Processes locally in your browser — no files, code, or simulation parameters are uploaded to our server.
Scientific Principles & Governing Equations
1. The Law of Reflection
When a light ray strikes a smooth specular boundary between two optical media, the reflected ray remains in the plane of incidence, and the angle of reflection equals the angle of incidence:
θᵢ = θᵣ
Both angles are strictly measured with respect to the surface normal (the perpendicular line to the boundary at the point of incidence).
2. Snell’s Law of Refraction
When light travels across an interface between two transparent media with differing refractive indices (n₁ and n₂), its phase velocity changes, causing the wavefront to bend according to Snell’s Law (also known as the Snell-Descartes law):
n₁ × sin(θ₁) = n₂ × sin(θ₂)
Solving for the angle of refraction (θ₂):
θ₂ = arcsin((n₁ / n₂) × sin(θ₁))
- When light enters an optically denser medium (n₂ > n₁), the refracted ray bends toward the normal (θ₂ < θ₁).
- When light enters an optically rarer medium (n₂ < n₁), the refracted ray bends away from the normal (θ₂ > θ₁).
3. Critical Angle & Total Internal Reflection (TIR)
When light propagates from an optically denser medium into a less dense medium (n₁ > n₂), increasing the angle of incidence causes the refracted angle θ₂ to approach 90°. The angle of incidence for which the refracted ray grazes the boundary at exactly θ₂ = 90° is known as the critical angle (θ_c):
n₁ × sin(θ_c) = n₂ × sin(90°) = n₂ × 1
θ_c = arcsin(n₂ / n₁)
If the angle of incidence exceeds the critical angle (θ₁ > θ_c), refraction is mathematically impossible (sin(θ₂) would exceed 1). All incident energy is reflected back into the denser medium—a phenomenon termed Total Internal Reflection (TIR). Total internal reflection is the foundational physics mechanism enabling:
- Endoscopic medical imaging bundles
- Long-distance fiber-optic telecommunications with near-zero transmission loss
- The brilliance and fire of faceted gemstones and diamonds
- Binocular erecting prisms (Porro and roof prisms)
4. Chromatic Dispersion & Cauchy’s Formula
In vacuum, all wavelengths of electromagnetic radiation travel at the exact same speed: c = 299,792,458 m/s. In physical matter, however, the refractive index varies as a function of the vacuum wavelength (λ). For transparent optical media in the visible spectrum, this dispersion is accurately approximated by Cauchy’s equation:
n(λ) = A + (B / λ²)
Because violet light (λ ≈ 400 nm) has a shorter wavelength than red light (λ ≈ 700 nm), the denominator (λ²) is significantly smaller for violet photons, resulting in a higher refractive index:
n_violet > n_blue > n_green > n_yellow > n_orange > n_red
According to Snell’s law, a higher refractive index produces a larger deviation angle. Consequently, when white light enters and exits a triangular glass prism, shorter violet wavelengths bend more sharply than longer red wavelengths, dispersing the beam into the familiar continuous rainbow spectrum.
5. The Gaussian Thin Lens Equation
For lenses whose axial thickness is negligible compared to their radii of curvature and focal lengths, the relationship between focal length (f), object distance (dₒ), and image distance (dᵢ) is given by the Gaussian thin lens equation:
(1 / f) = (1 / dₒ) + (1 / dᵢ)
Solving for image distance (dᵢ):
dᵢ = (f × dₒ) / (dₒ - f)
Transverse Linear Magnification (M)
The ratio of the image height (hᵢ) to the object height (hₒ) is determined by similar geometric triangles:
M = (hᵢ / hₒ) = -(dᵢ / dₒ)
Standard Cartesian Sign Conventions:
- Focal Length (f): Positive (+) for converging (convex) lenses; negative (-) for diverging (concave) lenses.
- Object Distance (dₒ): Positive (+) for real objects positioned in front of the lens.
- Image Distance (dᵢ): Positive (+) for real images formed behind the lens (which can be projected onto a physical screen); negative (-) for virtual images formed on the same side as the object (which cannot be projected).
- Magnification (M): Positive (+) indicates an erect (upright) virtual image; negative (-) indicates an inverted real image. Absolute value |M| > 1 indicates enlargement, while |M| < 1 indicates reduction.
- Optical Power (P): Measured in diopters (D = m⁻¹), defined as P = 1 / f (with focal length expressed in meters).
Step-by-Step Guide: How to Use the Simulator
Step 1: Select an Experimental Preset
Open the Optical Bench Studio tab and choose one of the five preconfigured optical laboratories:
- Snell’s Refraction & TIR: A planar horizontal boundary separating Medium 1 (top) and Medium 2 (bottom).
- Prism Chromatic Dispersion: An equilateral triangular glass prism demonstrating two-stage wavelength splitting into a 7-color spectral fan.
- Convex Lens: A biconvex converging lens focusing parallel rays toward a focal point.
- Concave Lens: A biconcave diverging lens spreading parallel rays outward from a virtual focal point.
- Plane Mirror: A reflective horizontal planar mirror verifying θᵢ = θᵣ.
Step 2: Adjust Beam Angle and Position
- Angle Slider or Dial: Adjust the incident ray angle from 0° (normal perpendicular incidence) to 85° (glancing incidence).
- Interactive Canvas Dragging: Click and drag the beam source handle directly inside the canvas to reposition the light source interactively.
Step 3: Configure Media Refractive Indices
Choose from pre-calibrated optical materials or adjust the continuous refractive index slider (n = 1.000 to 2.500):
- Air / Vacuum: n = 1.000
- Water: n = 1.333
- Acrylic (PMMA): n = 1.490
- Crown Glass: n = 1.520
- Dense Flint Glass: n = 1.660
- Diamond: n = 2.417
Step 4: Inspect Live Physics Readouts
Review the real-time telemetry panel below the canvas:
- Incident Angle (θ₁): Exact angle of the incoming ray relative to the surface normal.
- Refracted Angle (θ₂): Exact angle of the transmitted ray inside Medium 2.
- Critical Angle (θ_c): Computed threshold angle for total internal reflection when n₁ > n₂.
- Speed of Light: Phase velocity inside the selected medium in km/s and as a percentage of c.
Step 5: Solve Geometric Optics in the Lens Equation Lab
Switch to the Lens Equation Lab tab to calculate focal mechanics:
- Choose between a Converging (Convex) or Diverging (Concave) lens.
- Enter the focal length (f) and object distance (dₒ).
- Review instant calculation of image distance (dᵢ), magnification factor (M), image nature (Real vs Virtual), orientation (Inverted vs Upright), and optical power in diopters (D).
Verified Calculation Examples
Example 1: Refraction from Air into Crown Glass
- Given: Medium 1 is Air (n₁ = 1.000), Medium 2 is Crown Glass (n₂ = 1.520), Incident Angle θ₁ = 45.0°.
- Calculation:
- sin(θ₂) = (n₁ / n₂) × sin(θ₁) = (1.000 / 1.520) × sin(45°) = 0.6579 × 0.7071 = 0.4652
- θ₂ = arcsin(0.4652) = 27.72°
- Speed of light in glass: v = c / n₂ = 299,792 km/s / 1.520 = 197,232 km/s (65.8% of c).
- Result: The light ray refracts toward the normal at 27.72°.
Example 2: Critical Angle for Water-Air Boundary
- Given: Medium 1 is Water (n₁ = 1.333), Medium 2 is Air (n₂ = 1.000).
- Calculation:
- θ_c = arcsin(n₂ / n₁) = arcsin(1.000 / 1.333) = arcsin(0.7502) = 48.61°
- Interpretation:
- For incident angles θ₁ < 48.61°, light refracts into air away from the normal.
- At θ₁ = 48.61°, the refracted ray skims the surface at θ₂ = 90.0°.
- For incident angles θ₁ > 48.61° (e.g., 55°), 100% of the light undergoes Total Internal Reflection.
Example 3: Real Image Formation by a Convex Lens
- Given: Converging lens with focal length f = +15.0 cm, object placed at dₒ = +30.0 cm.
- Calculation:
- (1 / dᵢ) = (1 / f) - (1 / dₒ) = (1 / 15) - (1 / 30) = (2 / 30) - (1 / 30) = 1 / 30
- dᵢ = +30.0 cm
- Magnification M = -(dᵢ / dₒ) = -(30.0 / 30.0) = -1.00×
- Optical Power P = 1 / (0.15 m) = +6.67 Diopters
- Result: A real, inverted image with identical height (|M| = 1.00) is formed 30 cm behind the lens (at 2f).
Frequently Asked Questions (FAQ)
What is the difference between geometric optics and physical optics?
Geometric (ray) optics treats light as straight-line rays that travel in homogeneous media and change direction upon reflection or refraction at boundaries. It is valid whenever optical apertures, lenses, and mirrors are significantly larger than the wavelength of light (λ ≈ 400–700 nm). Physical (wave) optics accounts for the electromagnetic wave nature of light, explaining phenomena such as diffraction, interference, polarization, and thin-film iridescence.
Why does light bend when entering a different material?
Light refracts because its phase velocity changes when transitioning between media of differing optical densities. While the temporal frequency of the electromagnetic wave remains strictly invariant, its wavelength shrinks (λ_medium = λ_vacuum / n) inside denser media. By Fermat’s Principle of Least Time, light traverses the path that minimizes travel time, which mathematically produces the angle prescribed by Snell’s Law.
Can total internal reflection occur when light moves from air into water?
No. Total internal reflection can only occur when light attempts to travel from an optically denser medium (higher refractive index n₁) into an optically rarer medium (lower refractive index n₂). When light enters water from air (n₁ = 1.000 < n₂ = 1.333), the refracted ray always bends toward the normal, meaning sin(θ₂) = (n₁ / n₂) × sin(θ₁) is always strictly less than 1 for any valid physical incidence angle.
Why does a diamond sparkle more brilliantly than glass?
Diamond has an exceptionally high refractive index (n ≈ 2.417) compared to standard glass (n ≈ 1.520). Because critical angle θ_c = arcsin(1 / n), diamond’s critical angle is a remarkably small 24.4°, compared to 41.1° for glass. Master jewelers facet diamonds specifically so that incoming light rays strike interior facet boundaries at angles exceeding 24.4°, causing light to bounce repeatedly via total internal reflection before exiting through the top crown facets with intense brilliance and chromatic fire.
How does a concave (diverging) lens form an image?
A concave lens always spreads parallel incident rays outward away from the optical axis. Extending these diverged rays backward produces a common intersection point on the same side of the lens as the object. As a result, for all real object positions, a concave lens always produces a virtual, upright, and diminished (|M| < 1) image located between the lens and the focal point.