O'Reilly logo

Learning Processing by Daniel Shiffman

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 14. Translation and Rotation (in 3D!)

 

“What is the Matrix?”

 
 -- Neo

In this chapter:

  • 2D and 3D translation.

  • Using P3D and OPENGL.

  • Vertex shapes.

  • 2D and 3D rotation.

  • Saving the transformation state in the stack: pushMatrix() and popMatrix().

The Z-Axis

As we have seen throughout this book, pixels in a two-dimensional window are described using Cartesian coordinates: an X (horizontal) and a Y (vertical) point. This concept dates all the way back to Chapter 1, when we began thinking of the screen as a digital piece of graph paper.

In three-dimensional space (such as the actual, real-world space where you are reading this book), a third axis (commonly referred to as the Z -axis) refers to the depth of any given point. In a Processing sketch’s window, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required