コード例 #1
0
        public void ShouldNotChangeMagnitudeIfActualMagnitudeIsLowerThanMaxValue()
        {
            PVector vectorA           = new PVector(1, 2, 2); // Magnitude 3
            float   originalMagnitude = vectorA.Mag();
            float   maxMagnitude      = 5f;
            PVector limitedVector     = vectorA.Limit(maxMagnitude);
            float   newMagnitude      = limitedVector.Mag();

            Assert.Same(vectorA, limitedVector);
            Assert.Equal(3f, originalMagnitude);
            Assert.Equal(originalMagnitude, newMagnitude);
        }