示例#1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="geometry"></param>
        /// <returns></returns>
        protected ILineString HorizontalBisector(IGeometry geometry)
        {
            Envelope envelope = geometry.EnvelopeInternal;

            /**
             * Original algorithm.  Fails when geometry contains a horizontal
             * segment at the Y midpoint.
             */
            // Assert: for areas, minx <> maxx
            //double avgY = Avg(envelope.MinY, envelope.MaxY);
            double bisectY = SafeBisectorFinder.GetBisectorY((IPolygon)geometry);

            return(_factory.CreateLineString(
                       new[] { new Coordinate(envelope.MinX, bisectY), new Coordinate(envelope.MaxX, bisectY) }));
        }
示例#2
0
            public static double GetBisectorY(IPolygon poly)
            {
                var finder = new SafeBisectorFinder(poly);

                return(finder.GetBisectorY());
            }
 public static double GetBisectorY(IPolygon poly)
 {
     var finder = new SafeBisectorFinder(poly);
     return finder.GetBisectorY();
 }