コード例 #1
0
        public void CloneEqualValuesTest()
        {
            var ray       = new Ray2D(new Point2D(0, 0), new Vector2D(1, 0));
            var clonedRay = (Ray2D)ray.Clone();

            Assert.AreEqual(ray.Origin.X, clonedRay.Origin.X, Helper.E);
            Assert.AreEqual(ray.Origin.Y, clonedRay.Origin.Y, Helper.E);
            Assert.AreEqual(ray.Direction.X, clonedRay.Direction.X, Helper.E);
            Assert.AreEqual(ray.Direction.Y, clonedRay.Direction.Y, Helper.E);
        }
コード例 #2
0
        public void CloneNotEqualValuesTest()
        {
            var ray       = new Ray2D(new Point2D(0, 0), new Vector2D(1, 0));
            var clonedRay = (Ray2D)ray.Clone();

            clonedRay.Origin.Translate(Vector2D.One);
            clonedRay.Direction.RotateDegrees(45);

            Assert.AreNotEqual(ray.Origin.X, clonedRay.Origin.X, Helper.E);
            Assert.AreNotEqual(ray.Origin.Y, clonedRay.Origin.Y, Helper.E);
            Assert.AreNotEqual(ray.Direction.X, clonedRay.Direction.X, Helper.E);
            Assert.AreNotEqual(ray.Direction.Y, clonedRay.Direction.Y, Helper.E);
        }