Пример #1
0
 public static bool IsPointInLine(Line line, XYZ point)
 {
     if (GeomUtil.IsEqual(point, line.GetEndPoint(0)) || GeomUtil.IsEqual(point, line.GetEndPoint(1)))
     {
         return(true);
     }
     if (GeomUtil.IsOppositeDirection(GeomUtil.SubXYZ(point, line.GetEndPoint(0)), GeomUtil.SubXYZ(point, line.GetEndPoint(1))))
     {
         return(true);
     }
     return(false);
 }
Пример #2
0
        public static PointComparePolygonResult PointComparePolygon(UV p, List <UV> polygon)
        {
            bool check1 = IsPointInPolygon(p, polygon);

            for (int i = 0; i < polygon.Count; i++)
            {
                if (GeomUtil.IsEqual(p, polygon[i]))
                {
                    return(PointComparePolygonResult.Node);
                }

                UV vec1 = GeomUtil.SubXYZ(p, polygon[i]);
                UV vec2 = null;
                if (i != polygon.Count - 1)
                {
                    if (GeomUtil.IsEqual(p, polygon[i + 1]))
                    {
                        continue;
                    }
                    vec2 = GeomUtil.SubXYZ(p, polygon[i + 1]);
                }
                else
                {
                    if (GeomUtil.IsEqual(p, polygon[0]))
                    {
                        continue;
                    }
                    vec2 = GeomUtil.SubXYZ(p, polygon[0]);
                }
                if (GeomUtil.IsOppositeDirection(vec1, vec2))
                {
                    return(PointComparePolygonResult.Boundary);
                }
            }
            if (check1)
            {
                return(PointComparePolygonResult.Inside);
            }
            return(PointComparePolygonResult.Outside);
        }