Ejemplo n.º 1
0
        public static void SetHandleTip()
        {
            double tolerance = 0.0001;

            CartesianCoordinate controlPoint = new CartesianCoordinate(2, 5, tolerance);
            double      radius      = 5;
            Angle       rotation    = new Angle(Numbers.PiOver4);
            CurveHandle curveHandle = new CurveHandle(controlPoint, radius, rotation);

            Assert.AreEqual(controlPoint, curveHandle.ControlPoint);
            Assert.AreEqual(radius, curveHandle.Radius);
            Assert.AreEqual(rotation, curveHandle.Rotation);

            CartesianCoordinate expectedHandleTip = new CartesianCoordinate(5.53553, 8.53553, tolerance);
            CartesianCoordinate handleTip         = curveHandle.GetHandleTip();

            Assert.AreEqual(expectedHandleTip, handleTip);

            CartesianCoordinate newHandleTipExpected = new CartesianCoordinate(2, 7, tolerance);

            curveHandle.SetHandleTip(newHandleTipExpected);
            CartesianCoordinate newHandleTip = curveHandle.GetHandleTip();

            Assert.AreEqual(controlPoint, curveHandle.ControlPoint);
            Assert.AreEqual(2, curveHandle.Radius);
            Assert.AreEqual(Numbers.PiOver2, curveHandle.Rotation.Radians, Tolerance);

            Assert.AreEqual(newHandleTipExpected, newHandleTip);
        }
Ejemplo n.º 2
0
        public static void GetHandleTip()
        {
            double tolerance = 0.0001;
            CartesianCoordinate controlPoint = new CartesianCoordinate(2, 5, tolerance);
            double      radius      = 5;
            Angle       rotation    = new Angle(Numbers.PiOver4);
            CurveHandle curveHandle = new CurveHandle(controlPoint, radius, rotation);

            CartesianCoordinate expectedHandleTip = new CartesianCoordinate(5.53553, 8.53553, tolerance);
            CartesianCoordinate handleTip         = curveHandle.GetHandleTip();

            Assert.AreEqual(expectedHandleTip, handleTip);
        }