depth

fun depth(): Double

The depth of a point in the isometric projection, used for painter's algorithm sorting.

Formula: x + y - 2 * z

  • Points with higher depth are farther from the viewer and should be drawn first.

  • The z-axis is weighted by 2 because each unit of z moves a point "closer" to the viewer more than one unit of x or y (z is perpendicular to the screen, while x and y are projected at 30-degree angles).

This simplified formula uses equal weighting for x and y. For exact depth at arbitrary projection angles, use depth with an angle parameter.

Note: This is NOT equivalent to depth(PI/6) — the parameterized version uses cos/sin weighting while this uses uniform weighting.

Return

the depth value for sorting; higher = farther from viewer


fun depth(angle: Double): Double

The depth of a point in the isometric plane for an arbitrary engine angle. The formula weights x/y by cos/sin of the projection angle and z by a factor that preserves correct depth ordering for the given viewing angle.

Parameters

angle

The isometric projection angle in radians (e.g., PI / 6 for 30°)