示例#1
0
        public void TranslateSnapsAllAxes()
        {
            var cur = new Vector3(.15f, .28f, .15f);

            Assert.AreEqual(Snapping.Round(cur, .5f), new Vector3(0f, .5f, 0f));

            cur = new Vector3(.15f, .15f, .9f);
            Assert.AreEqual(Snapping.Round(cur, .5f), new Vector3(0f, 0f, 1f));

            cur = new Vector3(.15f, .3f, .9f);
            Assert.AreEqual(Snapping.Round(cur, .5f), new Vector3(0f, .5f, 1f));
        }
        public void TranslateOnlySnapsChangedAxis()
        {
            var old = new Vector3(.15f, .15f, .15f);
            var cur = new Vector3(.15f, .28f, .15f);

            Assert.AreEqual(Snapping.Round(cur, cur - old, .5f), new Vector3(.15f, .5f, .15f));

            cur = new Vector3(.15f, .15f, .9f);
            Assert.AreEqual(Snapping.Round(cur, cur - old, .5f), new Vector3(.15f, .15f, 1f));

            cur = new Vector3(.15f, .3f, .9f);
            Assert.AreEqual(Snapping.Round(cur, cur - old, .5f), new Vector3(.15f, .5f, 1f));
        }