Ejemplo n.º 1
0
        public void CurveKnotRefine2()
        {
            Array <object> pts = new Array <object>();

            for (int i = 0; i < 8; i++)
            {
                pts.push(new Array <double>(new double[] { i, 0, 0 }));
            }

            Array <double> knots    = new Array <double>(new double[] { 0, 0, 0, 0, 1, 2, 3, 4, 5, 5, 5, 5 });
            Array <double> weights  = new Array <double>(new double[] { 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 });
            Array <double> newKnots = new Array <double>(new double[] { 0.5 });

            verb.geom.NurbsCurve curve = verb.geom.NurbsCurve.byKnotsControlPointsWeights(3, knots, pts, weights);
            var curveData = new verb.core.NurbsCurveData(3, knots, pts);
            var after     = verb.eval.Modify.curveKnotRefine(curve._data, newKnots);

            _testOutput.WriteLine($"{after.controlPoints}");
        }
Ejemplo n.º 2
0
        public void rationalCurveRegularSample()
        {
            Array <object> pts = new Array <object>();

            pts.push(new Array <double>(new double[] { 1, 0, 0, 1 }));
            pts.push(new Array <double>(new double[] { 1, 1, 0, 1 }));
            pts.push(new Array <double>(new double[] { 0, 2, 0, 1 }));

            Array <double> knots = new Array <double>(new double[] { 0, 0, 0, 1, 1, 1 });

            NurbsCurveData curve = new verb.core.NurbsCurveData(2, knots, pts);

            Array <object> p = verb.eval.Tess.rationalCurveRegularSample(curve, 10, true);

            _testOutput.WriteLine($"{p.length}");
            for (int i = 0; i < p.length; i++)
            {
                _testOutput.WriteLine($"{p[i]}");
            }
        }
Ejemplo n.º 3
0
        public void RevolvedSurface()
        {
            var axis   = new Array <double>(new double[] { 0, 0, 1 });
            var pt     = new Array <double>(new double[] { 0, 0, 1 });
            var xaxis  = new Array <double>(new double[] { 1, 0, 0 });
            var center = new Array <double>(new double[] { 0, 0, 0 });

            var arc = new Arc(center, axis, xaxis, 1, 0.0, Math.PI);

            Array <object> pts = new Array <object>();

            pts.push(new Array <double>(new double[] { 1, 0, 0, 1 }));
            pts.push(new Array <double>(new double[] { 0, 0, 1, 1 }));
            Array <double> knots   = new Array <double>(new double[] { 0.0, 0.0, 1.0, 1.0 });
            var            profile = new verb.core.NurbsCurveData(1, knots, pts);

            var comps = verb.eval.Make.revolvedSurface(arc._data, center, axis, 0.25 * Math.PI);

            for (int i = 0; i < comps.controlPoints.length; i++)
            {
                var h = verb.eval.Eval.dehomogenize1d((Array <object>)comps.controlPoints.__a[i]);
                _testOutput.WriteLine($"{h}");
            }
        }