@@ -42,10 +42,10 @@ the projective dimension. In order to explain it, we'll use a 1-dimensional
42
42
space where point coordinates are single scalars indicating the position of the
43
43
points onto the X-axis. This will make everything clearer hopefully.
44
44
45
- Let us consider for example a simple set of point `[-1.0, -0.5, 0.0, +0.5,
45
+ Let us consider for example a simple set of points `[-1.0, -0.5, 0.0, +0.5,
46
46
+1.0] ` in this unidimensional space. We want to project onto another segment
47
- `[-2,+2] ` that represent the screen (any point projected outside this segment
48
- is discared and won't be visible into the final projection) The question now is
47
+ `[-2,+2] ` that represents the screen (any point projected outside this segment
48
+ is discared and won't be visible into the final projection). The question now is
49
49
how do we project the points onto the screen?
50
50
51
51
.. figure :: images/chapter-04/1D-H-Coordinates.png
@@ -66,7 +66,7 @@ and default value of 1 for all the `w` such that our new point set is now
66
66
`[(-1.0,1.0), -(0.5,1.0), (0.0,1.0), (+0.5,1.0), (+1.0,1.0)] `. Reciprocally, a
67
67
point `(x,w) ` in projective space corresponds to the point `x/w ` (if `w ` ≠ 0)
68
68
in our unidimensional Euclidean space. From this conversion, we can see
69
- immediately that there exist actually an infinite set of homogenous coordinates
69
+ immediately that there exists actually an infinite set of homogenous coordinates
70
70
that correspond to a single Cartesian coordinate as illustrated on the figure.
71
71
72
72
.. figure :: images/chapter-04/1D-Projection.png
@@ -86,20 +86,20 @@ Projections
86
86
+++++++++++
87
87
88
88
We are now ready to project our point set onto the screen. As shown on the
89
- figure above, we can use an orthographic (all rays are parallels ) or a linear
89
+ figure above, we can use an orthographic (all rays are parallel ) or a linear
90
90
projection (rays originate from the camera point and hit the screen, passing
91
91
through points to be projected). For these two projections, results are similar
92
92
but different. In the first case, distances have been exactly conserved while
93
93
in the second case, the distance between projected points has increased, but
94
94
projected points are still equidistant. The third projection is where
95
95
homogenous coordinates make sense. For this (arbitrary) projection, we decided
96
- that the further the point is from the origin, and the further away from the
96
+ that the further the point is from the origin, the further away from the
97
97
origin its projection will be. To do that, we measure the distance of the point
98
98
to the origin and we add this distance to its `w ` value before projecting it
99
99
(this corresponds to the black circles on the figure) using the linear
100
100
projection. It is to be noted that this new projection does not conserve the
101
101
distance relationship and if we consider the set of projected points `[P(-1.0),
102
- P(-0.5), P(0.0), P(+0.5), P(+1.0)] `, we have have `║P(-1.0)-P(-0.5)]║ >
102
+ P(-0.5), P(0.0), P(+0.5), P(+1.0)] `, we have `║P(-1.0)-P(-0.5)]║ >
103
103
║P(-0.5)- P(0.0)║ `.
104
104
105
105
@@ -155,7 +155,7 @@ consider a vector to be 4 rows and 1 columns, meaning transformations happen on
155
155
the left side of vectors. To transform a vertex V by a transformation matrix M,
156
156
we write: V' = M*V. To chain two transformations M1 and M2 (first M1, then M2),
157
157
we write: V' = M2*M1*V which is different from V' = M1*M2*V because matrix
158
- multiplication is not communative . As clearly illustrated on the right figure ,
158
+ multiplication is not commutative . As clearly illustrated by the figure on the right,
159
159
this means for example that a rotation followed by a translation is not the
160
160
same as a translation followed by a rotation.
161
161
@@ -222,7 +222,7 @@ corresponding matrix is given below:
222
222
Scaling
223
223
+++++++
224
224
225
- Considering a vertex `V = (x, y, z, 1) ` and a scaling vector `T = (sx, sy, sz,
225
+ Considering a vertex `V = (x, y, z, 1) ` and a scaling vector `S = (sx, sy, sz,
226
226
0) `, the scaling of `V ` by `S ` is `(sx*x, sy*y, sz*z, 1) `. The corresponding
227
227
matrix is given below:
228
228
@@ -309,8 +309,8 @@ A word of caution
309
309
OpenGL uses a `column-major representation
310
310
<https://www.opengl.org/archives/resources/faq/technical/transformations.htm> `_
311
311
of matrices. This mean that when reading a set of 16 contiguous
312
- values in memory, the first 4 values corresponds to the first column while in
313
- Numpy (using C default layout), this would corresponds to the first row. In
312
+ values in memory, relative to a 4×4 matrix, the first 4 values correspond to the first column while in
313
+ Numpy (using C default layout), this would correspond to the first row. In
314
314
order to stay consistent with most OpenGL tutorials, we'll use a column-major
315
315
order in the rest of this book. This means that any glumpy transformations will
316
316
appear to be transposed when displayed, but the underlying memory
@@ -374,7 +374,7 @@ GPU, but you would use on the right with Python/NumPy:
374
374
Projections
375
375
-------------------------------------------------------------------------------
376
376
377
- In order to define a projection, we need to specify first what what do we want
377
+ In order to define a projection, we need to specify first what do we want
378
378
to view, that is, we need to define a viewing volume such that any object
379
379
within the volume (even partially) will be rendered while objects outside
380
380
won't. On the image below, the yellow and red spheres are within the volume
@@ -425,7 +425,7 @@ Perspective
425
425
426
426
At this point, it is not necessary to understand how these matrices were
427
427
built. Suffice it to say they are standard matrices in the 3D world. Both
428
- suppose the viewer (=camera) is located at position (0,0,0) and is looking in
428
+ assume the viewer (=camera) is located at position (0,0,0) and is looking in
429
429
the direction (0,0,1).
430
430
431
431
There exists a second form of the perpective matrix that might be easier to
@@ -453,8 +453,8 @@ Model and view matrices
453
453
+++++++++++++++++++++++
454
454
455
455
We are almost done with matrices. You may have guessed that the above matrices
456
- requires the viewing volume to be in the z direction. We could design our 3D
457
- scene such that all objects are withing this direction but it would not be very
456
+ require the viewing volume to be in the z direction. We could design our 3D
457
+ scene such that all objects are within this direction but it would not be very
458
458
convenient. So instead, we use a view matrix that maps the world space to
459
459
camera space. This is pretty much as if we were orienting the camera at a given
460
460
position and look toward a given direction. In the meantime, we can further
0 commit comments