Options
All
  • Public
  • Public/Protected
  • All
Menu

A 2D column vector.

Hierarchy

  • b2Vec2

Index

Constructors

constructor

  • new b2Vec2(x?: number, y?: number): b2Vec2
  • Creates a new vector 2.

    Parameters

    • Optional x: number

      x value, default = 0.

    • Optional y: number

      y value, default = 0.

    Returns b2Vec2

Properties

x

x: number

x value

y

y: number

y value

Methods

Abs

  • Abs(): void
  • Sets x and y to absolute values.

    Returns void

Add

  • Adds the vector 2 to this vector 2. The result is stored in this vector 2.

    Parameters

    Returns void

Copy

  • Creates a copy of the vector 2.

    Returns b2Vec2

    Copy of this vector 2.

CrossFV

  • CrossFV(s: number): void
  • Cross F V

    Parameters

    • s: number

    Returns void

CrossVF

  • CrossVF(s: number): void
  • Cross V F

    Parameters

    • s: number

    Returns void

GetNegative

  • Gets the negative of this vector 2.

    Returns b2Vec2

    Negative copy of this vector 2.

IsValid

  • IsValid(): boolean
  • True if the vector 2 is valid, otherwise false. A valid vector has finite values.

    Returns boolean

    True if the vector 2 is valid, otherwise false.

Length

  • Length(): number
  • Calculates the length of the vector 2.

    Returns number

    The length of the vector 2.

LengthSquared

  • LengthSquared(): number
  • Calculates the length squared of the vector2.

    Returns number

    The length squared of the vector 2.

MaxV

  • Calculates which vector has the maximum values and sets this vector to those values.

    Parameters

    • b: b2Vec2

      Vector 2 to compare for maximum values.

    Returns void

MinV

  • Calculates which vector has the minimum values and sets this vector to those values.

    Parameters

    • b: b2Vec2

      Vector 2 to compare for minimum values.

    Returns void

MulM

  • Matrix multiplication. Stores the result in this vector 2.

    Parameters

    Returns void

MulTM

  • Dot product multiplication. Stores the result in this vector 2.

    Parameters

    • A: b2Mat22

      Matrix to multiply by.

    Returns void

Multiply

  • Multiply(a: number): void
  • Vector multiplication. Stores the result in this vector 2.

    Parameters

    • a: number

      Value to multiple the vector's values by.

    Returns void

NegativeSelf

  • NegativeSelf(): void
  • Sets this vector 2 to its negative.

    Returns void

Normalize

  • Normalize(): number
  • Normalizes the vector 2 [0,1].

    Returns number

    Length.

Set

  • Set(x?: number, y?: number): void
  • Sets the vector 2.

    Parameters

    • Optional x: number

      x value, default is 0.

    • Optional y: number

      y value, default is 0.

    Returns void

SetV

  • Sets the vector 2 from a vector 2.

    Parameters

    • v: b2Vec2

      Vector 2 to copy values from.

    Returns void

SetZero

  • SetZero(): void
  • Sets the vector 2 to zero values.

    Returns void

Subtract

  • Subtracts the vector 2 from this vector 2. The result is stored in this vector 2.

    Parameters

    • v: b2Vec2

      Vector 2 to subtract.

    Returns void

Static Make

  • Make(x: number, y: number): b2Vec2
  • Creates a new vector 2 from the given values.

    Parameters

    • x: number

      x value.

    • y: number

      y value.

    Returns b2Vec2

Generated using TypeDoc