Shape

open class Shape(val paths: List<Path>)

Represents a 3D shape composed of multiple polygon faces (Path instances).

Shapes are immutable value objects: every transform method (translate, rotate, scale) returns a new Shape rather than mutating in place. The constituent paths define the faces of the shape and are used for rendering, depth sorting, and hit testing.

Use the extrude factory method to create a 3D shape from a 2D Path, or construct directly from a list of paths.

Parameters

paths

The polygon faces that make up this shape (must not be empty)

Inheritors

Constructors

Link copied to clipboard
constructor(paths: List<Path>)
constructor(vararg paths: Path)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard

Functions

Link copied to clipboard

Sort the list of faces by distance then return the ordered paths

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

Rotate about origin on the X axis

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

Rotate about origin on the Y axis

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

Rotate about origin on the Z axis

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

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

Scale about a given origin

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

Translate the shape by the given deltas