Пример #1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Arc"/> class.
 /// </summary>
 /// <param name="arc">A <see cref="Arc"/> instance.</param>
 public Arc(Arc arc)
 {
     _pCenter = arc._pCenter;
     _radius = arc._radius;
     _angle0 = arc._angle0;
     _angle1 = arc._angle1;
 }
Пример #2
0
        public static bool SegmentToAboveArc(Segment seg, Arc arcAbove, ref double distance)
        {
            bool success = false;
            distance = double.MaxValue;
            List<Segment> listArc = arcAbove.Explode(20);

            foreach (Segment segArc in listArc)
            {
                double dist = 0.0f;
                if (PointToAboveSegment(seg.P0, segArc, ref dist) && dist > 0)
                {
                    distance = System.Math.Min(distance, dist);
                    success = true;
                }
                if (PointToAboveSegment(seg.P1, segArc, ref dist) && dist > 0)
                {
                    distance = System.Math.Min(distance, dist);
                    success = true;
                }
                if (PointToAboveSegment(segArc.P0, seg, ref dist) && dist < 0)
                {
                    distance = System.Math.Min(distance, -dist);
                    success = true;
                }
                if (PointToAboveSegment(segArc.P1, seg, ref dist) && dist < 0)
                {
                    distance = System.Math.Min(distance, -dist);
                    success = true;
                }
            }
            return success;
        }
Пример #3
0
 private static void TestArcToAboveArc()
 {
     Arc arc0 = new Arc(Vector2D.Zero, 1.0f, -45.0f, -135.0f);
     Arc arc1 = new Arc(new Vector2D(0.0, 10.0), 1.0f, 45.0f, 135.0f);
     double distance = 0.0;
     VerticalDistance.ArcToAboveArc(arc0, arc1, ref distance);
     Console.WriteLine(string.Format("TestArcToAboveArc = {0}", distance));
 }
Пример #4
0
 private static void TestArcToAboveSegment()
 {
     Arc arc = new Arc(Vector2D.Zero, 1.0f, -45.0f, -135.0f);
     Segment seg = new Segment(new Vector2D(-10.0f, 10.0f), new Vector2D(10.0f, 10.0f));
     double distance = 0.0;
     VerticalDistance.ArcToAboveSegment(arc, seg, ref distance);
     Console.WriteLine(string.Format("ArcToAboveSegment = {0}", distance));
 }
Пример #5
0
 private static void TestArcToAboveArcTransformed()
 {
     Transform2D transf = Transform2D.Rotation(90.0);
     Arc arc0 = new Arc(Vector2D.Zero, 1.0f, -45.0f, 45.0f);
     arc0.Transform(transf);
     Arc arc1 = new Arc(new Vector2D(10.0, 0.0), 1.0f, 0.0f, 360.0f);
     arc1.Transform(transf);
     double distance = 0.0;
     VerticalDistance.ArcToAboveArc(arc0, arc1, ref distance);
     Console.WriteLine(string.Format("TestArcToAboveArcTransformed = {0}", distance));
 }
Пример #6
0
 public static bool PointToAboveArc(Vector2D p, Arc arc, ref double distance)
 {
     bool success = false;
     distance = double.MaxValue;
     IList<Segment> list = arc.Explode(20);
     foreach (Segment seg in list)
     {
         double dist = 0.0f;
         if (PointToAboveSegment(p, seg, ref dist) && dist > 0)
         {
             distance = System.Math.Min(dist, distance);
             success = true;
         }
     }
     return success;
 }
Пример #7
0
        public static bool ArcToAboveArc(Arc arc1, Arc arc2, ref double distance)
        {
            bool success = false;
            distance = double.MaxValue;
            List<Segment> listArc1 = arc1.Explode(20);
            List<Segment> listArc2 = arc2.Explode(20);

            foreach (Segment seg1 in listArc1)
                foreach (Segment seg2 in listArc2)
                {
                    double dist = double.MaxValue;
                    if (VerticalDistance.SegmentToAboveSegment(seg1, seg2, ref dist) && dist > 0)
                    {
                        distance = System.Math.Min(distance, dist);
                        success = true;
                    }
                }
            return success;
        }