Skip to content

Latest commit

 

History

History
63 lines (51 loc) · 1.06 KB

0411.md

File metadata and controls

63 lines (51 loc) · 1.06 KB

Relative Coordinate System

Currently, we generate triangles/edges first and then apply transformations to those matricies.

In a RCS, transformations are applied to the "current" coordinate system, which modifies shapes as soon as they are generated.

[1 0 0 0]  [2 0 0 3]
[0 1 0 0]  [0 2 0 1]
[0 0 1 0]  [0 0 2 0]
[0 0 0 1]  [0 0 0 1]
    A          B

Drawing in a RCS

  1. Generate polygons/edges
  2. Modify those points by the current coordinate system
  3. Draw to the image

Example

rotate
x 90
sphere
-------
ident
rotate
y 30
rotate
z 20
box

Coordinate System Stack

  • We will maintain a stack of coordinate systems
  • The bottom will always be the identity matrix
  • Push will push a copy of the current top
  • Transformations will be applied to the top

Example

push
move
box
push
move
sphere
pop

Example

stack should be top*transformation

command stack
push I I
move I*M1 I
box
push I*M1 I*M1 I
rotate I*M1*R I*M1 I