Ejemplo n.º 1
0
 public Generator(P2D A, P2D B, D2 l2, D2 h2)
 {
     this.A  = A;
     this.B  = B;
     this.l2 = l2;
     this.h2 = h2;
 }
Ejemplo n.º 2
0
 public void DisplayAllConstruct(P2D p, D2 l2, ITreatConstruct tc)
 {
     _dPoints.Clear();
     _dDistances2.Clear();
     Console.WriteLine("=== Point ===");
     DisplayConstruct(p, tc);
     Console.WriteLine("=== Distance ===");
     DisplayConstruct(l2, tc);
 }
Ejemplo n.º 3
0
 public void DisplayConstruct(P2D p, ITreatConstruct tc)
 {
     if (!_dPoints.Contains(p))
     {
         _dPoints.Add(p);
         tc.Display(p);
         if (p.g != null)
         {
             DisplayConstruct(p.g.A, tc);
             DisplayConstruct(p.g.B, tc);
             DisplayConstruct(p.g.l2, tc);
             DisplayConstruct(p.g.h2, tc);
         }
     }
 }
Ejemplo n.º 4
0
        // Genere 4 points depuis segment [A,B] avec compas et distance a2 et b2 (carre)
        // Pour generer la construction
        // garder les references de generation
        // points => distances
        // M <= (A, B, l2, h2)
        // d2 <= (C, D)
        public List <P2D> Generate() //P2D A, P2D B, double l2, double h2)
        {
            var AB = B - A;
            var d2 = AB.Norm2();
            var d  = Math.Sqrt(AB.Norm2());

            var lp = new List <P2D>();

            if (l2.Value + h2.Value > d2)
            {
                double alpha  = 0.5 * (d + ((l2.Value - h2.Value) / d));
                double beta   = 0.5 * (d + ((h2.Value - l2.Value) / d));
                double lambda = Math.Sqrt(l2.Value - alpha * alpha);
                lp.Add(A + (1 / d) * (alpha * AB + lambda * P2D.Orthogonal(AB)));
                lp.Add(A + (1 / d) * (alpha * AB - lambda * P2D.Orthogonal(AB)));
                lp.Add(A + (1 / d) * (beta * AB + lambda * P2D.Orthogonal(AB)));
                lp.Add(A + (1 / d) * (beta * AB - lambda * P2D.Orthogonal(AB)));
            }
            foreach (var p in lp)
            {
                p.g = this;
            }
            return(lp);
        }
Ejemplo n.º 5
0
 public D2(double Value, P2D A, P2D B)
 {
     this.Value = Value;
     this.A     = A;
     this.B     = B;
 }
Ejemplo n.º 6
0
 public static P2D Orthogonal(P2D V)
 {
     return(new P2D(-V.y, V.x));
 }