コード例 #1
0
        public void NurbsCurvePoint_Works()
        {
            var p0 = new Point3d(0, 0, 0);
            var p1 = new Point3d(1, 3, 0);
            var p2 = new Point3d(1.4, 5, 0);
            var p3 = new Point3d(0, 7, 0);

            double[] U     = NurbsCalculator.CreateUnitKnotVector(3, 1);
            double[] U2    = NurbsCalculator.CreateUnitKnotVector(3, 2);
            double[] U3    = NurbsCalculator.CreateUnitKnotVector(3, 3);
            var      watch = new Stopwatch();

            watch.Start();
            const int n = 100;

            for (int i = 0; i <= n; i++)
            {
                var pt  = NurbsCalculator.CurvePoint(3, 1, U, new Point3d[] { p0, p1, p2, p3 }, (double)i / n);
                var pt2 = NurbsCalculator.CurvePoint(3, 2, U2, new Point3d[] { p0, p1, p2, p3 }, (double)i / n);
                var pt3 = NurbsCalculator.CurvePoint(3, 3, U3, new Point3d[] { p0, p1, p2, p3 }, (double)i / n);
                Console.WriteLine($"t: {(double)i / n} — {pt}");
                Console.WriteLine($"t: {(double)i / n} — {pt2}");
                Console.WriteLine($"t: {(double)i / n} — {pt3}");
                Console.WriteLine("---");
            }
            watch.Stop();
            Console.WriteLine(watch.Elapsed);
        }
コード例 #2
0
 public void TestKnotVectore()
 {
     var U  = NurbsCalculator.CreateUnitKnotVector(3, 1);
     var U2 = NurbsCalculator.CreateUnitKnotVector(3, 2);
     var U3 = NurbsCalculator.CreateUnitKnotVector(3, 3);
 }