Creates a 2d curve in the shape of an ellipse

Remarks

Setting the xRadius equal to the yRadius will result in a circle.

Example

const curve = new THREE.EllipseCurve(
0, 0, // ax, aY
10, 10, // xRadius, yRadius
0, 2 * Math.PI, // aStartAngle, aEndAngle
false, // aClockwise
0 // aRotation
);
const points = curve.getPoints(50);
const geometry = new THREE.BufferGeometry().setFromPoints(points);
const material = new THREE.LineBasicMaterial({ color: 0xff0000 });
// Create the final object to add to the scene
const ellipse = new THREE.Line(geometry, material);

See

Hierarchy (view full)

Constructors

  • This constructor creates a new EllipseCurve.

    Parameters

    • Optional aX: number

      The X center of the ellipse. Expects a Float. Default is 0.

    • Optional aY: number

      The Y center of the ellipse. Expects a Float. Default is 0.

    • Optional xRadius: number

      The radius of the ellipse in the x direction. Expects a Float. Default is 1.

    • Optional yRadius: number

      The radius of the ellipse in the y direction. Expects a Float. Default is 1.

    • Optional aStartAngle: number

      The start angle of the curve in radians starting from the positive X axis. Default is 0.

    • Optional aEndAngle: number

      The end angle of the curve in radians starting from the positive X axis. Default is 2 x Math.PI.

    • Optional aClockwise: boolean

      Whether the ellipse is drawn clockwise. Default is false.

    • Optional aRotation: number

      The rotation angle of the ellipse in radians, counterclockwise from the positive X axis. Default is 0.

    Returns EllipseCurve

Properties

aClockwise: boolean

Whether the ellipse is drawn clockwise.

Default Value

`false``
aEndAngle: number

The end angle of the curve in radians starting from the middle right side.

Remarks

Expects a Float

Default Value

2 * Math.PI

aRotation: number

The rotation angle of the ellipse in radians, counterclockwise from the positive X axis (optional).

Remarks

Expects a Float

Default Value

0

aStartAngle: number

The start angle of the curve in radians starting from the middle right side.

Remarks

Expects a Float

Default Value

0

aX: number

The X center of the ellipse.

Remarks

Expects a Float

Default Value

0

aY: number

The Y center of the ellipse.

Remarks

Expects a Float

Default Value

0

arcLengthDivisions: number

This value 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.

Default Value

200

Remarks

Expects a Integer

isEllipseCurve: true = true

Read-only flag to check if a given object is of type EllipseCurve.

Remarks

This is a constant value

Default Value

true

type: string

A Read-only string to check if this object type.

Remarks

Sub-classes will update this value.

Default Value

EllipseCurve

xRadius: number

The radius of the ellipse in the x direction.

Default Value

1

yRadius: number

The radius of the ellipse in the y direction.

Default Value

1

Methods

  • Creates a clone of this instance.

    Returns this

  • Generates the Frenet Frames

    Parameters

    • segments: number

      Expects a Integer

    • Optional closed: boolean

    Returns {
        binormals: Vector3[];
        normals: Vector3[];
        tangents: Vector3[];
    }

    Remarks

    Requires a Curve definition in 3D space Used in geometries like TubeGeometry or ExtrudeGeometry.

  • Copies another Curve object to this instance.

    Parameters

    Returns this

  • Copies the data from the given JSON object to this instance.

    Parameters

    • json: {}

      Returns this

    • Get total Curve arc length.

      Returns number

    • Get list of cumulative segment lengths.

      Parameters

      • Optional divisions: number

        Expects a Integer

      Returns number[]

    • Returns a vector for a given position on the curve.

      Parameters

      • t: number

        A position on the curve. Must be in the range [ 0, 1 ]. Expects a Float

      • Optional optionalTarget: Vector2

        If specified, the result will be copied into this Vector, otherwise a new Vector will be created. Default new T.

      Returns Vector2

    • Returns a vector for a given position on the Curve according to the arc length.

      Parameters

      • u: number

        A position on the Curve according to the arc length. Must be in the range [ 0, 1 ]. Expects a Float

      • Optional optionalTarget: Vector2

        If specified, the result will be copied into this Vector, otherwise a new Vector will be created. Default new T.

      Returns Vector2

    • Returns a set of divisions +1 points using .getPoint | getPoint(t).

      Parameters

      • Optional divisions: number

        Number of pieces to divide the Curve into. Expects a Integer. Default 5

      Returns Vector2[]

    • Returns a set of divisions +1 equi-spaced points using .getPointAt | getPointAt(u).

      Parameters

      • Optional divisions: number

        Number of pieces to divide the Curve into. Expects a Integer. Default 5

      Returns Vector2[]

    • Returns a unit vector tangent at t

      Parameters

      • t: number

        A position on the curve. Must be in the range [ 0, 1 ]. Expects a Float

      • Optional optionalTarget: Vector2

        If specified, the result will be copied into this Vector, otherwise a new Vector will be created.

      Returns Vector2

      Remarks

      If the derived Curve does not implement its tangent derivation, two points a small delta apart will be used to find its gradient which seems to give a reasonable approximation.

    • Returns tangent at a point which is equidistant to the ends of the Curve from the point given in .getTangent.

      Parameters

      • u: number

        A position on the Curve according to the arc length. Must be in the range [ 0, 1 ]. Expects a Float

      • Optional optionalTarget: Vector2

        If specified, the result will be copied into this Vector, otherwise a new Vector will be created.

      Returns Vector2

    • Given u in the range [ 0, 1 ],

      Parameters

      • u: number

        Expects a Float

      • distance: number

        Expects a Float

      Returns number

      t also in the range [ 0, 1 ]. Expects a Float.

      Remarks

      u and t can then be used to give you points which are equidistant from the ends of the curve, using .getPoint.

    • Returns a JSON object representation of this instance.

      Returns {}

      • Update the cumulative segment distance cache

        Returns void

        Remarks

        The method must be called every time Curve parameters are changed If an updated Curve is part of a composed Curve like CurvePath, .updateArcLengths() must be called on the composed curve, too.