Beispiel #1
0
 public static void determinerIntersectionDroiteCercle(cercle leCercle, droite laDroite, ref intersection intersectionObjet)
 {
     solution solutionIntersection = new solution();
     double angleRad = laDroite.droiteInclinaison;
     angleRad /= 1000;
     int alphaDegre = (int)Math.convertRadianToDegree(angleRad);
     int a = 1;
     int b = 2 * (int)(((laDroite.droiteOrigineX - leCercle.cercleCentreX) * Math.cosinus(alphaDegre)) + ((laDroite.droiteOrigineY - leCercle.cercleCentreY) * Math.sinus(alphaDegre)));
     int c = (laDroite.droiteOrigineX - leCercle.cercleCentreX) * (laDroite.droiteOrigineX - leCercle.cercleCentreX) + (laDroite.droiteOrigineY - leCercle.cercleCentreY) * (laDroite.droiteOrigineY - leCercle.cercleCentreY) - leCercle.cercleRayon * leCercle.cercleRayon;
     resoudre(a, b, c, ref solutionIntersection);
     switch (solutionIntersection.nature)
     {
         case natureSolution.NON_DETERMINEE:
             intersectionObjet.nature = natureIntersection.INFINITE;
             intersectionObjet.X1 = 0;
             intersectionObjet.Y1 = 0;
             break;
         case natureSolution.PAS_DE_SOLUTION:
             intersectionObjet.nature = natureIntersection.DISTINCT;
             intersectionObjet.X1 = 0;
             intersectionObjet.Y1 = 0;
             break;
         case natureSolution.SIMPLE:
             intersectionObjet.nature = natureIntersection.SECANT;
             intersectionObjet.X1 = (int)(laDroite.droiteOrigineX + solutionIntersection.X1 * (Microsoft.SPOT.Math.Cos(alphaDegre) / 1000));
             intersectionObjet.Y1 = (int)(laDroite.droiteOrigineY + solutionIntersection.X1 * (Microsoft.SPOT.Math.Sin(alphaDegre) / 1000));
             break;
         case natureSolution.DOUBLE:
             intersectionObjet.nature = natureIntersection.SECANT;
             intersectionObjet.X1 = (int)(laDroite.droiteOrigineX + solutionIntersection.X1 * cosinus(alphaDegre));
             intersectionObjet.Y1 = (int)(laDroite.droiteOrigineY + solutionIntersection.X1 * sinus(alphaDegre));
             intersectionObjet.X2 = (int)(laDroite.droiteOrigineX + solutionIntersection.X2 * cosinus(alphaDegre));
             intersectionObjet.Y2 = (int)(laDroite.droiteOrigineY + solutionIntersection.X2 * sinus(alphaDegre));
             break;
         case natureSolution.COMPLEXE:
             intersectionObjet.nature = natureIntersection.DISTINCT;
             break;
     }
 }
 => new((GetBaseActiveStatementSpansImpl ?? throw new NotImplementedException()).Invoke(solution, documentIds));
Beispiel #3
0
 => new((EmitSolutionUpdateImpl ?? throw new NotImplementedException()).Invoke(solution, activeStatementSpanProvider));
    public void TestCase9()
    {
        var _ = new solution();

        Assert.AreEqual(true, _.validate("355 032 5363"));
    }
    public void TestCase8()
    {
        var _ = new solution();

        Assert.AreEqual(true, _.validate("481 135"));
    }
    public void TestCase1()
    {
        var _ = new solution();

        Assert.AreEqual(false, _.validate("477 073 360"));
    }
    public void TestCase7()
    {
        var _ = new solution();

        Assert.AreEqual(true, _.validate("8383 7332 3570 8514"));
    }
    public void TestCase6()
    {
        var _ = new solution();

        Assert.AreEqual(false, _.validate("7164 6207 74042"));
    }
    public void TestCase5()
    {
        var _ = new solution();

        Assert.AreEqual(true, _.validate("0768 2757 5685 6340"));
    }
Beispiel #10
0
    public void TestCase4()
    {
        var _ = new solution();

        Assert.AreEqual(false, _.validate("6654 6310 43044"));
    }
Beispiel #11
0
    public void TestCase3()
    {
        var _ = new solution();

        Assert.AreEqual(true, _.validate("8314 7046 0245"));
    }
Beispiel #12
0
    public void TestCase2()
    {
        var _ = new solution();

        Assert.AreEqual(true, _.validate("5422 0148 5514"));
    }
Beispiel #13
0
 // Document adding...
 solution = addDocuments(solution, _documentsAddedInBatch.ToImmutable());
Beispiel #14
0
 await progressCollector.TryReportAsync(solution, location, symbol, cancellationToken).ConfigureAwait(false);
Beispiel #15
0
 Solution = StringTo2DChar(solution, Rows, Cols);
Beispiel #16
0
 public static void resoudre(double a, double b, double c, ref solution solution)
 {
     if (a == 0)
     {
         if (b == 0)
             if (c == 0)
                 solution.nature = natureSolution.NON_DETERMINEE;
             else
                 solution.nature = natureSolution.PAS_DE_SOLUTION;
         else
             if (c == 0)
             {
                 solution.nature = natureSolution.SIMPLE;
                 solution.X1 = 0;
                 solution.X2 = 0;
             }
             else
             {
                 solution.nature = natureSolution.SIMPLE;
                 solution.X1 = (-c / b);
                 solution.X2 = (-c / b);
             }
     }
     else
     {
         double discriminant = (b * b) - 4 * a * c;
         if (discriminant == 0)
         {
             solution.nature = natureSolution.SIMPLE;
             solution.X1 = (-b / 2 * a);
         }
         if (discriminant > 0)
         {
             solution.nature = natureSolution.DOUBLE;
             solution.X1 = (-b + System.Math.Pow(discriminant, 0.5) / 2 * a);
             solution.X2 = (-b - System.Math.Pow(discriminant, 0.5) / 2 * a);
         }
         else
         {
             solution.nature = natureSolution.COMPLEXE;
         }
     }
 }