예제 #1
0
        public double calcDefAngle(ref NewVector3D vec)
        {
            double dotResult = dotProduct(vec);
            double tmp       = dotResult / (this.magnitude * vec.magnitude);

            double epison = 0.0001;

            if (Math.Abs(tmp - 1) < epison)
            {
                tmp = 1;
            }
            else if (Math.Abs(tmp + 1) < epison)
            {
                tmp = -1;
            }

            double defAngle = Math.Acos(tmp);

            if (double.IsNaN(defAngle))
            {
                int test = 1;
            }

            return(defAngle);
        }
예제 #2
0
 /// 求向量点积
 public double dotProduct(NewVector3D A)
 {
     return(this.x * A.x + this.y * A.y + this.z * A.z);
 }