2D矢量

### Hierarchy

- HashObject
  - Vector2D

## Index

### Constructors

- constructor

### Properties

- _x
- _y
- onChange

### Accessors

- angle
- hashCode
- isNormalized
- isZero
- length
- lengthSQ
- radian
- slope
- x
- y

### Methods

- add
- clone
- copyFrom
- crossProd
- distSQ
- distance
- divide
- dotProd
- equals
- multiply
- normalize
- reverse
- setXY
- subtract
- toString
- truncate
- zero
- corner

## Constructors

### constructor

- new Vector2D(x?: number, y?: number, onChange?: Function): Vector2D

- Overrides HashObject.constructor

  - Defined in support/Vector2D.ts:39

  创建一个2D矢量

  #### Parameters

  - ##### Default value x: number = 0

    x分量

  - ##### Default value y: number = 0

    y分量

  - ##### Optional onChange: Function

    当改变时触发

  #### Returns Vector2D

## Properties

### Private _x

_x: number

- Defined in support/Vector2D.ts:37

### Private _y

_y: number

- Defined in support/Vector2D.ts:38

### Private onChange

onChange: Function

- Defined in support/Vector2D.ts:39

## Accessors

### angle

angle:

- Defined in support/Vector2D.ts:252
- Defined in support/Vector2D.ts:256

向量角度

### hashCode

hashCode:

Inherited from HashObject.hashCode

- Defined in core/HashObject.ts:21

### isNormalized

isNormalized:

- Defined in support/Vector2D.ts:152

是不是一个单位向量

### isZero

isZero:

- Defined in support/Vector2D.ts:131

是不是一个0向量

### length

length:

- Defined in support/Vector2D.ts:285
- Defined in support/Vector2D.ts:289

向量长度

### lengthSQ

lengthSQ:

- Defined in support/Vector2D.ts:297

获取向量长度的平方

### radian

radian:

- Defined in support/Vector2D.ts:264
- Defined in support/Vector2D.ts:269

向量弧度

### slope

slope:

- Defined in support/Vector2D.ts:304

获取向量斜率

### x

x:

- Defined in support/Vector2D.ts:60
- Defined in support/Vector2D.ts:64

x分量

### y

y:

- Defined in support/Vector2D.ts:76
- Defined in support/Vector2D.ts:80

y分量

## Methods

### add

- add(v2: any): Vector2D

- - Defined in support/Vector2D.ts:212

  向量加法

  #### Parameters

  - ##### v2: any

  #### Returns Vector2D

### clone

- clone(): Vector2D

- - Defined in support/Vector2D.ts:114

  克隆出一个向量

  #### Returns Vector2D

### copyFrom

- copyFrom(v2: any): Vector2D

- - Defined in support/Vector2D.ts:105

  从一个向量拷贝分量

  #### Parameters

  - ##### v2: any

  #### Returns Vector2D

### crossProd

- crossProd(v2: any): number

- - Defined in support/Vector2D.ts:186

  获取叉乘

  #### Parameters

  - ##### v2: any

  #### Returns number

### distSQ

- distSQ(v2: any): number

- - Defined in support/Vector2D.ts:194

  获取长度的平方

  #### Parameters

  - ##### v2: any

  #### Returns number

### distance

- distance(v2: any): number

- - Defined in support/Vector2D.ts:204

  获取两个向量的距离

  #### Parameters

  - ##### v2: any

  #### Returns number

### divide

- divide(value: number): Vector2D

- - Defined in support/Vector2D.ts:242

  向量除于某个数

  #### Parameters

  - ##### value: number

  #### Returns Vector2D

### dotProd

- dotProd(v2: any): number

- - Defined in support/Vector2D.ts:178

  获取点乘

  #### Parameters

  - ##### v2: any

  #### Returns number

### equals

- equals(v2: any): boolean

- - Defined in support/Vector2D.ts:277

  是否等于某个向量

  #### Parameters

  - ##### v2: any

  #### Returns boolean

### multiply

- multiply(value: number): Vector2D

- - Defined in support/Vector2D.ts:232

  向量乘于某个数

  #### Parameters

  - ##### value: number

  #### Returns Vector2D

### normalize

- normalize(): Vector2D

- - Defined in support/Vector2D.ts:138

  单位化向量

  #### Returns Vector2D

### reverse

- reverse(): Vector2D

- - Defined in support/Vector2D.ts:168

  向量反向

  #### Returns Vector2D

### setXY

- setXY(x?: number, y?: number): Vector2D

- - Defined in support/Vector2D.ts:94

  设置分量

  #### Parameters

  - ##### Default value x: number = 0

  - ##### Default value y: number = 0

  #### Returns Vector2D

### subtract

- subtract(v2: any): Vector2D

- - Defined in support/Vector2D.ts:222

  向量减法

  #### Parameters

  - ##### v2: any

  #### Returns Vector2D

### toString

- toString(): string

- - Defined in support/Vector2D.ts:308

  #### Returns string

### truncate

- truncate(max: any): Vector2D

- - Defined in support/Vector2D.ts:160

  截取向量长度

  #### Parameters

  - ##### max: any

  #### Returns Vector2D

### zero

- zero(): Vector2D

- - Defined in support/Vector2D.ts:121

  把向量置空

  #### Returns Vector2D

### Static corner

- corner(v1: any, v2: any): number

- - Defined in support/Vector2D.ts:312

  #### Parameters

  - ##### v1: any

  - ##### v2: any

  #### Returns number

Generated using TypeDoc