Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Vector

Hierarchy

Index

Constructors

constructor

Properties

elements

elements: ReadonlyArray<number>

Static i

i: Vector = new Vector([1, 0, 0])

Static j

j: Vector = new Vector([0, 1, 0])

Static k

k: Vector = new Vector([0, 0, 1])

Methods

add

angleFrom

  • Parameters

    Returns number

augment

chomp

  • Parameters

    • n: number

    Returns Vector

cols

  • cols(): number
  • Returns number

cross

dimensions

  • dimensions(): object
  • Returns object

    the "rows" will always equal zero

    • cols: number
    • rows: number

distanceFrom

  • Parameters

    Returns number

dot

  • Parameters

    Returns number

e

  • e(i: number): null | number
  • Parameters

    • i: number

    Returns null | number

each

  • each(fn: function): void
  • Parameters

    • fn: function
        • (value: number, index: number): void
        • Parameters

          • value: number
          • index: number

          Returns void

    Returns void

eql

  • eql(other: unknown, precision?: number): boolean
  • Parameters

    • other: unknown
    • Default value precision: number = Sylvester.approxPrecision

    Returns boolean

indexOf

  • indexOf(x: number): number
  • Parameters

    • x: number

    Returns number

isAntiparallelTo

  • isAntiparallelTo(vector: VectorOrList, epsilon?: number): boolean
  • Parameters

    • vector: VectorOrList
    • Default value epsilon: number = Sylvester.precision

    Returns boolean

isParallelTo

  • isParallelTo(obj: Geometry, epsilon?: number): boolean
  • Parameters

    • obj: Geometry
    • Default value epsilon: number = Sylvester.precision

    Returns boolean

isPerpendicularTo

  • isPerpendicularTo(obj: Geometry, epsilon?: number): boolean
  • Parameters

    • obj: Geometry
    • Default value epsilon: number = Sylvester.precision

    Returns boolean

liesIn

  • liesIn(plane: Plane): boolean
  • Parameters

    Returns boolean

liesOn

  • liesOn(line: Line): boolean
  • Parameters

    Returns boolean

log

  • Parameters

    • Default value base: number = Math.E

    Returns Vector

magnitude

  • magnitude(): number
  • Returns number

map

  • Parameters

    • fn: function
        • (value: number, index: number): number
        • Parameters

          • value: number
          • index: number

          Returns number

    Returns Vector

max

  • max(): number
  • Returns number

maxIndex

  • maxIndex(): number
  • Returns number

    Will be -1 if the vector is empty

multiply

product

  • product(): number
  • Returns number

reflectionIn

rotate2D

rotate3D

  • Parameters

    Returns Vector

round

  • Returns Vector

rows

  • rows(): number
  • Returns number

    always 1

snapTo

  • snapTo(target: number, epsilon?: number): Vector
  • Parameters

    • target: number
    • Default value epsilon: number = Sylvester.precision

    Returns Vector

subtract

sum

  • sum(): number
  • Returns number

to3D

  • Returns Vector

toDiagonalMatrix

  • Returns Matrix

toDimension

  • toDimension(n: number): Vector
  • Parameters

    • n: number

    Returns Vector

toJSON

  • toJSON(): ReadonlyArray<number>
  • Returns ReadonlyArray<number>

toString

  • toString(): string
  • Returns string

toUnitVector

  • Returns Vector

top

  • Parameters

    • n: number

    Returns Vector

transpose

  • Returns Matrix

x

Static Fill

  • Fill(size: number, value: number): Vector
  • Parameters

    • size: number
    • value: number

    Returns Vector

Static One

  • Parameters

    • n: number

    Returns Vector

Static Random

  • Random(size: number): Vector
  • Parameters

    • size: number

    Returns Vector

Static Zero

  • Parameters

    • n: number

    Returns Vector

Static Private toElements

  • toElements(vectorOrElements: VectorOrList, requireDimension: undefined | number): ReadonlyArray<number>
  • Parameters

    • vectorOrElements: VectorOrList
    • Optional requireDimension: undefined | number

    Returns ReadonlyArray<number>

Generated using TypeDoc