Example #1
0
        static void Main(string[] args)
        {
            Cube           A             = new Cube(new Coordinate(0, 0, 0), 2);
            Cube           B             = new Cube(new Coordinate(1, 1, 0), 2);
            ICollisionCalc calc          = CollisionCalcFactory.CreateCollisionCalc(A, B);
            float          colidedVolume = calc.CollidedVolume();

            Console.WriteLine($"Collision Volume: {colidedVolume}");
            Console.ReadLine();
        }
Example #2
0
        private void ButtonCalculate_Click(object sender, RoutedEventArgs e)
        {
            Cube A = new Cube(new Coordinate(int.Parse(X1.Text), int.Parse(Y1.Text), int.Parse(Z1.Text))
                              , int.Parse(H1.Text));
            Cube B = new Cube(new Coordinate(int.Parse(X2.Text), int.Parse(Y2.Text), int.Parse(Z2.Text))
                              , int.Parse(H2.Text));
            ICollisionCalc calc          = CollisionCalcFactory.CreateCollisionCalc(A, B);
            float          colidedVolume = calc.CollidedVolume();

            Messages.ShowResultVolumeMessage(colidedVolume);
        }
        public void CubesCollidingPartiallyCollide(int x, int y, int z, int height,
                                                   X a, Y b, Z c, int height2, int expectedVolume, string test)
        {
            string         testName      = $"{a.ToString()} {b.ToString()} {c.ToString()} {test}";
            Cube           A             = new Cube(new Coordinate(x, y, z), height);
            Cube           B             = new Cube(new Coordinate((int)a, (int)b, (int)c), height2);
            ICollisionCalc calc          = CollisionCalcFactory.CreateCollisionCalc(A, B);
            float          colidedVolume = calc.CollidedVolume();

            Assert.AreEqual(expectedVolume, colidedVolume, testName);
        }