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.
Optional
points: Vector2[](optional) array of Vector2.
Determines the amount of divisions when calculating the
cumulative segment lengths of a curve via .getLengths
. To ensure
precision when using methods like .getSpacedPoints
, it is recommended
to increase .arcLengthDivisions
if the curve is very large.
200
Whether or not to automatically close the path.
false
The current offset of the path. Any new Curve added will start here.
new Vector2()
The array of Curves.
[]
An array of paths that define the holes in the shape.
[]
Readonly
issubclass should override
false
Readonly
issubclass should override
true
Readonly
issubclass should override
false
Readonly
issubclass should override
false
Readonly
issubclass should override
false
Readonly
issubclass should override
false
Readonly
issubclass should override
false
Readonly
issubclass should override
false
Readonly
issubclass should override
false
Readonly
issubclass should override
false
Readonly
type'Shape'
Readonly
uuidUUID of this instance. This gets automatically assigned, so this shouldn't be edited.
Adds an absolutely positioned EllipseCurve to the path.
This instance.
Optional
x: numberThe absolute center x of the arc. Default is 0.
Optional
y: numberThe absolute center y of the arc. Default is 0.
Optional
radius: numberThe radius of the arc. Default is 1.
Optional
startAngle: numberThe start angle of the curve in radians starting from the positive X axis. Default is 0.
Optional
endAngle: numberThe end angle of the curve in radians starting from the positive X axis. Default is 2 x Math.PI.
Optional
isClockwise: booleanSweep the arc clockwise. Defaults to false.
Adds an absolutely positioned EllipseCurve to the path.
This instance.
– The X center of the ellipse. Default is 0.
– The Y center of the ellipse. Default is 0.
– The radius of the ellipse in the x direction. Default is 1.
– The radius of the ellipse in the y direction. Default is 1.
The start angle of the curve in radians starting from the positive X axis. Default is 0.
The end angle of the curve in radians starting from the positive X axis. Default is 2 x Math.PI.
Sweep the arc clockwise. Defaults to false.
Adds an EllipseCurve to the path, positioned relative to the currentPoint.
This instance.
The absolute center x of the arc. Default is 0.
The absolute center y of the arc. Default is 0.
The radius of the arc. Default is 1.
The start angle of the curve in radians starting from the positive X axis. Default is 0.
The end angle of the curve in radians starting from the positive X axis. Default is 2 x Math.PI.
Sweep the arc clockwise. Defaults to false.
Creates a bezier curve from currentPoint with (cp1X, cp1Y) and (cp2X, cp2Y) as control points and updates currentPoint to the end point (x,y).
This instance.
Control point1, x coordinate
Control point1, y coordinate
Control point2, x coordinate
Control point2, y coordinate
end point, x coordinate
end point, y coordinate
Generates the Frenet frames. Learn more at http://www.cs.indiana.edu/pub/techreports/TR425.pdf
An object with shape: { tangents: Vector3[]; normals: Vector3[]; binormals: Vector3[]; }
Number of segments
Optional
closed: booleanTrue if this curve is closed.
Adds an EllipseCurve to the path, positioned relative to the currentPoint.
This instance.
The center of the ellipse offset from the last call.
The center of the ellipse offset from the last call.
The radius of the ellipse in the x axis.
The radius of the ellipse in the y axis.
The start angle in radians.
The end angle in radians.
Sweep the ellipse clockwise. Defaults to false.
The rotation angle of the ellipse in radians, counterclockwise from the positive X axis. Optional, defaults to 0.
Get the points on the shape and the holes array as an object.
An object with the following shape: { shape: Vector2[]; holes: Vector2[]; }
The fineness of the result.
Find the point (vector) for point t of the curve where t is between 0 and 1.
The point.
A position on the curve. Must be in the range [ 0, 1 ].
Optional
optionalTarget: Vector2(optional) If specified, the result will be copied into this Vector, otherwise a new Vector will be created.
Find a vector for point at relative position in curve according to arc length
The point.
A position on the curve according to the arc length. Must be in the range [ 0, 1 ].
Optional
optionalTarget: Vector2(optional) If specified, the result will be copied into this Vector, otherwise a new Vector will be created.
Compute a unit vector tangent at t. If the subclassed curve do not implement its tangent derivation, 2 points a small delta apart will be used to find its gradient which seems to give a reasonable approximation getTangent(t: number, optionalTarget?: T): T;
A vector tangent to t.
A position on the curve. Must be in the range [ 0, 1 ].
Optional
optionalTarget: Vector2— (optional) If specified, the result will be copied into this Vector, otherwise a new Vector will be created.
Compute the tangent at a point which is equidistant to the ends of the
curve from the point given in getTangent()
.
a vector tangent to u.
A position on the curve according to the arc length. Must be in the range [ 0, 1 ].
Optional
optionalTarget: Vector2(optional) If specified, the result will be copied into this Vector, otherwise a new Vector will be created.
Creates a quadratic curve from the currentPoint with cpX and cpY as control point and updates the currentPoint to x and y.
This instance.
Control point, x coordinate
Control point, y coordinate
End point, x coordinate
End point, y coordinate
An arbitrary 2d shape plane using paths with optional holes.
Example