Defines an arbitrary 2d shape plane using paths with optional holes. It can be used with ExtrudeGeometry, 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());


geometry / shapes
geometry / extrude / shapes
geometry / extrude / shapes2


Shape(points : Array)

points -- (optional) array of Vector2s.

Creates a Shape from the points. The first point defines the offset, then successive points are added to the curves array as LineCurves.

If no points are specified, an empty shape is created and the .currentPoint is set to the origin.


See the base Path class for common properties.

.uuid undefined : String

UUID of this instance. This gets automatically assigned, so this shouldn't be edited.

.holes undefined : array

An array of paths that define the holes in the shape.


See the base Path class for common methods.

.extractPoints (divisions : Integer) : Array

divisions -- The fineness of the result.

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

.getPointsHoles (divisions : Integer) : Array

divisions -- The fineness of the result.

Get an array of Vector2s that represent the holes in the shape.


For more info on how to obtain the source code of this module see this page.