Esempio n. 1
0
        public Polygon CreatePolygonFromCurve(double from, double to, double padding)
        {
            var curve = new Curve();
            foreach (var point in this.Points)
            {
                curve.Points.Add(new Point(point));
            }

            curve = curve.RemoveOverlappingPoints2D();
            var len = curve.Length;
            curve = CurveStrategies.CutCurve(curve, from * len, to * len);
            curve = curve.RemoveOverlappingPoints2D();

            var curveLeft = curve.LateralOffsetCurve(Enums.LateralPosition.Left, padding).RemoveOverlappingPoints2D();
            var curveRight = curve.LateralOffsetCurve(Enums.LateralPosition.Right, padding).RemoveOverlappingPoints2D();

            var poly = new Polygon();
            foreach (var point in curveLeft.Points)
            {
                poly.Points.Add(point);
            }
            foreach (var point in curveRight.Points.Reverse())
            {
                poly.Points.Add(point);
            }
            poly.Points.Add(curveLeft.Points.First());
            return poly;
        }