Exemple #1
0
        public static bool IsPointOnPolyline([NotNull] this Polyline pl, Point3d pt)
        {
            var isOn    = false;
            var ptZeroZ = new Point3d(pt.X, pt.Y, pl.Elevation);

            for (var i = 0; i < pl.NumberOfVertices; i++)
            {
                Curve3d seg = null;

                var segType = pl.GetSegmentType(i);
                if (segType == SegmentType.Arc)
                {
                    seg = pl.GetArcSegmentAt(i);
                }
                else if (segType == SegmentType.Line)
                {
                    seg = pl.GetLineSegmentAt(i);
                }

                if (seg != null)
                {
                    isOn = seg.IsOn(ptZeroZ);
                    if (isOn)
                    {
                        break;
                    }
                }
            }

            return(isOn);
        }
Exemple #2
0
        public static bool IsPointOnPolyline(Polyline pl, Point3d pt)
        {
            bool isOn = false;

            for (int i = 0; i < pl.NumberOfVertices; i++)
            {
                Curve3d     seg     = null;
                SegmentType segType = pl.GetSegmentType(i);
                if (segType == SegmentType.Arc)
                {
                    seg = pl.GetArcSegmentAt(i);
                }
                else if (segType == SegmentType.Line)
                {
                    seg = pl.GetLineSegmentAt(i);
                }
                if (seg != null)
                {
                    isOn = seg.IsOn(pt);
                    if (isOn)
                    {
                        break;
                    }
                }
            }
            return(isOn);
        }