2D cross sections of a 3D rotating cuboid


If you’re unfamiliar with the concept and/or ideas of flatland, this post might not make a lot of sense to you. If you don’t want to read up on flatland, here’s a nice image which does a (decent) job of visualizing the concept behind this post:

Consider a cuboid with the dimensions X,Y,Z along the three spacial dimensions. Imagine taking said cuboid and slowly descending it through a 2-dimensional plane. How would this look?

If we merely took a 1x1x1 cuboid without any rotation, this would be a square popping in and out of existence  obviously. But how would this look if we allow the cube to rotate?

We define an initial rotation on the cube across the 3 dimensions (XY, XZ, YZ) and a gradual rotation (XY, XZ, YZ) as well. The cube will be rotated around its center-point, as it’s the most intuitive to do so.

If you don’t want the mathematical details, you can download the .jar file here:

Download link

We define the 8 vertices of the cuboid as 8 3-dimensional vectors positioned according to the center of the cube. We also define a rotation function r(x) for each of the vectors (which is simply a rotational matrix).

Definition: Rotating the cuboid (XY, XZ, YZ) means to rotate each of the 8 vectors (XY, XZ, YZ).

Next up, we need to define a cross-section of the cube at a certain height t.

Definition: A line segment is a line going from a point to another point. In this casevectors. A line segment is a line going from the end of one vector to the end of another vector.

The cuboid contains 12 line segments.

Definition: An intersection is the point where a 3-dimensional line and a 2-dimensional plane at height intersect.

Definition: A cross-section of the cuboid is the set of intersections for each line segment in the cuboid and an infinite 2-dimensional plane (X, Z) at height t (y=t).

We get the cross-section of the cuboid and draw the convex hull of this collection of points.

Going at constant rate for we get an animation of the cuboid going through flatland (rotating the cuboid for each term).

This was really vaguely described, but I don’t really feel like going into too many details.

Advertisements

Comment on this article

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s