Point

class Point @JvmOverloads constructor(val x: Double = 0.0, val y: Double = 0.0, val z: Double = 0.0)

A point in 3D isometric space.

The coordinate system is: - x: right-and-down on screen (increases toward bottom-right)

  • y: left-and-down on screen (increases toward bottom-left)

  • z: straight up on screen (increases upward)

See also

for painter's algorithm sorting

Constructors

Link copied to clipboard
constructor(x: Double = 0.0, y: Double = 0.0, z: Double = 0.0)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
val x: Double
Link copied to clipboard
val y: Double
Link copied to clipboard
val z: Double

Functions

Link copied to clipboard
fun depth(): Double

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

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.

Link copied to clipboard
open operator override fun equals(other: Any?): Boolean
Link copied to clipboard
open override fun hashCode(): Int
Link copied to clipboard
operator fun minus(other: Point): Vector

Returns the Vector from other to this point.

operator fun minus(vector: Vector): Point

Translates this point by the negation of vector.

Link copied to clipboard
operator fun plus(other: Point): Point

Returns a new point with each coordinate summed.

operator fun plus(vector: Vector): Point

Translates this point by vector.

Link copied to clipboard
fun rotateX(origin: Point, angle: Double): Point

Rotate about origin on the X axis.

Link copied to clipboard
fun rotateY(origin: Point, angle: Double): Point

Rotate about origin on the Y axis.

Link copied to clipboard
fun rotateZ(origin: Point, angle: Double): Point

Rotate about origin on the Z axis.

Link copied to clipboard
fun scale(origin: Point, dx: Double): Point

Uniform scale by dx relative to origin.

fun scale(origin: Point, dx: Double, dy: Double): Point

Scales X by dx and Y by dy relative to origin (Z unchanged).

fun scale(origin: Point, dx: Double, dy: Double, dz: Double): Point

Scale a point about a given origin.

Link copied to clipboard
operator fun times(scalar: Double): Point

Scales all coordinates by scalar.

Link copied to clipboard
open override fun toString(): String
Link copied to clipboard
fun Point.toTileCoordinate(tileSize: Double = 1.0, originOffset: Point = Point.ORIGIN): TileCoordinate

Converts a continuous world Point to the TileCoordinate of the tile cell that contains it.

Link copied to clipboard
fun translate(dx: Double, dy: Double, dz: Double): Point

Translate a point by the given deltas.

Link copied to clipboard
operator fun unaryMinus(): Point

Negates all coordinates.