コード例 #1
0
        //返回两向量的夹角(角度制)
        static public double Angle(Vector3_DW lhs, Vector3_DW rhs)
        {
            double ll = lhs.Magnitude();
            double rl = rhs.Magnitude();

            if (ToolsMath_DW.IsZero(ll) || ToolsMath_DW.IsZero(rl))
            {
                return(0);
            }
            double angle = Math.Acos((lhs.X * rhs.X + lhs.Y * rhs.Y + lhs.Z * rhs.Z) / (ll * rl));

            angle *= (180 / Math.PI);
            return(angle);
        }
コード例 #2
0
        static public double Distance(Vector3_DW a, Vector3_DW b)
        {
            Vector3_DW vec = b - a;

            return(vec.Magnitude());
        }
コード例 #3
0
 //返回两向量的夹角(角度制)
 public static double Angle(Vector3_DW lhs, Vector3_DW rhs)
 {
     double ll = lhs.Magnitude();
     double rl = rhs.Magnitude();
     if (ToolsMath_DW.IsZero(ll) || ToolsMath_DW.IsZero(rl))
     {
         return 0;
     }
     double angle = Math.Acos((lhs.X * rhs.X + lhs.Y * rhs.Y + lhs.Z * rhs.Z) / (ll * rl));
     angle *= (180 / Math.PI);
     return angle;
 }