感谢NEZ库提供的思路
This commit is contained in:
@@ -381,6 +381,16 @@ module es {
|
||||
return this.repeat(this.approach(start, start + deltaAngle, shift), 360);
|
||||
}
|
||||
|
||||
/**
|
||||
* 将 Vector 投影到另一个 Vector 上
|
||||
* @param other
|
||||
*/
|
||||
public static project(self: Vector2, other: Vector2) {
|
||||
let amt = Vector2.dot(self, other) / other.lengthSquared();
|
||||
let vec = new Vector2(amt * other.x, amt * other.y);
|
||||
return vec;
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过将偏移量(全部以弧度为单位)夹住结果并选择最短路径,起始角度朝向终止角度。
|
||||
* 起始值可以小于或大于终止值。
|
||||
|
||||
Reference in New Issue
Block a user