Reference Source
public class | source

Curve

Extends:

Component → Curve

Abstract base class for curve classes.

Constructor Summary

Public Constructor
public

constructor(owner: Component, cfg: *, cfg: Object)

Member Summary

Public Members
public
public get

Gets the length of this Curve.

public
public set

t(value: Number)

Sets the progress along this Curve.

public get

t: Number: *

Gets the progress along this Curve.

public get

tangent: Number[]: *

Gets the tangent on this Curve at position Curve#t.

Method Summary

Public Methods
public

getPointAt(u: *): *

public

getPoints(divisions: Number): *

Samples points on this Curve, at the given number of equally-spaced divisions.

public

Returns a normalized tangent vector on this Curve at the given position.

public

getUToTMapping(u: *, distance: *): *

Inherited Summary

From class Component
public get

The Component that owns the lifecycle of this Component, if any.

public

True as soon as this Component has been destroyed

public

ID of this Component, unique within the Scene.

public

meta: *

Arbitrary, user-defined metadata on this component.

public

The parent Scene that contains this Component.

public

The viewer that contains this Scene.

public

clear()

Destroys all Components that are owned by this.

public

Destroys this component.

public

error(message: String)

Logs an error for this component to the JavaScript console.

public

fire(event: String, value: Object, forget: Boolean)

Fires an event on this component.

public

Returns true if there are any subscribers to the given event on this component.

public

isType(type: *): *: Boolean

Tests if this component is of the given type, or is a subclass of the given type.

public

log(message: String)

Logs a console debugging message for this component.

public

off(subId: String)

Cancels an event subscription that was previously made with Component#on or Component#once.

public

on(event: String, callback: Function, scope: Object): String

Subscribes to an event on this component.

public

once(event: String, callback: Function, scope: Object)

Subscribes to the next occurrence of the given event, then un-subscribes as soon as the event is subIdd.

public

scheduleTask(task: *)

Schedule a task to perform on the next browser interval

public

warn(message: String)

Logs a warning for this component to the JavaScript console.

Public Constructors

public constructor(owner: Component, cfg: *, cfg: Object) source

Override:

Component#constructor

Params:

NameTypeAttributeDescription
owner Component
  • optional

Owner component. When destroyed, the owner will destroy this Curve as well.

cfg *
  • optional

Configs

cfg.id String
  • optional

Optional ID, unique among all components in the parent Curve, generated automatically when omitted.

cfg Object
  • optional

Configs for this Curve.

cfg.t Number
  • optional
  • default: 0

Current position on this Curve, in range between 0..1.

Public Members

public cacheArcLengths: * source

public get length: Number: * source

Gets the length of this Curve.

Return:

Number

The Curve length.

public needsUpdate: boolean source

public set t(value: Number) source

Sets the progress along this Curve.

Automatically clamps to range [0..1].

Default value is 0.

public get t: Number: * source

Gets the progress along this Curve.

Return:

Number

The progress value.

public get tangent: Number[]: * source

Gets the tangent on this Curve at position Curve#t.

Return:

Number[]

The tangent.

Public Methods

public getPointAt(u: *): * source

Params:

NameTypeAttributeDescription
u *

Return:

*

public getPoints(divisions: Number): * source

Samples points on this Curve, at the given number of equally-spaced divisions.

Params:

NameTypeAttributeDescription
divisions Number

The number of divisions.

Return:

*

Array of sampled 3D points.

public getTangent(t: Number): Number[] source

Returns a normalized tangent vector on this Curve at the given position.

Params:

NameTypeAttributeDescription
t Number

Position to get tangent at.

Return:

Number[]

Normalized tangent vector

public getUToTMapping(u: *, distance: *): * source

Params:

NameTypeAttributeDescription
u *
distance *

Return:

*