[page:Curve] → [page:CurvePath] →

# [name]

A 2D path representation. The class provides methods for creating paths and contours of 2D shapes similar to the 2D Canvas API.

## Example

`var path = new THREE.Path(); path.lineTo( 0, 0.8 ); path.quadraticCurveTo( 0, 1, 0.2, 1 ); path.lineTo( 1, 1 ); var points = path.getPoints(); var geometry = new THREE.BufferGeometry().setFromPoints( points ); var material = new THREE.LineBasicMaterial( { color: 0xffffff } ); var line = new THREE.Line( geometry, material ); scene.add( line );`

## Constructor

### [name]( [param:Array points] )

points -- (optional) array of [page:Vector2 Vector2s].
Creates a Path from the points. The first point defines the offset, then successive points are added to the [page:CurvePath.curves curves] array as [page:LineCurve LineCurves].
If no points are specified, an empty path is created and the [page:.currentPoint] is set to the origin.

## Properties

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

### [property:array currentPoint]

The current offset of the path. Any new [page:Curve] added will start here.

## Methods

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

### [method:this absarc]( [param:Float x], [param:Float y], [param:Float radius], [param:Float startAngle], [param:Float endAngle], [param:Float clockwise] )

x, y -- The absolute center of the arc.
radius -- The radius of the arc.
startAngle -- The start angle in radians.
endAngle -- The end angle in radians.
clockwise -- Sweep the arc clockwise. Defaults to *false*.
Adds an absolutely positioned [page:EllipseCurve EllipseCurve] to the path.

### [method:this absellipse]( [param:Float x], [param:Float y], [param:Float xRadius], [param:Float yRadius], [param:Float startAngle], [param:Float endAngle], [param:Float clockwise], [param:Float rotation] )

x, y -- The absolute center of the ellipse.
xRadius -- The radius of the ellipse in the x axis.
yRadius -- The radius of the ellipse in the y axis.
startAngle -- The start angle in radians.
endAngle -- The end angle in radians.
clockwise -- Sweep the ellipse clockwise. Defaults to false.
rotation -- The rotation angle of the ellipse in radians, counterclockwise from the positive X axis. Optional, defaults to 0.
Adds an absolutely positioned [page:EllipseCurve EllipseCurve] to the path.

### [method:this arc]( [param:Float x], [param:Float y], [param:Float radius], [param:Float startAngle], [param:Float endAngle], [param:Float clockwise] )

x, y -- The center of the arc offset from the last call.
radius -- The radius of the arc.
startAngle -- The start angle in radians.
endAngle -- The end angle in radians.
clockwise -- Sweep the arc clockwise. Defaults to *false*.
Adds an [page:EllipseCurve EllipseCurve] to the path, positioned relative to [page:.currentPoint].

### [method:this bezierCurveTo]( [param:Float cp1X], [param:Float cp1Y], [param:Float cp2X], [param:Float cp2Y], [param:Float x], [param:Float y] )

This creates a bezier curve from [page:.currentPoint] with (cp1X, cp1Y) and (cp2X, cp2Y) as control points and updates [page:.currentPoint] to x and y.

### [method:this ellipse]( [param:Float x], [param:Float y], [param:Float xRadius], [param:Float yRadius], [param:Float startAngle], [param:Float endAngle], [param:Float clockwise], [param:Float rotation] )

x, y -- The center of the ellipse offset from the last call.
xRadius -- The radius of the ellipse in the x axis.
yRadius -- The radius of the ellipse in the y axis.
startAngle -- The start angle in radians.
endAngle -- The end angle in radians.
clockwise -- Sweep the ellipse clockwise. Defaults to *false*.
rotation -- The rotation angle of the ellipse in radians, counterclockwise from the positive X axis. Optional, defaults to *0*.
Adds an [page:EllipseCurve EllipseCurve] to the path, positioned relative to [page:.currentPoint].

### [method:this lineTo]( [param:Float x], [param:Float y] )

Connects a [page:LineCurve] from [page:.currentPoint] to x, y onto the path.

### [method:this moveTo]( [param:Float x], [param:Float y] )

Move the [page:.currentPoint] to x, y.

### [method:this quadraticCurveTo]( [param:Float cpX], [param:Float cpY], [param:Float x], [param:Float y] )

Creates a quadratic curve from [page:.currentPoint] with cpX and cpY as control point and updates [page:.currentPoint] to x and y.

### [method:this setFromPoints]( [param:Array vector2s] )

points -- array of [page:Vector2 Vector2s].
Points are added to the [page:CurvePath.curves curves] array as [page:LineCurve LineCurves].

### [method:this splineThru] ( [param:Array points] )

points - An array of [page:Vector2 Vector2s]
Connects a new [page:SplineCurve] onto the path.

## Source

[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]