netDxf添加Spline

netDxf 3.0

通过控制点添加Spline样条曲线:

            DxfDocument dxfDoc = new DxfDocument();

            List controlPoints = new List();
            List weights = new List();
            short degree = 3;

            controlPoints.Add(new Vector3(1.0, 1.0, 0.0));
            controlPoints.Add(new Vector3(9.5, 3.0, 0.0));
            controlPoints.Add(new Vector3(7.5, 8.0, 0.0));
            controlPoints.Add(new Vector3(2.5, 4.5, 0.0));
            controlPoints.Add(new Vector3(0.5, 8.0, 0.0));
            controlPoints.Add(new Vector3(5.5, 9.0, 0.0));
            controlPoints.Add(new Vector3(6.5, 0.5, 0.0));

            weights.Add(1.0);
            weights.Add(1.0);
            weights.Add(1.0);
            weights.Add(1.0);
            weights.Add(1.0);
            weights.Add(1.0);
            weights.Add(1.0);

            Spline spline = new Spline(controlPoints, weights, degree);

            dxfDoc.Entities.Add(spline);

            dxfDoc.Save("Spline_demo.dxf");

            MessageBox.Show("Done.");

你可能感兴趣的:(开发,图形学,c#)