← Optics

🔍 2D Ray Diagram

f 110 do 220 h 70
Drag the cyan object arrow — sideways to change distance, up/down to change its height

📐 Image

Image dist di—
Magnification—
Image height—
Real · Inverted
Rays: 🔴 parallel → through F′   🟢 through centre → straight   🔵 through F → parallel. Dashed = virtual extension.

🔍 2D Ray Diagram — Mirrors & Lenses Optical Bench

A flat 2D optics bench built for direct manipulation: drag the object itself instead of only reading numbers off sliders, and watch the three principal rays — parallel, focal and centre — get re-drawn from the real geometry on every frame. The image position, size and orientation are not decorative; they come straight out of the thin-lens/mirror equation 1/f = 1/do + 1/di and the magnification m = -di/do.

🔬 What it demonstrates

Choosing a converging or diverging lens or mirror sets the sign of f. The bench solves 1/di = 1/f - 1/do for the exact image distance, then derives magnification and image height, exactly like the 3D ray-tracer this page pairs with — but here you push the object around with your own hand.

🎮 How to use

Drag the cyan object arrow left/right to change its distance from the element, or up/down to resize it. Use the dropdown to switch between converging lens, diverging lens, concave mirror and convex mirror, and the f slider to change focal length. The right-hand panel updates image distance, magnification and height live.

💡 Did you know?

Drag the object inside the focal length of a converging lens and the image flips from real/inverted to virtual/upright and grows larger — that single crossing is exactly how a magnifying glass and a slide projector use the same lens for opposite jobs.

Frequently asked questions

Why can I drag the object here but not in the 3D version?

This 2D bench is built for direct manipulation: the object's position and height are driven by pointer coordinates converted straight into the same optics equations, so dragging is just another way of setting do and object height alongside the sliders.

How is the image position actually computed?

Every frame it reads the current focal length, object distance and object height, applies the sign convention (converging f > 0, diverging f < 0), solves 1/di = 1/f - 1/do, and derives magnification m = -di/do and image height m×h. Nothing about the image is pre-set — it is recomputed from the live geometry.

What do the three coloured rays mean?

Red travels parallel to the axis then bends through the far focal point F′. Green passes straight through the optical centre (or centre of curvature for a mirror) undeviated. Blue aims through the near focal point F and exits parallel to the axis. Dashed segments are virtual backward extensions used to locate virtual images.

Why do some drags make the image disappear?

When the object sits exactly at the focal length, 1/di = 1/f - 1/do becomes zero, so the image forms at infinity — the rays exit exactly parallel and never converge on either side, which is why the panel shows "At infinity" instead of a distance.