Ejemplo n.º 1
0
        public void Reflect(Segment s)
        {
            // NOTES:
            // Arcs can go to lines, and lines to arcs.
            // Rotations may reverse arc directions as well.
            // Arc centers can't be transformed directly.

            // NOTE: We must calc this before altering the endpoints.
            Vector3D mid = Midpoint;

            if (Infinity.IsInfinite(mid))
            {
                mid = Infinity.IsInfinite(s.P1) ? s.P2 * Infinity.FiniteScale : s.P1 * Infinity.FiniteScale;
            }

            P1  = s.ReflectPoint(P1);
            P2  = s.ReflectPoint(P2);
            mid = s.ReflectPoint(mid);

            // Can we make a circle out of the reflected points?
            Circle temp = new Circle();

            if (!Infinity.IsInfinite(P1) && !Infinity.IsInfinite(P2) && !Infinity.IsInfinite(mid) &&
                temp.From3Points(P1, mid, P2))
            {
                Type   = SegmentType.Arc;
                Center = temp.Center;

                // Work out the orientation of the arc.
                Vector3D t1 = P1 - Center;
                Vector3D t2 = mid - Center;
                Vector3D t3 = P2 - Center;
                double   a1 = Euclidean2D.AngleToCounterClock(t2, t1);
                double   a2 = Euclidean2D.AngleToCounterClock(t3, t1);
                Clockwise = a2 > a1;
            }
            else
            {
                // The circle construction fails if the points
                // are colinear (if the arc has been transformed into a line).
                Type = SegmentType.Line;

                // XXX - need to do something about this.
                // Turn into 2 segments?
                //if( isInfinite( mid ) )
                // Actually the check should just be whether mid is between p1 and p2.
            }
        }
Ejemplo n.º 2
0
 public void Reflect(Segment s)
 {
     // Just reflect all our segments.
     for (int i = 0; i < Segments.Count; i++)
     {
         Segments[i].Reflect(s);
     }
     Center = s.ReflectPoint(Center);
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Reflect ourselves about a segment.
 /// </summary>
 public virtual void Reflect(Segment s)
 {
     if (SegmentType.Arc == s.Type)
     {
         ReflectInternal(s.Circle);
     }
     else
     {
         // We just need to reflect the center.
         Center = s.ReflectPoint(Center);
     }
 }
Ejemplo n.º 4
0
 public override void Reflect(Segment s)
 {
     base.Reflect(s);
     CenterNE = s.ReflectPoint(CenterNE);
 }