/// <summary> /// 球形插值 /// </summary> /// <param name="start"></param> /// <param name="end"></param> /// <param name="percent"></param> /// <returns></returns> public static VInt3 Slerp(VInt3 start, VInt3 end, VFactor percent) { if (percent == VFactor.zero) { return(start); } else if (percent == VFactor.one) { return(end); } long den = start.magnitude * end.magnitude; VFactor dot = new VFactor((long)Dot(ref start, ref end), den); VFactor angle = IntMath.acos(dot.nom, dot.den); VFactor theta = angle * percent; VInt3 RelativeVec = end - start * dot; RelativeVec.NormalizeTo(Precision); VFactor sin_theta, cos_thera; IntMath.sincos(out sin_theta, out cos_thera, theta); return(start * cos_thera + RelativeVec * sin_theta); }
public static VFactor AngleInt(VInt3 lhs, VInt3 rhs) { long den = (long)lhs.magnitude * (long)rhs.magnitude; return(IntMath.acos((long)VInt3.Dot(ref lhs, ref rhs), den)); }
public static VFactor AngleInt(Int3 lhs, Int3 rhs) { long den = lhs.magnitude * rhs.magnitude; return(IntMath.acos((long)Dot(ref lhs, ref rhs), den)); }