This was a simple program I wrote that Displays 3D points. It does so by simply projecting a 3D (vector) into 2D.

The Jar file can be downloaded here: Graph3D.jar

The C/C++ version can be found here

Before looking at the source, let’s take a look at some of the fundamental mathematics behind the software.

**rotations** – Rotations in this software simple geometric transformations based around an unmoving center axis. Below are the three rotation matrices for each axis, X, Y, and Z, respectively. Every operation can be found in Transform.java below.

**Rotate Around X,Y, or Z Axis**

It is also important to know that every point in our world is defined by:

This can be seen in Point3D.java below. (Which is synonymous to a Vector in this application.)

**Rotate Around Arbitrary Axis**

The above rotations are all rotations about either the X,Y, or Z axises. But another common and more complicated rotation is to rotate Vector/Point A around Vector/Point B.

Here are the Steps:

1. the Vector that is being rotated around must be NORMALIZED.

this can be done very easily

1a. | 1b. |

2. next, using quaternions, perform the rotation.

Where:

2a.

( is in radians)

The rotation matrix evaluates to the following:

2b.

**Example:** Suppose we have point

and we would like to rotate by 30° around the X axis.

And finally, to project the 3D points onto a 2D canvas after performing a rotation, a simple way is to simply ignore the Z coordinate and draw the point based on it’s X and Y coordinates. However this is assuming that you’re projecting it on to the screen as if you are looking straight at it.

The source code can be found below as well as being bundled into the Jar file.

Cube 3D – A simple 3D Cube engine that demonstrates the usage of ALL the above mentioned equations.

Transform3D.java – This is a simple version using a 3×3 matrix. Using a 4×4 matrix you can also store the translation information. This is useful when trying to program a skeleton represented by vectors.

(Also, check out Graph/Rotate4D here

Other included source:

Thank you for sharing. I came to this site to read how things really are

[...] 3D Rotation Matrix – Graph 3D [...]

[...] 3D Rotation Matrix – Graph 3D [...]

Thanks for this very helpful page.

Please note that formula 2a is erroneous. The numbers on the matrix diagonal should all be squared, i.e. q0^2+q1^2-q2^2-q3^2 etc.

I haven’t used the programming code so I have no idea if the code is okay.

>iceblink

The code was correct, just my comments were wrong, and I wrote this blog based off my code comments, It has been updated. Thanks again.

[...] 3D Rotation Matrix – Graph 3D [...]

History Of Animation…[...]3D Rotation Matrix – Graph 3D | Ken-Soft[...]…

ttagg.com uses an invalid security certificate.

The certificate is only valid for the following names:

datarank.com , http://www.datarank.com

(Error code: ssl_error_bad_cert_domain)

Thanks, I’ll look into it.