예제 #1
0
        /// <summary>
        /// Searches three independent points of A, B, C, D and
        /// calls <see cref="From3IndependentPoints"/> for this three points and returns this base.
        /// </summary>
        /// <param name="A">1.Point</param>
        /// <param name="B">2.Point</param>
        /// <param name="C">3.Point</param>
        /// <param name="D">4.Point</param>
        /// <returns>A normalized base</returns>
        public static Base From4Points(xyz A, xyz B, xyz C, xyz D)
        {
            if (((B - A) & (C - A)).length() > 0.0001)
            {
                return(Base.From3IndependentPoints(A, B, C));
            }
            if (((C - A) & (D - A)).length() > 0.0001)
            {
                return(Base.From3IndependentPoints(A, D, C));
            }
            if (((C - B) & (D - B)).length() > 0.0001)
            {
                return(Base.From3IndependentPoints(B, C, D));
            }
            if (((D - B) & (A - B)).length() > 0.0001)
            {
                return(Base.From3IndependentPoints(B, D, A));
            }

            throw new Exception("No independent points to create a Base");
        }