‹ BackHN Continuity

Thread

Divide by depth for instant 3D

219 points · 39 comments · gabrieloc

  1. tmoertel · · focus · HN ↗
    The explanation of "What's that extra 1 for?" in the column representation of 3-d coordinates (x y z 1) could benefit from mentioning that translation—moving things—is not a linear transformation (the origin is not mapped to itself) but an affine transformation. Therefore, you cannot represent translation in 3-d space with a 3x3 matrix. What you can do, though, is embed that 3-d space within a 4-d space fixed at some coordinate on its 4th dimension, typically w=1. Then, a translation in the original 3-d space can be represented as a linear transformation in the 4-d space and thus can also be represented by a 4x4 matrix multiplication. So the extra 1 is actually what allows all common 3-d operations, including translation, to be done via linear algebra and thereby harness the brutal power of matrix multiplication on modern computing devices.
    1. ggambetta · · focus · HN ↗
      You can do rotations and translations "via linear algebra" without homogeneous coordinates (the 4-element tuple representing a 3d point or vector), since adding two vectors is linear algebra.

      What this lets you do is composing multiple transforms into one matrix multiplication instead of a sequence of multiplications and additions; that's what dramatically increases performance, on modern computing devices but most especially on ancient ones, where we were fighting for every MUL.

      More details: <a href="https:&#x2F;&#x2F;gabrielgambetta.com&#x2F;computer-graphics-from-scratch&#x2F;10-describing-and-rendering-a-scene.html#the-transform-matrix" rel="nofollow">https:&#x2F;&#x2F;gabrielgambetta.com&#x2F;computer-graphics-from-scratch&#x2F;1...

      1. yeoyeo42 · · focus · HN ↗
        its linear algebra but not a linear transformation. repeat: translations are not linear transformations in 3d.
Open on Hacker News to reply ↗

Unofficial Hacker News client; not affiliated with Y Combinator.