예제 #1
0
        public void ProjectOn(string v1S, string v2S, string evs)
        {
            var v1       = Vector.Parse(v1S);
            var v2       = Vector.Parse(v2S);
            var expected = Vector.Parse(evs);
            var actual   = v1.ProjectOn(v2);

            VectorAssert.Equal(expected, actual, 2);
        }
예제 #2
0
        public void Rotate(string vs, double angle, string evs)
        {
            var vector   = Vector.Parse(vs);
            var expected = Vector.Parse(evs);
            var actual   = vector.Rotate(angle);

            VectorAssert.Equal(expected, actual, 2);

            var roundtrip = actual.Rotate(-angle);

            VectorAssert.Equal(vector, roundtrip, 2);
        }
예제 #3
0
        public void SnapToOrtho(string vs, string evs)
        {
            var v        = Vector.Parse(vs);
            var expected = evs == "null" ? (Vector?)null : Vector.Parse(evs);
            var actual   = v.SnapToOrtho();

            VectorAssert.Equal(expected, actual, 2);

            var vMinus = v.Rotate(-44);

            actual = vMinus.SnapToOrtho();
            VectorAssert.Equal(expected, actual, 2);

            var vPlus = v.Rotate(44);

            actual = vPlus.SnapToOrtho();
            VectorAssert.Equal(expected, actual, 2);
        }