Options
All
  • Public
  • Public/Protected
  • All
Menu

表示二维的一个向量

Class representing a vector containing 2 coordinates

Hierarchy

  • Vector2

Index

Constructors

constructor

Properties

x

x: number = ...

向量的 x 值

The X value of the current vector

default

0

y

y: number = ...

向量的 y 值

The Y value of the current vector

default

0

Static Readonly MAX

MAX: Vector2 = ...

Vector2 (Infinity, Infinity)

Static Readonly MIN

MIN: Vector2 = ...

Vector2 (-Infinity, -Infinity)

Static Readonly ONE

ONE: Vector2 = ...

Vector2 (1, 1)

Static X_DIRECTION

X_DIRECTION: Vector2 = ...

X轴正方向

The positive direction of the X-Axis

Static Y_DIRECTION

Y_DIRECTION: Vector2 = ...

Y轴正方向

The positive direction of the Y-Axis

Static Readonly ZERO

ZERO: Vector2 = ...

Vector2 (0, 0)

Accessors

angle

  • get angle(): number
  • 向量的角度

    Computes the angle in radians with respect to the horizontal left axis

    弧度制,范围在 [ 0, 2 * PI ),逆时针为正

    Radians in range [ 0, 2 * PI ), counterclockwise

    Returns number

length

  • get length(): number

lengthSq

  • get lengthSq(): number

Methods

add

applyMatrix3

clone

copy

cross

  • 叉乘

    Computes cross product of the current vector and v

    The cross product of Vector2 is just a scalar of z-axis

    Parameters

    Returns number

divide

dot

equals

inverse

isOrthogonal

  • isOrthogonal(v: Vector2, tolerance?: number): boolean
  • 两个向量是否正交垂直

    Determines whether the current vector and v are orthogonal

    Parameters

    • v: Vector2
    • tolerance: number = ...

    Returns boolean

isParallel

  • isParallel(v: Vector2, tolerance?: number): boolean
  • 两个向量是否平行

    Determines whether the current vector and v are parallel

    Parameters

    • v: Vector2
    • tolerance: number = ...

    Returns boolean

multiply

normalize

set

  • 设置向量的值

    Sets values of this vector

    Parameters

    • Optional x: number

      x value

    • Optional y: number

      y value

    Returns Vector2

    当前向量 (this vector2)

  • 设置向量的值

    Sets values of this vector

    Parameters

    • point: Partial<IVec2>

      A Object that contains the values x and y

    Returns Vector2

    当前向量 (this vector2)

setX

setY

sub

Legend

  • Constructor
  • Property
  • Method
  • Static property
  • Static method
  • Property
  • Private property

Generated using TypeDoc