Example #1
0
        private void TestToStringWithCulture(CultureInfo culture)
        {
            CultureInfo originalCulture = Thread.CurrentThread.CurrentCulture;
            Thread.CurrentThread.CurrentCulture = culture;
            try
            {
                string listSeparator = culture.TextInfo.ListSeparator;
                string decimalSeparator = culture.NumberFormat.NumberDecimalSeparator;
                var o = new BezierSpline();
                var controlPoint1 = new Vec3F(1.1f, 2.2f, 3.3f);
                var controlPoint2 = new Vec3F(4.4f, 5.5f, 6.6f);
                var controlPoint3 = new Vec3F(7.7f, 8.8f, 9.9f);
                var incomingTangent = new Vec3F(-1.0f, -2.0f, -3.0f);
                var outgoingTangent = new Vec3F(1.0f, 2.0f, 3.0f);
                o.Add(new BezierPoint(controlPoint1, incomingTangent, outgoingTangent));
                o.Add(new BezierPoint(controlPoint2, incomingTangent, outgoingTangent));
                o.Add(new BezierPoint(controlPoint3, incomingTangent, outgoingTangent));

                string s = o.ToString(null, null);
                TestToStringResults(o, s, listSeparator, decimalSeparator);

                string s2 = o.ToString();
                Assert.AreEqual(s, s2);

                s = o.ToString("G", culture);
                TestToStringResults(o, s, listSeparator, decimalSeparator);

                s = o.ToString("R", culture);
                TestToStringResults(o, s, listSeparator, decimalSeparator);
            }
            finally
            {
                Thread.CurrentThread.CurrentCulture = originalCulture;
            }
        }
Example #2
0
File: Curve.cs Project: ldh9451/XLE
        public BezierSpline CreateSpline()
        {
            IList<IControlPoint> points = GetChildList<IControlPoint>(Schema.bezierType.pointChild);
            BezierSpline spline = new BezierSpline();
            spline.IsClosed = GetAttribute<bool>(Schema.bezierType.isClosedAttribute);

            BezierPoint bpt = new BezierPoint();
            foreach (var cpt in points)
            {
                bpt.Position = cpt.Translation;
                spline.Add(bpt);
            }
            return spline;
        }
Example #3
0
        private void TestToStringWithCulture(CultureInfo culture)
        {
            CultureInfo originalCulture = Thread.CurrentThread.CurrentCulture;

            Thread.CurrentThread.CurrentCulture = culture;
            try
            {
                string listSeparator    = culture.TextInfo.ListSeparator;
                string decimalSeparator = culture.NumberFormat.NumberDecimalSeparator;
                var    o               = new BezierSpline();
                var    controlPoint1   = new Vec3F(1.1f, 2.2f, 3.3f);
                var    controlPoint2   = new Vec3F(4.4f, 5.5f, 6.6f);
                var    controlPoint3   = new Vec3F(7.7f, 8.8f, 9.9f);
                var    incomingTangent = new Vec3F(-1.0f, -2.0f, -3.0f);
                var    outgoingTangent = new Vec3F(1.0f, 2.0f, 3.0f);
                o.Add(new BezierPoint(controlPoint1, incomingTangent, outgoingTangent));
                o.Add(new BezierPoint(controlPoint2, incomingTangent, outgoingTangent));
                o.Add(new BezierPoint(controlPoint3, incomingTangent, outgoingTangent));

                string s = o.ToString(null, null);
                TestToStringResults(o, s, listSeparator, decimalSeparator);

                string s2 = o.ToString();
                Assert.AreEqual(s, s2);

                s = o.ToString("G", culture);
                TestToStringResults(o, s, listSeparator, decimalSeparator);

                s = o.ToString("R", culture);
                TestToStringResults(o, s, listSeparator, decimalSeparator);
            }
            finally
            {
                Thread.CurrentThread.CurrentCulture = originalCulture;
            }
        }
Example #4
0
        public BezierSpline CreateSpline()
        {
            IList <IControlPoint> points = GetChildList <IControlPoint>(Schema.bezierType.pointChild);
            BezierSpline          spline = new BezierSpline();

            spline.IsClosed = GetAttribute <bool>(Schema.bezierType.isClosedAttribute);

            BezierPoint bpt = new BezierPoint();

            foreach (var cpt in points)
            {
                bpt.Position = cpt.Translation;
                spline.Add(bpt);
            }
            return(spline);
        }