[page:Path] →

[name]

Defines an arbitrary 2d shape plane using paths with optional holes. It can be used with [page:ExtrudeGeometry], [page:ShapeGeometry], to get points, or to get triangulated faces.
var heartShape = new v3d.Shape(); heartShape.moveTo(25, 25); heartShape.bezierCurveTo(25, 25, 20, 0, 0, 0); heartShape.bezierCurveTo(30, 0, 30, 35,30,35); heartShape.bezierCurveTo(30, 55, 10, 77, 25, 95); heartShape.bezierCurveTo(60, 77, 80, 55, 80, 35); heartShape.bezierCurveTo(80, 35, 80, 0, 50, 0); heartShape.bezierCurveTo(35, 0, 25, 25, 25, 25); var extrudeSettings = { amount: 8, bevelEnabled: true, bevelSegments: 2, steps: 2, bevelSize: 1, bevelThickness: 1 }; var geometry = new v3d.ExtrudeGeometry(heartShape, extrudeSettings); var mesh = new v3d.Mesh(geometry, new v3d.MeshPhongMaterial());

Examples

[example:webgl_geometry_shapes geometry / shapes]
[example:webgl_geometry_extrude_shapes geometry / extrude / shapes]
[example:webgl_geometry_extrude_shapes2 geometry / extrude / shapes2]

Constructor

[name]()

Properties

See the base [page:Path] class for common properties.

[property:array holes]

An array of [page:Path paths] that define the holes in the shape.

Methods

See the base [page:Path] class for common methods.

[method:Array extractAllPoints]([page:Integer divisions])

divisions -- The fineness of the result.

Call [page:Curve.getPoints getPoints] on the shape and the [page:.holes] array, and return an object of the form: { shape holes } where shape and holes are arrays of [page:Vector2 Vector2s].

[method:Object extractPoints]([page:Integer divisions])

This is identical to [page:.extractAllPoints].

[method:Array getPointsHoles]([page:Integer divisions])

divisions -- The fineness of the result.

Get an array of [page:Vector2 Vector2s] that represent the holes in the shape.
[sourceHint]