#21 新增gapXY用于平铺/滚动间距

This commit is contained in:
yhh
2020-08-07 15:34:42 +08:00
parent 1bf822725a
commit 463c64c628
9 changed files with 113 additions and 3 deletions

View File

@@ -154,6 +154,17 @@ module es {
return Math.sqrt((v1 * v1) + (v2 * v2));
}
/**
* 返回两个向量之间的角度,单位是度数
* @param from
* @param to
*/
public static angle(from: Vector2, to: Vector2): number{
from = Vector2.normalize(from);
to = Vector2.normalize(to);
return Math.acos(MathHelper.clamp(Vector2.dot(from, to), -1, 1)) * MathHelper.Rad2Deg;
}
/**
* 矢量反演的结果
* @param value