3D Transformations

PushMatrix()/PopMatrix() (from Transformations) work exactly as before, and now also save/restore the 3D model matrix alongside the 2D one. Everything below composes the usual way: each call prepends to the current matrix, so Translate() then RotateX() rotates around the already-translated origin, not the world origin.

3D renderer

On this page · 4 entries

Translate

  • Translate(x, y, float z)

3D translate. The 2D Translate(x, y) overload still works under Renderer3D too — z is implicitly 0, matching Processing.

RotateX · RotateY · RotateZ

  • RotateX(radians)
  • RotateY(radians)
  • RotateZ(radians)

Rotates around each axis. Like every angle in DanaProcessing, these take radians. Under Renderer3D both exist and compose: Rotate() rotates the Skia 2D overlay, RotateZ() rotates 3D geometry — they're genuinely different operations.

Scale

  • Scale(x, y, float z)

3D scale.

Rotate

  • Rotate(float angleRadians, x, y, z)

Rotates by angleRadians around the arbitrary axis (x, y, z) — the P3D-only overload of rotate(). Takes radians, like RotateX/Y/Z() and the 2D Rotate(). The axis doesn't need to be pre-normalized; a zero-length axis is a no-op.

One combined rotation beats three stacked ones. RotateX()+RotateY()+RotateZ() compose differently depending on call order, and can twist in unexpected ways once an object is no longer near its rest orientation (the classic gimbal-lock feel). A single axis-angle Rotate() — typically derived from an accumulated quaternion for a trackball-style drag — sidesteps that entirely. See the "Gema facetada" sample's ApplySpin() helper for the pattern.