Пример #1
0
        public void AddingTuples()
        {
            var point  = Toople.Point(3f, -2f, 5f);
            var vector = Toople.Vector(-2f, 3f, 1f);

            var result = point + vector;

            result.Should().BeEquivalentTo(new Toople(1f, 1f, 6f, 1f));
        }
Пример #2
0
        public void Subtracting_vectorFromPoint()
        {
            var point  = Toople.Point(3f, 2f, 1f);
            var vector = Toople.Vector(5f, 6f, 7f);

            var result = point - vector;

            result.Should().BeEquivalentTo(Toople.Point(-2f, -4f, -6f));
        }
Пример #3
0
        public void Subtracting_twoPoints()
        {
            var pointA = Toople.Point(3f, 2f, 1f);
            var pointB = Toople.Point(5f, 6f, 7f);

            var result = pointA - pointB;

            result.Should().BeEquivalentTo(Toople.Vector(-2f, -4f, -6f));
        }
Пример #4
0
        public void EqualsWorks()
        {
            var point = Toople.Point(1f, 2f, 3f);

            point.Should().BeEquivalentTo(new Toople(1f, 2f, 3f, 1f));

            var p2 = Toople.Point(1f, 2f, 3f);

            point.Equals(p2).Should().BeTrue();

            var vector = Toople.Vector(1f, 2f, 3f);

            point.Equals(vector).Should().BeFalse();
        }
Пример #5
0
        static void Main(string[] args)
        {
            var projectile = new Projectile(
                Toople.Point(0, 1f, 0),
                Toople.Vector(1f, 1f, 1f).Normalize() * 4
                );

            var environment = new Environment(
                Toople.Vector(0, -0.1f, 0),
                Toople.Vector(-0.01f, 0, 0));

            var simulation = new Simulation(environment, projectile);
            var ticks      = simulation.Run();

            Console.WriteLine($"IMPACT! in {ticks} ticks");
        }
Пример #6
0
        public void Point_CreatesPoint()
        {
            var point = Toople.Point(1f, 2f, 3f);

            point.IsPoint.Should().BeTrue();
        }