Class QuadraticBezierCurve

A smooth 2d quadratic bezier curve, defined by a startpoint, endpoint and a single control point.

Hierarchy

  • Curve<Vector2>
    • QuadraticBezierCurve

Constructors

Properties

arcLengthDivisions: number

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

200

isArcCurve: boolean

subclass should override

Default Value

false

isCatmullRomCurve3: boolean

subclass should override

Default Value

true

isCubicBezierCurve: boolean

subclass should override

Default Value

false

isCubicBezierCurve3: boolean

subclass should override

Default Value

false

isEllipseCurve: boolean

subclass should override

Default Value

false

isLineCurve: boolean

subclass should override

Default Value

false

isLineCurve3: boolean

subclass should override

Default Value

false

isQuadraticBezierCurve: boolean

Default Value

true

isQuadraticBezierCurve3: boolean

subclass should override

Default Value

false

isSplineCurve: boolean

subclass should override

Default Value

false

type: string

The print name of the QuadraticBezierCurve.

Default Value

'QuadraticBezierCurve'

v0: Vector2

The startpoint.

v1: Vector2

The control point.

v2: Vector2

The endpoint.

Methods

  • Creates a new instance with same property values as this curve.

    Returns

    A new Curve instance exactly like this curve.

    Returns Curve<Vector2>

  • Generates the Frenet frames. Learn more at http://www.cs.indiana.edu/pub/techreports/TR425.pdf

    Returns

    An object with shape: { tangents: Vector3[]; normals: Vector3[]; binormals: Vector3[]; }

    Parameters

    • segments: number

      Number of segments

    • Optional closed: boolean

      True if this curve is closed.

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

    • binormals: Vector3[]
    • normals: Vector3[]
    • tangents: Vector3[]
  • Get list of cumulative segment lengths.

    Returns

    Array of points

    Parameters

    • Optional divisions: number

    Returns number[]

  • Find the point (vector) for point t of the curve where t is between 0 and 1.

    Returns

    The point.

    Parameters

    • t: number

      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.

    Returns Vector2

  • Find a vector for point at relative position in curve according to arc length

    Returns

    The point.

    Parameters

    • u: number

      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.

    Returns Vector2

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

    Returns

    Array of point vectors.

    Parameters

    • Optional divisions: number

      number of pieces to divide the curve into. Default is 5.

    Returns Vector2[]

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

    Returns

    Array of point vectors.

    Parameters

    • Optional divisions: number

      number of pieces to divide the curve into. Default is 5.

    Returns Vector2[]

  • 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;

    Returns

    A vector tangent to t.

    Parameters

    • t: number

      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.

    Returns Vector2

  • Compute the tangent at a point which is equidistant to the ends of the curve from the point given in getTangent().

    Returns

    a vector tangent to u.

    Parameters

    • u: number

      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.

    Returns Vector2

  • Given u ( 0 .. 1 ), get a t to find p. This gives you points which are equi distance

    Parameters

    • u: number
    • distance: number

    Returns number

  • Create a JSON object representation of this instance.

    Returns

    A JSON object

    Returns object