Exemple #1
0
        public void CreateArcShouldWork()
        {
            var arc = (Curve)Modeler.CreateTrimmedArc(Vector3.Zero, Vector3.UnitZ, 10 * Vector3.UnitX, -10 * Vector3.UnitX);

            bool   isPeriodic;
            double end;
            bool   isClosed;
            double start;

            arc.GetEndParams(out start, out end, out isClosed, out isPeriodic);

            start.Should().Be(0);

            var startArray = (double[])arc.Evaluate2(start, 0);
            var endArray   = (double[])arc.Evaluate2(end, 0);

            startArray[0].Should().BeApproximately(10, 1e-5);
            startArray[1].Should().BeApproximately(0, 1e-5);
            startArray[1].Should().BeApproximately(0, 1e-5);

            endArray[0].Should().BeApproximately(-10, 1e-5); // This fails
            endArray[1].Should().BeApproximately(0, 1e-5);
            endArray[1].Should().BeApproximately(0, 1e-5);

            isClosed.Should().BeFalse(); // This fails
        }
        public void ForwardAndBackArcSplineConversionShouldWork()
        {
            CreatePartDoc(modelDoc =>
            {
                var trimCurve = (ICurve)Modeler.CreateTrimmedArc
                                    (Vector3.Zero
                                    , Vector3.UnitZ, 10 * Vector3.UnitX
                                    , -10 * Vector3.UnitX
                                    );

                var parameters  = trimCurve.ToBSpline3D(false);
                var swCurve     = parameters.ToCurve();
                var parameters2 = swCurve.ToBSpline3D(false);

                parameters2.Should().Be(parameters);

                //#####################################
                var d0 = swCurve.CreateWireBody().DisplayUndoable(modelDoc, Color.Blue);
                var d1 = trimCurve.CreateWireBody().DisplayUndoable(modelDoc, Color.Red);
                return(new CompositeDisposable(d0, d1));
            });
        }