Beispiel #1
0
        private void operationSelectionAndExecution(string operation)
        {
            MathT  MT = new MathT();
            double num1, num2;

            switch (operation)
            {
            case "+":
                Console.WriteLine("Please enter the numbers you would like to find the sum of.");
                AcceptPairOfOperands(out num1, out num2);
                Console.WriteLine($"{MT.addition(num1, num2)} is the sum of {num1} and {num2}.");
                break;

            case "-":
                Console.WriteLine("Please enter the numbers you would like to find the difference of.");
                AcceptPairOfOperands(out num1, out num2);
                Console.WriteLine($"{(float)(MT.subtraction(num1, num2))} is the difference between {num1} and {num2}.");
                break;

            case "*":
                Console.WriteLine("Please enter the numbers you would like to find the product of.");
                AcceptPairOfOperands(out num1, out num2);
                Console.WriteLine($"{MT.multiplication(num1, num2)} is the product of {num1} and {num2}.");
                break;

            case "/":
                Console.WriteLine("Please enter the two operands you would like to get the quotient of.");
                do
                {
                    AcceptPairOfOperands(out num1, out num2);
                    if (num2 != 0)
                    {
                        break;
                    }
                    Console.WriteLine("The second number can't be zero.");
                } while (num2 == 0);

                Console.WriteLine($"{MT.division(num1, num2)} is the quotient of {num1} and {num2}");
                break;

            case "Done":

                Console.WriteLine("Thank you!");
                loopRun = false;
                break;

            case "done":

                Console.WriteLine("Thank you!");
                loopRun = false;
                break;
            }
        }
Beispiel #2
0
        public static bool Collide(out ContactManifold manifold,
                                   PolygonShape polygon1, Transform2D transform1,
                                   PolygonShape polygon2, Transform2D transform2)
        {
            var radius = Configuration.PolygonRadius * 2;

            var seperation1 = FindMaxSeperation(out int edge1, polygon1, transform1, polygon2, transform2);

            if (seperation1 > radius)
            {
                manifold = null;
                return(false);
            }

            var seperation2 = FindMaxSeperation(out int edge2, polygon2, transform2, polygon1, transform1);

            if (seperation2 > radius)
            {
                manifold = null;
                return(false);
            }

            var flip = 0;
            var tol  = 0.1f * Configuration.LinearSlop;

            if (seperation2 > seperation1 + tol)
            {
                MathT.Swap(ref polygon1, ref polygon2);
                MathT.Swap(ref transform1, ref transform2);
                MathT.Swap(ref edge1, ref edge2);
                flip = 1;
            }

            var incidentEdge = FindIncidentEdge(polygon1, transform1, edge1, polygon2, transform2);

            throw new NotImplementedException();
        }