Exemple #1
0
        /// <summary>
        /// Get a rectangle which contains a path along the given line 'pathWidth' wide
        /// </summary>
        /// <param name="pathWidth"></param>
        /// <returns></returns>
        public RectangleD GetPathRectangle(Double pathWidth, Double extend)
        {
            PointD p1 = ((PointD)P1).GetPointAt(Bearing.AddDegrees(90), pathWidth / 2) as PointD;
            PointD p2 = ((PointD)P1).GetPointAt(Bearing.SubtractDegrees(90), pathWidth / 2) as PointD;
            PointD p3 = ((PointD)P2).GetPointAt(Bearing.SubtractDegrees(90), pathWidth / 2) as PointD;
            PointD p4 = ((PointD)P2).GetPointAt(Bearing.AddDegrees(90), pathWidth / 2) as PointD;

            if (extend > 0)
            {
                p1 = p1.GetPointAt(Bearing.AddDegrees(180), extend) as PointD;
                p2 = p2.GetPointAt(Bearing.AddDegrees(180), extend) as PointD;
                p3 = p3.GetPointAt(Bearing, extend) as PointD;
                p4 = p4.GetPointAt(Bearing, extend) as PointD;
            }

            return(new RectangleD(p1, p2, p3, p4));
        }