φ Famo.us University Famo.us/Angular Docs Help Blog Download
  • core
  • Context
  • ElementAllocator
  • ElementOutput
  • Engine
  • Entity
  • EventEmitter
  • EventHandler
  • Group
  • Modifier
  • OptionsManager
  • RenderNode
  • Scene
  • SpecParser
  • Transform
  • View
  • ViewSequence
  • events
  • EventArbiter
  • EventFilter
  • EventMapper
  • inputs
  • Accumulator
  • GenericSync
  • MouseSync
  • PinchSync
  • RotateSync
  • ScaleSync
  • ScrollSync
  • TouchSync
  • TouchTracker
  • TwoFingerSync
  • math
  • Matrix
  • Quaternion
  • Random
  • Utilities
  • Vector
  • modifiers
  • Draggable
  • Fader
  • ModifierChain
  • StateModifier
  • physics
  • PhysicsEngine
  • physics/bodies
  • Body
  • Circle
  • Particle
  • Rectangle
  • physics/constraints
  • Surface
  • Collision
  • Constraint
  • Curve
  • Distance
  • Snap
  • Wall
  • Walls
  • physics/forces
  • Drag
  • Force
  • Repulsion
  • RotationalDrag
  • RotationalSpring
  • Spring
  • VectorField
  • physics/integrators
  • SymplecticEuler
  • surfaces
  • CanvasSurface
  • ContainerSurface
  • ImageSurface
  • InputSurface
  • TextareaSurface
  • VideoSurface
  • transitions
  • CachedMap
  • Easing
  • MultipleTransition
  • SnapTransition
  • SpringTransition
  • Transitionable
  • TransitionableTransform
  • TweenTransition
  • WallTransition
  • utilities
  • KeyCodes
  • Timer
  • Utility
  • views
  • ContextualView
  • Deck
  • DrawerLayout
  • EdgeSwapper
  • FlexibleLayout
  • Flipper
  • GridLayout
  • HeaderFooterLayout
  • Lightbox
  • RenderController
  • ScrollContainer
  • Scroller
  • Scrollview
  • SequentialLayout
  • widgets
  • NavigationBar
  • TabBar

Vector

Three-element floating point vector.

Overview

Options
Methods
add
sub
mult
div
cross
equals
rotateX
rotateY
rotateZ
dot
normSquared
norm
normalize
clone
isZero
set
put
clear
cap
project
reflectAcross
get

Vector(x, y, z)

Constructor Parameters

x

Number

x element value

y

Number

y element value

z

Number

z element value

Methods

add(v)

Add this element-wise to another Vector, element-wise. Note: This sets the internal result register, so other references to that vector will change.

Parameters
v
Vector
addend
Returns
Vector
vector sum

sub(v)

Subtract another vector from this vector, element-wise. Note: This sets the internal result register, so other references to that vector will change.

Parameters
v
Vector
subtrahend
Returns
Vector
vector difference

mult(r)

Scale Vector by floating point r. Note: This sets the internal result register, so other references to that vector will change.

Parameters
r
Number
scalar
Returns
Vector
vector result

div(r)

Scale Vector by floating point 1/r. Note: This sets the internal result register, so other references to that vector will change.

Parameters
r
Number
scalar
Returns
Vector
vector result

cross(v)

Given another vector v, return cross product (v)x(this). Note: This sets the internal result register, so other references to that vector will change.

Parameters
v
Vector
Left Hand Vector
Returns
Vector
vector result

equals(v)

Component-wise equality test between this and Vector v.

Parameters
v
Vector
vector to compare
Returns
Boolean

rotateX(theta)

Rotate clockwise around x-axis by theta radians. Note: This sets the internal result register, so other references to that vector will change.

Parameters
theta
Number
radians
Returns
Vector
rotated vector

rotateY(theta)

Rotate clockwise around y-axis by theta radians. Note: This sets the internal result register, so other references to that vector will change.

Parameters
theta
Number
radians
Returns
Vector
rotated vector

rotateZ(theta)

Rotate clockwise around z-axis by theta radians. Note: This sets the internal result register, so other references to that vector will change.

Parameters
theta
Number
radians
Returns
Vector
rotated vector

dot(v)

Return dot product of this with a second Vector

Parameters
v
Vector
second vector
Returns
Number
dot product

normSquared()

Return squared length of this vector

Returns
Number
squared length

norm()

Return length of this vector

Returns
Number
length

normalize(length)

Scale Vector to specified length. If length is less than internal tolerance, set vector to [length, 0, 0]. Note: This sets the internal result register, so other references to that vector will change.

Parameters
length
Number
target length, default 1.0
Returns
Vector

clone()

Make a separate copy of the Vector.

Returns
Vector

isZero()

True if and only if every value is 0 (or falsy)

Returns
Boolean

set(v)

Set this Vector to the values in the provided Array or Vector.

Parameters
v
Object
array, Vector, or number
Returns
Vector
this

put(v)

Put result of last internal register calculation in specified output vector.

Parameters
v
Vector
destination vector
Returns
Vector
destination vector

clear()

Set this vector to [0,0,0]

cap()

Scale this Vector down to specified "cap" length. If Vector shorter than cap, or cap is Infinity, do nothing. Note: This sets the internal result register, so other references to that vector will change.

Returns
Vector
capped vector

project(n)

Return projection of this Vector onto another. Note: This sets the internal result register, so other references to that vector will change.

Parameters
n
Vector
vector to project upon
Returns
Vector
projected vector

reflectAcross(n)

Reflect this Vector across provided vector. Note: This sets the internal result register, so other references to that vector will change.

Parameters
n
Vector
vector to reflect across
Returns
Vector
reflected vector

get()

Convert Vector to three-element array.

Returns
Array<number>
three-element array
Branding Terms Privacy Jobs © Famous Industries, Inc. 2015