Exemple #1
0
        public void ShouldMultiplyAllComponentsByTheScalarAndReturnItself()
        {
            float   x       = 1.2f;
            float   y       = 3.456f;
            float   z       = 7.8901f;
            float   scalar  = 3.58f;
            PVector vectorA = new PVector(x, y, z);

            PVector returnedVector = vectorA.Mult(scalar);

            Assert.Equal(returnedVector, vectorA);

            Assert.Equal(x * scalar, vectorA.X);
            Assert.Equal(y * scalar, vectorA.Y);
            Assert.Equal(z * scalar, vectorA.Z);
        }
Exemple #2
0
        public void ShouldReturnMultipliedVectorWhithoutChangingOriginalVector()
        {
            float   x       = 1.2f;
            float   y       = 3.456f;
            float   z       = 7.8901f;
            float   scalar  = 3.58f;
            PVector vectorA = new PVector(x, y, z);

            PVector returnedVector = PVector.Mult(vectorA, scalar);

            Assert.Equal(x, vectorA.X);
            Assert.Equal(y, vectorA.Y);
            Assert.Equal(z, vectorA.Z);

            Assert.Equal(x * scalar, returnedVector.X);
            Assert.Equal(y * scalar, returnedVector.Y);
            Assert.Equal(z * scalar, returnedVector.Z);
        }