How to use Pivot Point in Transformations

If you have to following rectangle, where the red cross is the center of the world and you want to rotate it around the green pivot

then you’ve to do the following steps:

  • Translate the rectangle in that way that way, that the pivot is on the origin of the world. This is a translation by the vector form the pivot to the origin.

  • Rotate the rectangle

  • Translate the rectangle in that way that the pivot is back at its original position. This is a translation by the vector form the origin to the pivot.

In the following transPivot is a translation matrix, which is defined by the vector from the origin (0, 0) to the pivot point (pivotPos). The pivot is marked by the green cross.
rotation is the rotation matrix around the z-axis:

ModelViewMatrix = transPivot * rotation * -transPivot

-transPivot is the inverse(transPivot) matrix, which is equal the translation matrix by -pivotPos in this case.

Leave a Comment