Options
All
  • Public
  • Public/Protected
  • All
Menu

Hierarchy

  • Vec2f

Index

Constructors

constructor

  • new Vec2f(x: number, y: number): Vec2f
  • Parameters

    • x: number
    • y: number

    Returns Vec2f

Properties

x

x: number
returns

y

y: number
returns

Methods

add

  • Parameters

    Returns Vec2f

angleBetween

  • angleBetween(other: Vec2f): number
  • Returns the angle between the two vectors in radians

    Parameters

    Returns number

dot

  • dot(other: Vec2f): number
  • Parameters

    Returns number

extend

  • extend(w?: number): Vec3f
  • Casts this to a 3D coordinate representation

    Parameters

    • Optional w: number

    Returns Vec3f

free

  • free(): void
  • Returns void

len

  • len(): number
  • Length of this vector.

    Calculated as sqrt lenSq(). If you only need to compare lengths of vectors (for example when sorting) prefer using lenSq.

    Returns number

lenSq

  • lenSq(): number
  • Squared length of this vector

    Returns number

mul

  • mul(other: number): Vec2f
  • Parameters

    • other: number

    Returns Vec2f

normalized

  • Returns a new vector with the same direction but a length of 1

    Returns Vec2f

rotate

  • rotate(rad: number): void
  • Rotate the vector around the origin counter-clockwise by rad radians.

    Parameters

    • rad: number

    Returns void

sub

  • Parameters

    Returns Vec2f

swap

  • swap(other: Vec2f): void
  • Parameters

    Returns void

to3dVector

  • Casts this to a 3d displacement/vector.

    Returns Vec3f

transponent

  • Returns Vec2f

Static fromHomogeneous

  • Cast the Homogenous representation back to (x, y) representation

    Parameters

    Returns Vec2f

Static orient2d

  • Returns the orientation of point C in respect to the directed line AB.

    If the orient2d(a, b, c) > 0, then C lies to the left.

    If the orient2d(a, b, c) < 0, then C lies to the right.

    If the orient2d(a, b, c) == 0, then C lies to on the line.

    The absolute value of the returning number is double the area of the triangle ABC

    Parameters

    Returns number

Legend

  • Constructor
  • Property
  • Method
  • Static method

Generated using TypeDoc