Path

open class Path(points: List<Point>)

Represents a polygon face in 3D space, defined by an ordered list of vertices.

A Path requires at least 3 points and is used as the fundamental rendering primitive: each face of a Shape is a Path. Paths are immutable; all transform methods return new instances.

A variadic constructor Path(vararg points: Point) is provided for convenient inline construction.

The depth property is the average depth of all vertices, used for back-to-front sorting during rendering. Note that this is a sorting metric and is unrelated to the depth parameter on shape classes like io.github.jayteealao.isometric.shapes.Prism.

Parameters

points

The ordered vertices of this polygon (minimum 3)

Inheritors

Constructors

Link copied to clipboard
constructor(points: List<Point>)
constructor(vararg points: Point)

Properties

Link copied to clipboard

Average depth of all points in this path, precalculated at construction time. Uses the default 30° angle.

Link copied to clipboard

Functions

Link copied to clipboard
fun closerThan(pathA: Path, observer: Point): Int

If pathB ("this") is closer from the observer than pathA, it must be drawn after. It is closer if one of its vertices and the observer are on the same side of the plane defined by pathA.

Link copied to clipboard
fun depth(angle: Double): Double

Average depth for an arbitrary engine angle.

Link copied to clipboard
fun reverse(): Path

Returns a new path with the points in reverse order

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

Rotate about origin on the X axis

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

Rotate about origin on the Y axis

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

Rotate about origin on the Z axis

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

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

Scale about a given origin

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

Translate the path by the given deltas