Esempio n. 1
0
        public bool SharesEndpointAndBearing(Line other, Double distance, Double bearingSlack)
        {
            bool result =
                SharesEndPointWith(other, distance) &&
                (Bearing.AngularDifference(other.Bearing) <= bearingSlack || Bearing.AddDegrees(180).AngularDifference(other.Bearing) <= bearingSlack);

            return(result);
        }
Esempio n. 2
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));
        }
Esempio n. 3
0
 /// <summary>
 /// Roteate the bearing around the origin
 /// </summary>
 /// <param name="degrees"></param>
 public BearingAndRange Rotate(Double degrees)
 {
     return(new BearingAndRange(Bearing.AddDegrees(degrees), Range));
 }