Theme Catppuccin
Make yourself at homeCatppuccin

A softer light for long learning sessions.

Appearance

Loading your preference…

Dark palette

Choose a dark palette to try it.

Light uses Latte. Your choices stay in this browser.

Vectors, then rays

SKETCHBOOK / 03 The geometry bench · 2-week chapter

Page 1 of 3: Three numbers need a meaning

Make the mathematics visible

Three numbers need a meaning

A 3D vector stores three components. Adding vectors adds matching components; multiplying by a scalar changes their scale. A position, a direction, and an RGB color can each have three numbers, but they play different roles. Do not normalize a position or treat a display color as a distance merely because the representations look alike.

The dot product multiplies matching components and adds them. dot(v, v) is the squared length. The sign of dot(a, b) tells you whether two directions broadly point together or apart. Once both are unit vectors, their dot product is the cosine of their angle.

Small math types make good value types. Pass a small vector by value, return results by value, and keep calculations separate from file access and scene construction. This makes each operation easy to inspect and test.

F.16Pass small input values by value.
From the page to your own work

Your studio assignment.

Connect three vector operations to a ray you can draw.

A finish line you can see

Your own small vector tests and a ray/sphere sketch with one independently calculated hit or miss.

  1. Test dot products for parallel and perpendicular directions.
  2. Handle the zero-vector normalization case deliberately.
  3. Add one new geometric test rather than copying the reference test.
  4. Explain whether your ray parameter is a distance and why.
Keep the evidence in your weekly notebook ↗
Explain it like an engineer

Try answering aloud before opening the review notes. Use your own implementation as evidence.

Why does normalizing a ray direction change the meaning of t?
  • Write origin + t × direction.
  • Relate traveled distance to |t| times direction length.
  • State the supported nonzero, finite-vector contract.

These prompts support practice; they are not an automatic assessment of your work.

A small creative variation ↗

Move the ray origin inside a sphere and identify the positive exit root by hand.

Optional. Save it for later if this chapter already feels full.

Coming back after a break? ↩

Use the vector (0, 3, 4). Compute its length on paper and run only its normalization test.

Books & principles behind this study +

Original Parallax explanations and assignments, with these works for further reading.

YOUR MARGIN NOTES

Leave yourself a good question.

What changed your mind? What would you try next?

Notes are private to this browser and saved as you write.

A CHECKPOINT, NOT A SCORE

Can you explain the idea and try the exercise yourself?

Completion records your own assessment. It does not compile or test your C++.
Companion source 3 files