MathWorx

Class Vector

Object
   |
   +--Vector
Direct Known Subclasses:
point2D, point3D

class Vector

Defined in Vector.js


Field Summary
 Array components
          the components of the Vector
 Integer n
          the dimension of the array (length of components array)
<static>  <final> Vector i
          The unit vector [1,0,0]
<static>  <final> Vector j
          The unit vector [0,1,0]
<static>  <final> Vector k
          The unit vector [0,0,1]
 
Constructor Summary
Vector(<Object> elements)
            Constructor function.
 
Method Summary
 Vector add(<Vector> vec)
           Adds a vector to the supplied vector.
 void addElement(<Number> el)
           Adds a new element to the vector and updates the dimension.
 Number angleBetween(<Vector> vec)
           Finds and returns the angle between two vectors.
 Vector cross(<Vector> vec)
           Computes the cross product of two 3-dimensional vectors.
 Integer dimension(<Integer> n)
           Sets and/or returns the dimension of the vector.
 Number distanceFrom(<Object> obj)
           Returns the distance between the vector and an object, as if the vector were a point in its n-space.
 Number dot(<Vector> vec)
           Returns the scalar dot product of this vector and the supplied vector.
 Array elements(<Array> els)
           Method for setting and getting the elements of a vector.
 Boolean equalTo(<Vector> vec)
           Tests to see if two vectors are equal to each other.
 Number get(<Integer> index)
           Gets the component of the vector at index.
 Number getLength()
           Returns the length of the vector by modulus definition.
 Number indexOf(<Number> x)
           Returns the first occurence of x in the vector.
 Boolean isAntiParallel(<Vector> vec)
           Tests if two vectors are antiparallel.
 Boolean isParallel(<Vector> vec)
           Tests if two vectors are parallel.
 Boolean isPerpendicular(<Vector> vec)
           Tests if two vectors are perpendicular.
 Boolean linearlyDependent(<Vector> vec)
           Tests to see if 2 vectors are linearly dependent.
 Boolean linearlyIndependent(<Vector> vec)
           Tests to see if 2 vectors are linearly independent from each other.
 Vector make3D()
           Makes a copy of the given vector in 3 dimensions.
 Vector map(<Function> func)
           Maps the vector to a new vector by the supplied function.
 Number max()
           Finds and returns the element with the largest absolute value.
 Vector multiplyBy(<Number> k)
           Multiplies a vector by a scalar k.
 Object negative()
           Returns a negative copy of the Vector (or point).
 Vector normalize()
           Normalizes the vector and returns the new unit vector.
 Object reflectionIn(<Object> obj)
           Reflects the Vector or point2D/3D in the given point, line, or plane
 Vector resolute(<Vector> vec)
           Projects one Vector onto another.
 Vector round()
           Rounds all the elements of the vector and returns the copy.
 Object snapTo(<Number> val)
           Sets all values within range of Zero (set in easyload.js) to val.
 Vector subtract(<Vector> vec)
           Subtracts a vector to the supplied vector.
 Matrix toColumnMatrix()
           Converts a Vector into a 1-column matrix.
 void toEach(<Function> func)
           Performs a supplied function on every element of the vector.
 Object toPoint()
           Converts a Vector to a point object of appropriate dimension in homogeneous coordinates.
 Matrix toRowMatrix()
           Converts a Vector into a 1-row matrix.
 String toString()
           Returns a string representation of the vector.
<static> Vector random(<Integer> n, <Number> max)
           Creates and returns a new vector with n random elements less than or equal to max.
<static> Vector zero(<Integer> n)
           Creates and returns a new vector of dimension n with all 0 components.

Field Detail

components

Array components

n

Integer n

i

<static> <final> Vector i

j

<static> <final> Vector j

k

<static> <final> Vector k

Constructor Detail

Vector

Vector(<Object> elements)

Method Detail

add

Vector add(<Vector> vec)

addElement

void addElement(<Number> el)

angleBetween

Number angleBetween(<Vector> vec)

cross

Vector cross(<Vector> vec)

dimension

Integer dimension(<Integer> n)

distanceFrom

Number distanceFrom(<Object> obj)

dot

Number dot(<Vector> vec)

elements

Array elements(<Array> els)

equalTo

Boolean equalTo(<Vector> vec)

get

Number get(<Integer> index)

getLength

Number getLength()

indexOf

Number indexOf(<Number> x)

isAntiParallel

Boolean isAntiParallel(<Vector> vec)

isParallel

Boolean isParallel(<Vector> vec)

isPerpendicular

Boolean isPerpendicular(<Vector> vec)

linearlyDependent

Boolean linearlyDependent(<Vector> vec)

linearlyIndependent

Boolean linearlyIndependent(<Vector> vec)

make3D

Vector make3D()

map

Vector map(<Function> func)

max

Number max()

multiplyBy

Vector multiplyBy(<Number> k)

negative

Object negative()

normalize

Vector normalize()

reflectionIn

Object reflectionIn(<Object> obj)

resolute

Vector resolute(<Vector> vec)

round

Vector round()

snapTo

Object snapTo(<Number> val)

subtract

Vector subtract(<Vector> vec)

toColumnMatrix

Matrix toColumnMatrix()

toEach

void toEach(<Function> func)

toPoint

Object toPoint()

toRowMatrix

Matrix toRowMatrix()

toString

String toString()

random

<static> Vector random(<Integer> n, <Number> max)

zero

<static> Vector zero(<Integer> n)

MathWorx

Documentation generated by JSDoc on Mon Aug 11 13:58:31 2008