Home > @taiyuuki/utils > Vec2
Vec2 class
This API is provided as a beta preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
二维向量类
Signature:
typescript
declare class Vec2
declare class Vec2
Constructors
Constructor | Modifiers | Description |
---|---|---|
(constructor)(x, y) | (BETA) 类 Vec2 的构造函数,用于初始化 x 和 y 坐标。 |
Properties
Property | Modifiers | Type | Description |
---|---|---|---|
x | number | (BETA) | |
y | number | (BETA) |
Methods
Method | Modifiers | Description |
---|---|---|
add(v) | (BETA) 计算两个点相加 | |
cross(v) | (BETA) 计算两个点的叉积 | |
div(v) | (BETA) 计算两个点相除 | |
dot(v) | (BETA) 计算两个点的点积 | |
mul(v) | (BETA) 计算两个点相乘 | |
reflect(v) | (BETA) 计算这个向量在另一个向量方向上的反射(投影) | |
sub(v) | (BETA) 计算两个点相减 |