CS-GY 6313 - Information Visualization
New York University
2025-11-07
| User Interface | Graphics Library | Notebook(s) |
|---|---|---|
| observablehq.com | D3 | 3D Visualizations in D3 Example |
Today we will be a exploring the following topics:
| Assignment | Due Date | Details |
|---|---|---|
| Milestone #3: First Draft | Nov. 17 | Initial D3 implementations |
| Mini-Project #2 | Nov. 20 | Temporal Data Visualizations |
Submit an Observable notebook or a Framework project with:
At this stage:
This is your first implementation milestone.
Our data resides within a 2D or 3D space, as viewed by the user through a 2D viewpoint. How the data is projected onto the screen, relative to the viewpoint, is a fundamental operation in most 2D and 3D graphics libraries.
These fundamental operations are crucial in other domains beyond just data visualization, such as video games, virtual reality, interactive computer graphics, and 3D CAD tools.

Ryan Kim and Paul M. Torrens. 2024. Building Verisimilitude in VR With High-Fidelity Local Action Models: A Demonstration Supporting Road-Crossing Experiments. In 38th ACM SIGSIM Conference on Principles of Advanced Discrete Simulation (SIGSIM PADS ’24), June 24–26, 2024, Atlanta, GA, USA. ACM, New York, NY, USA, 12 pages. https://doi.org/10.1145/3615979.3656060

\[ \overrightarrow{AB} = B - A \]
\[ \hat{a} = \frac{\overrightarrow{a}}{\|\overrightarrow{a}\|} \]

\[ \overrightarrow{a} + \overrightarrow{b} = \overrightarrow{b} + \overrightarrow{a} \]

\[ \overrightarrow{a} \cdot \overrightarrow{b} = \|\overrightarrow{a}\|\|\overrightarrow{b}\|\cos{\theta} \]
\[ \cos{\theta} = \frac{\overrightarrow{a} \cdot \overrightarrow{b}}{\|\overrightarrow{a}\|\|\overrightarrow{b}\|} \]

