示例#1
0
    /// <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);
    }
示例#2
0
    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));
    }
示例#3
0
文件: Int3.cs 项目: end1220/xlab
    public static VFactor AngleInt(Int3 lhs, Int3 rhs)
    {
        long den = lhs.magnitude * rhs.magnitude;

        return(IntMath.acos((long)Dot(ref lhs, ref rhs), den));
    }