aboutsummaryrefslogtreecommitdiffstats
path: root/worksheets/a4_dance.md
diff options
context:
space:
mode:
Diffstat (limited to 'worksheets/a4_dance.md')
-rw-r--r--worksheets/a4_dance.md18
1 files changed, 9 insertions, 9 deletions
diff --git a/worksheets/a4_dance.md b/worksheets/a4_dance.md
index fe174fe..6e0cd85 100644
--- a/worksheets/a4_dance.md
+++ b/worksheets/a4_dance.md
@@ -11,7 +11,7 @@ Here's what the house looks like when viewed from some +Z height above and looki
### Q1.1 Basic translation
Here's a simple translation matrix. Draw a picture of the house to show what it would look like if transformed by this matrix.
-```
+```cpp
Matrix4 trans = Matrix4::Translation(Vector3(0.0, 0.5, 0.0));
```
![House transformed by trans](file path to your image)
@@ -19,7 +19,7 @@ Matrix4 trans = Matrix4::Translation(Vector3(0.0, 0.5, 0.0));
### Q1.2 Basic scaling
Here's a simple scaling matrix. Draw a picture to show what the original house would look like if transformed by this matrix.
-```
+```cpp
Matrix4 scale = Matrix4::Scale(Vector3(2.0, 1.0, 1.0));
```
![House transformed by scale](file path to your image)
@@ -27,7 +27,7 @@ Matrix4 scale = Matrix4::Scale(Vector3(2.0, 1.0, 1.0));
### Q1.3 Basic rotation
Here's a simple rotation matrix. Draw a picture to show what the original house would look like if transformed by this matrix.
-```
+```cpp
Matrix4 rot = Matrix4::RotateZ(GfxMath::toRadians(45.0));
```
![House transformed by rot](file path to your image)
@@ -36,7 +36,7 @@ Matrix4 rot = Matrix4::RotateZ(GfxMath::toRadians(45.0));
### Q1.4 Composition 1
Now, let's take a look at different compositions of the basic matrices above. Draw a picture to show what the original house would look like if transformed by the following matrix.
-```
+```cpp
Matrix4 combo1 = trans * scale * rot;
```
![House transformed by combo1](file path to your image)
@@ -45,7 +45,7 @@ Matrix4 combo1 = trans * scale * rot;
### Q1.5 Composition 2
Let's try another. Draw a picture to show what the original house would look like if transformed by the following matrix.
-```
+```cpp
Matrix4 combo2 = rot * scale * trans;
```
![House transformed by combo2](file path to your image)
@@ -66,7 +66,7 @@ The diagram below illustrates this concept with the simple case of a house. It'
It can be useful in these situations to define transformation matrices for moving from one coordinate space to another. For example, given some point defined in the door's coordinate system, such as one of the vertices of the door, we could transform it into the siding's coordinate system like this:
-```
+```cpp
// Transforms points in the door's coordinate system to the siding's coordinate system.
Matrix4 doorToSiding = Matrix4::Translation(Vector3(0.5, -0.2, 0.0));
@@ -76,7 +76,7 @@ Point3 theSamePtExpressedInSidingSpace = doorToSiding * ptInDoorSpace;
```
Similarly, these matrices can convert between the other spaces we've talked about.
-```
+```cpp
// Transforms points in the siding's coordinate system to the house's coordinate system.
Matrix4 sidingToHouse = Matrix4::Translation(Vector3(0.0, 0.5, 0.0));
@@ -92,7 +92,7 @@ show the combined transformation from Door-Space into World-Space as a matrix
multiplication, then show how to transform the point `pInDoorSpace` into
World-Space. Lastly, show the numeric representation of `pInWorldSpace`.
-```
+```cpp
// The magenta point `p` from the diagram, in Door-Space
Point3 pInDoorSpace = Point3(0.2, 0.4, 0.0);
@@ -105,7 +105,7 @@ Point3 pInWorldSpace = /* --- Fill this in --- */
### Q2.2 Let's double-check your work now by calculate the actual "world space" coordinates for p. Show what the following code would output:
-```
+```cpp
std::cout << "p in World-Space: " << pInWorldSpace << std::endl;
/* --- Fill in output for std::cout here --- */
```