Example #1
0
        /// <summary>
        /// Determines whether the polyline is closed, provided a tolerance value.
        /// </summary>
        /// <param name="tolerance">If the distance between the start and end point of the polyline
        /// is less than tolerance, the polyline is considered to be closed.</param>
        /// <returns>true if the polyline is closed to within tolerance, false otherwise.</returns>
        /// <since>5.0</since>
        public bool IsClosedWithinTolerance(double tolerance)
        {
            if (m_size <= 2)
            {
                return(false);
            }

            if (tolerance <= 0.0)
            {
                int rc = UnsafeNativeMethods.ONC_ComparePoint(3, false, First, Last);
                return(rc == 0);
            }
            return(First.DistanceTo(Last) <= tolerance);
        }