The Wolfram Mathematic notebook which contains the code that produces all the Mathematica output in this web page may be downloaded at this link.
Caution: This notebook will evaluate, cell-by-cell, sequentially, from top to bottom. However, due to re-use of variable names in later evaluations, once subsequent code is evaluated prior code may not render properly. Returning to and re-evaluating the first Clear[ ] expression above the expression no longer working and evaluating from that point through to the expression solves this problem.
$Post :=
If[MatrixQ[#1],
MatrixForm[#1], #1] & (* outputs matricies in MatrixForm*)
Remove[ "Global`*"] // Quiet (* remove all variables *)
In three-dimensional real space ℝ³, it is possible to implement the same strategy as in 2D and define
primitive linear transformations of scaling, orthographic projection, reflection, rotation, and shearing. However, due to diversity of these basic transformations, it is difficult to classify and illustrate all possible cases within every basic transformation. It turns out that we can successfully visualize only two kinds of primitive transformations---projections (this topic will be discussed later in detail) and rotations---when objects are transformed as whole while the coordinate space remains stationary.
3D Transformations
Once matrices corresponding to primitive linear transformations are identified, we can multiply these matrices to obtain corresponding compositions of transformations. This is the main reason why we are working with matrices as linear operators.
Scaling in 3D space
We start with scaling along the cardinal axes.
For example, scaling along the cardinal axes can be determined by the matrix that is a product of simple scaling matrices:
where the order of multiplications at the right-hand side does not matter. As you see from the formula above, a general nonuniform scaling along the cardinal axes can be reduces to composition of simple scaling transformations with respect to a single axis.
code: make an example
■
End of Example 1
We can construct a general scale matrix along a particular vector, which direction is identified by a unit vector \( \displaystyle \hat{\bf n} = \left( n_x , n_y , n_z \right) . \) To achieve this, we go ahead following the procedure described in the previous section.
Suppose we want to scale by factor k in the directions identified by vector n. This operation we accomplish by matrix multiplication
Any vector perpendicular to n is not affected by scale operation, therefore, v = x⊥ + v∥. Since
x∥ is parallel to the direction of scale then
v∥ = kx∥
Reconstructing the solution from the observations above
Based on numerical value of parameter
k ∈ ℝ to be either greater than 1 of less than 1, this scaling transformation defines an amount to be enlarged or shrinked.
Shearing is a transformation that skews the coordinate space.
We abbreviate shear matrices with Cyrillic letter "Ш," which is pronounced as "sha" in English or "ch" in French. Shear 2-by-2 matrices can operate either on column vectors from left or on row vectors from right. We distinguish these operators by writing them in either brackets of in parentheses;
\begin{equation} \label{EqShear.1}
{\bf Ш}_{xy} = \begin{bmatrix} 1 & 0&\alpha \\ 0 & 1 &\beta \\ 0&0&1 \end{bmatrix} \quad \Longrightarrow \quad {\bf Ш}_{xy} (\alpha , \beta ) \begin{pmatrix} x \\ y \\ z \end{pmatrix} = \begin{bmatrix} x + \alpha \,z \\ y + \beta\, z \\ z \end{bmatrix} .
\end{equation}
<
Similarly, a shear matrix acting on row vectors from right is
Anton, Howard (2005), Elementary Linear Algebra (Applications Version) (9th ed.), Wiley International
Dunn, F. and Parberry, I. (2002). 3D math primer for graphics and game development. Plano, Tex.: Wordware Pub.
Foley, James D.; van Dam, Andries; Feiner, Steven K.; Hughes, John F. (1991), Computer Graphics: Principles and Practice (2nd ed.), Reading: Addison-Wesley, ISBN 0-201-12110-7