Android 3D 曲面图

MRS*_*_GT 5 3d android opengl-es

我的要求是从数据点 (xyz) 值列表中创建一个 3d 曲面图(还应该显示 xyz 轴)。 3d 可视化应该在 ANDROID 上完成。

我的输入:目前计划使用 open gl 1.0 和 java。我也在考虑使用 open gl 1.0 的 Adore3d 、 min3d 和 rgl 包。擅长java,但3d编程新手。
时限:2个月

我想知道最好的方法是什么?opengl 1.0 适合 3d 曲面绘图吗?还有其他可以与 Android 一起使用的包/库吗?

the*_*ine 5

那么,您可以使用 OpenGL 1.0 或 OpenGL 2.0 绘制曲面。您所需要做的就是将轴绘制为直线并将曲面绘制为三角形。如果你有高度场数据,你会这样做:

float[][] surface;
int width, height; // 2D surface data and it's dimensions

GL.glBegin(GL.GL_LINES);
GL.glVertex3f(0, 0, 0); // line starting at 0, 0, 0
GL.glVertex3f(width, 0, 0); // line ending at width, 0, 0
GL.glVertex3f(0, 0, 0); // line starting at 0, 0, 0
GL.glVertex3f(0, 0, height); // line ending at 0, 0, height
GL.glVertex3f(0, 0, 0); // line starting at 0, 0, 0
GL.glVertex3f(0, 50, 0); // line ending at 0, 50, 0 (50 is maximal value in surface[])
GL.glEnd();
// display the axes

GL.glBegin(GL.GL_TRIANGLES);
for(int x = 1; x < width; ++ x) {
    for(int y = 1; y < height; ++ y) {
        float a = surface[x - 1][y - 1];
        float b = surface[x][y - 1];
        float c = surface[x][y];
        float d = surface[x - 1][y];
        // get four points on the surface (they form a quad)

        GL.glVertex3f(x - 1, a, y - 1);
        GL.glVertex3f(x, b, y - 1);
        GL.glVertex3f(x, c, y);
        // draw triangle abc

        GL.glVertex3f(x - 1, a, y - 1);
        GL.glVertex3f(x, c, y);
        GL.glVertex3f(x - 1, d, y);
        // draw triangle acd
    }
}
GL.glEnd();
// display the data
Run Code Online (Sandbox Code Playgroud)

这会绘制简单的轴和高度场,全部为白色。从这里扩展它应该非常简单。