\[ \begin{pmatrix} 1 & 2 & 3 \\ 4 & 5 & 6 \end{pmatrix} \]
\[ \begin{pmatrix}a & b \\ c & d\end{pmatrix} \begin{pmatrix}e & f \\ g & h\end{pmatrix} = \begin{pmatrix} ae + bg & af + bh \\ ce + dg & cf + dh \end{pmatrix} \]
\[ \begin{pmatrix} 1 & 3 \\ 5 & 2 \\ 0 & 4 \end{pmatrix}\begin{pmatrix}3 & 6 & 9 & 4 \\ 2 & 7 & 8 & 3 \end{pmatrix} = \begin{pmatrix}9 & ? & 33 & 13 \\ 19 & 44 & 61 & 26 \\ 8 & 28 & 32 & ? \end{pmatrix} \]
\[ \begin{pmatrix}-1 & 0 \\ 0 & 1\end{pmatrix}\begin{pmatrix}x \\ y\end{pmatrix} = \begin{pmatrix}-x \\ y\end{pmatrix} \]
\[ \begin{bmatrix}x' \\ y'\end{bmatrix} = \begin{bmatrix}s & 0 \\ 0 & s\end{bmatrix}\begin{bmatrix}x \\ y\end{bmatrix} \]
\[ \begin{bmatrix}x' \\ y'\end{bmatrix} = \begin{bmatrix}s_x & 0 \\ 0 & s_y\end{bmatrix}\begin{bmatrix}x \\ y\end{bmatrix} \]
\[ \begin{bmatrix}x' \\ y'\end{bmatrix} = \begin{bmatrix}s_x & 0 \\ 0 & s_y\end{bmatrix}\begin{bmatrix}x \\ y\end{bmatrix} \]
\[ \begin{bmatrix}x' \\ y'\end{bmatrix} = \begin{bmatrix}-1 & 0 \\ 0 & 1\end{bmatrix}\begin{bmatrix}x \\ y\end{bmatrix} \]
\[ R_\theta = \begin{bmatrix}\cos{\theta} & -\sin{\theta} \\ \sin{\theta} & \cos{\theta} \end{bmatrix} \]
\[ \begin{bmatrix}x' \\ y'\end{bmatrix} = \begin{bmatrix}a & b \\ c & d\end{bmatrix}\begin{bmatrix}x \\ y\end{bmatrix} \]
\[ x' = Mx \]
We generally try to minimize transformation operations by relying on single transformation matrix \(M\).
We can perform multiple transformations (e.g. rotation, then scale) in sequence by using multiple \(M\) matrices in sequence. Matrix multiplications occur from right to left and are non-commutative!
\[ \begin{bmatrix}x' \\ y'\end{bmatrix} = \begin{bmatrix}a & b \\ c & d\end{bmatrix} \begin{bmatrix}e & f \\ g & h \end{bmatrix} \begin{bmatrix}x \\ y\end{bmatrix} \]
\[ x' = M_2M_1x \]
\[ \begin{bmatrix}x' \\ y'\end{bmatrix} =\begin{bmatrix}x \\ y\end{bmatrix} + \begin{bmatrix} t_x \\ t_y \end{bmatrix} \]
\[ \begin{bmatrix}x' \\ y'\end{bmatrix} = \begin{bmatrix}a & b \\ c & d\end{bmatrix} \begin{bmatrix}x \\ y\end{bmatrix} + \begin{bmatrix} t_x \\ t_y \end{bmatrix} \]
\[ \begin{bmatrix}x' \\ y' \\ w' \end{bmatrix} = \begin{bmatrix} 1 & 0 & t_x \\ 0 & 1 & t_y \\ 0 & 0 & 1 \end{bmatrix} \begin{bmatrix}x \\ y \\ 1 \end{bmatrix} = \begin{bmatrix} x + t_x \\ y + t_y \\ 1 \end{bmatrix} \]
\[ S(s_x,s_y)=\begin{bmatrix} s_x & 0 & 0 \\ 0 & s_y & 0 \\ 0 & 0 & 1 \end{bmatrix} \]
\[ R(\theta)=\begin{bmatrix} \cos{\theta} & -\sin{\theta} & 0 \\ \sin{\theta} & \cos{\theta} & 0 \\ 0 & 0 & 1 \end{bmatrix} \]
\[ T(t_x,t_y)=\begin{bmatrix} 1 & 0 & t_x \\ 0 & 1 & t_y \\ 0 & 0 & 1 \end{bmatrix} \]
We do the same thing that we did with 2D matrices: add another column! This also means that transformations using homogeneous coordinates involves \(4 \times 4\) matrices.
\[ \begin{bmatrix} x' \\ y' \\ z' \\ 1 \end{bmatrix} = \begin{bmatrix} a & b & c & t_x \\ d & e & f & t_y \\ g & h & i & t_z \\ 0 & 0 & 0 & 1 \end{bmatrix} \begin{bmatrix} x \\ y \\ z \\ 1 \end{bmatrix} \]
\[ S(s_x,s_y,s_z) = \begin{bmatrix} x' \\ y' \\ z' \\ 1 \end{bmatrix} = \begin{bmatrix} s_x & 0 & 0 & 0 \\ 0 & s_y & 0 & 0 \\ 0 & 0 & s_z & 0 \\ 0 & 0 & 0 & 1 \end{bmatrix} \]
\[ S(s_x,s_y,s_z) = \begin{bmatrix} x' \\ y' \\ z' \\ 1 \end{bmatrix} = \begin{bmatrix} 0 & 0 & 0 & t_x \\ 0 & 0 & 0 & t_y \\ 0 & 0 & 0 & t_z \\ 0 & 0 & 0 & 1 \end{bmatrix} \]
We need to consider 3 axes rather than just a singular axis like in 2D…
\[ R_x(\theta) = \begin{bmatrix} 1 & 0 & 0 & 0 \\ 0 & \cos{\theta} & -\sin{\theta} & 0 \\ 0 & \sin{\theta} & \cos{\theta} & 0 \\ 0 & 0 & 0 & 1 \end{bmatrix} \]
\[ R_y(\theta) = \begin{bmatrix} \cos{\theta} & 0 & \sin{\theta} & 0 \\ 0 & 1 & 0 & 0 \\ -\sin{\theta} & 0 & \cos{\theta} & 0 \\ 0 & 0 & 0 & 1 \end{bmatrix} \]
\[ R_z(\theta) = \begin{bmatrix} \cos{\theta} & -\sin{\theta} & 0 & 0 \\ \sin{\theta} & \cos{\theta} & 0 & 0 \\ 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & 1 \end{bmatrix} \]

At its core, the task of rendering 3D data requires a kind of “pipeline” - a series of transformations from one “space” to another, in sequence:
| 1. World Space | 2. View/Camera Space | 4. Projection/Screen Space |
|---|---|---|
| Data points are placed within the 3D “world”. | All points are transformed and are now relative to the camera’s space. | All points are projected onto the 2D screen. |
This MODEL-VIEW-PROJECTION operation is instrumental to all graphics libraries, render engines, etc.
