Example #1
0
        //checks the ratio of the dimension of a poly bbox to be of certain proportion or not
        internal static bool CheckPolyBBox(Polygon2d poly, double num = 3)
        {
            bool    check = false;
            Range2d range = poly.BBox;
            double  X     = range.Xrange.Span;
            double  Y     = range.Yrange.Span;

            if (Y < X)
            {
                double div1 = X / Y;
                if (div1 > num)
                {
                    check = true;
                }
            }
            else
            {
                double div1 = Y / X;
                if (div1 > num)
                {
                    check = true;
                }
            }
            return(check);
        }
Example #2
0
        //returns the highest and lowest point along with indices from a pointlist
        internal static Dictionary <string, object> ReturnHighestAndLowestPointofBBox(Polygon2d poly)
        {
            Range2d range = PolygonUtility.GetRang2DFromBBox(ReadData.FromPointsGetBoundingPoly(poly.Points));
            double  minX = range.Xrange.Min;
            double  maxX = range.Xrange.Max;
            double  minY = range.Yrange.Min;
            double  maxY = range.Yrange.Max;
            Point2d lowPt = new Point2d(minX, minY), hipt = new Point2d(maxX, maxY);


            return(new Dictionary <string, object>
            {
                { "LowerPoint", (lowPt) },
                { "HigherPoint", (hipt) },
            });
        }
Example #3
0
        //from point2d list get the range2d
        internal static Range2d FromPoint2dGetRange2D(List <Point2d> point2dList)
        {
            List <double> xCordList = new List <double>();
            List <double> yCordList = new List <double>();
            double        xMax = 0, xMin = 0, yMax = 0, yMin = 0;

            for (int i = 0; i < point2dList.Count; i++)
            {
                xCordList.Add(point2dList[i].X);
                yCordList.Add(point2dList[i].Y);
            }

            xMax = xCordList.Max();
            yMax = yCordList.Max();

            xMin = xCordList.Min();
            yMin = yCordList.Min();

            Range1d x = new Range1d(xMin, xMax);
            Range1d y = new Range1d(yMin, yMax);
            Range2d xyRange = new Range2d(x, y);

            return(xyRange);
        }