Example #1
0
        /// <summary>
        /// 判断点是否在直线上
        /// </summary>
        /// <param name="p"></param>
        /// <param name="l"></param>
        /// <returns></returns>
        public static bool IsOnLine(this XYZ p, Line l)
        {
            XYZ end1 = l.GetEndPoint(0);
            XYZ end2 = l.GetEndPoint(1);

            XYZ vec_pToEnd1 = end1 - p;
            XYZ vec_pToEnd2 = end2 - p;

            if (p.DistanceTo(end1) < precision || p.DistanceTo(end2) < precision)
            {
                return(true);
            }

            if (vec_pToEnd1.IsOppositeDirection(vec_pToEnd2))
            {
                return(true);
            }

            return(false);
        }
Example #2
0
 public static bool IsParallel(this XYZ vector1, XYZ vector2)
 {
     return(vector1.IsSameDirection(vector2) || vector1.IsOppositeDirection(vector2));
 }