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
- Generate polygons/edges
- Modify those points by the current coordinate system
- Draw to the image
Example
rotate
x 90
sphere
-------
ident
rotate
y 30
rotate
z 20
box
- 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 |