/// <summary> /// LT /// </summary> /// <param name="v"></param> /// <returns></returns> public bool Contains(Vector2 v) { var lt = pos - size * pivot; var rb = pos + size * (Vector2.one - pivot); return(MathTool.Between(v, lt, rb)); }
public Quaternion Rotate(Vector3 euler) { var n = new Coordinate(this); Quaternion result = origin; Quaternion rot; switch (order) { case EulerOrder.XYZ: Debug.LogError("undefined order"); break; case EulerOrder.XZY: Debug.LogError("undefined order"); break; case EulerOrder.YXZ: // 动态坐标轴 y x z rot = Quaternion.AngleAxis(euler.y, n.up); result = rot * result; n *= rot; rot = Quaternion.AngleAxis(euler.x, n.right); result = rot * result; n *= rot; rot = Quaternion.AngleAxis(euler.z, n.forward); result = rot * result; break; case EulerOrder.YZX: Debug.LogError("undefined order"); break; case EulerOrder.ZXY: // 动态坐标轴 z x y rot = Quaternion.AngleAxis(euler.z, n.forward); result = rot * result; n *= rot; rot = Quaternion.AngleAxis(euler.x, n.right); result = rot * result; n *= rot; rot = Quaternion.AngleAxis(euler.y, n.up); result = rot * result; break; case EulerOrder.ZYX: Debug.LogError("undefined order"); break; default: Debug.LogError("undefined order"); break; } if (MathTool.IsNaN(result)) { Debug.LogError("Nan"); } return(result); }
// return remove count int RemoveTimeOf(Curve2 curve, float time) { int c = 0; var t = new List <Key2>(curve); foreach (var key in t) { if (MathTool.Approx(key.time, time, 3)) { curve.Remove(key); c++; } } return(c); }
public void Rotate() { if (MathTool.IsNaN(euler)) { Debug.LogError("Nan"); } euler = DOFLiminator.LimitDOF(euler, dof); if (MathTool.IsNaN(euler)) { Debug.LogError("Nan"); // 用于断点 } var rot = coord.Rotate(euler); if (MathTool.IsNaN(rot)) { Debug.LogError("Nan"); } transform.localRotation = rot; }
public void Update() { euler = MathTool.NaNTo0(euler); Rotate(); }