Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
247 views
in Technique[技术] by (71.8m points)

c# - How to get from many 2d planes a 3d plot?

I'm realy beginner in C# and i have a little bite difficulty with 3D plot in C#. I have alot of X and Y data points. X and Y for each profil make a 2d plot. I want to get all of profils together in 3d plot with constant steps (z).

I tried to do this with a chart in winform based on this question: How to plot a 3D Graph to represent an object in space

I have to admit, that does not work, like i am expecting. I've seen some programmers, who are using WPF for 3D plot. I did it in wpf through Point3D, but i don't think so, that my strategie on this was proper.

I can show some of my code:

        double y = 1;
        const double s = 0.1;


        for (int i = 0; i <= Profil; i++)
        //for (int i = 0; i < 5; i++)
        {
            try
            {

                for (int j = 0; j <= X[i].Count; j++)
                //for (int j = 0; j < 10; j++)
                {
                    try
                    {

                        Point3D p00 = new Point3D(X[i][j], Y[i][j], z);
                        Point3D p01 = new Point3D(X[i][j + 1], Y[i][j + 1], z);
                        Point3D p02 = new Point3D(X[i + 1][j], Y[i + 1][j], z + s);
                        Point3D p03 = new Point3D(X[i + 1][j + 1], Y[i + 1][j + 1], z + s);



                        // Add the triangles.
                        AddTriangle(mesh, p00, p01, p02);
                        AddTriangle(mesh, p01, p02, p03);


                    }

                    catch { continue; }



                }
                z += s;

            }
            catch { continue; }

        }

X and Y are two dimensional lists. Could somebody help me?

question from:https://stackoverflow.com/questions/65933338/how-to-get-from-many-2d-planes-a-3d-plot

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...