Exemplo n.º 1
0
        public static IntersectionResult ArcArc(GArc arc, GLine line)
        {
            var result   = new IntersectionResult();
            var d        = line.EndPoint.Sub(line.StartPoint);
            var al       = Math.Atan(d.Y / d.X);
            var endAngle = arc.StartAngle - arc.SweepAngle;

            //no intersection
            if (al < arc.StartAngle || al > endAngle)
            {
                return(result);
            }
            else
            {
            }
            return(result);
        }
Exemplo n.º 2
0
        public static IntersectionResult ArcLine(GArc arc, GLine line)
        {
            var    result = new IntersectionResult();
            double dx     = line.EndPoint.X - line.StartPoint.X;
            double dy     = line.EndPoint.Y - line.StartPoint.Y;
            double theta  = Math.Atan2(dy, dx);
            var    d      = line.StartPoint.Distance(line.EndPoint);
            double r      = d - ((arc.MajorAxe * arc.MinorAxe) /
                                 Math.Sqrt(Math.Pow(arc.MinorAxe * Math.Cos(theta), 2)
                                           + Math.Pow(arc.MajorAxe * Math.Sin(theta), 2)));

            result.IntersectionPoints.Add(
                new PointF((float)(line.StartPoint.X + r * Math.Cos(theta)),
                           (float)(line.StartPoint.Y + r * Math.Sin(theta)))
                );
            return(result);
        }