import com.rinearn.graph3d.RinearnGraph3D; import com.rinearn.graph3d.RinearnGraph3DOptionItem; public class Graph3DSample { public static void main(String[] args) { // 座標値データの用意 int n = 80; // メッシュの各方向の区間数 double[][] x = new double[n+1][n+1]; //各方向の頂点数は区間数+1 double[][] y = new double[n+1][n+1]; double[][] z = new double[n+1][n+1]; for(int i=0; i<=n; i++) { for(int j=0; j<=n; j++) { x[i][j] = i * 0.1; y[i][j] = j * 0.1; z[i][j] = Math.sin(x[i][j]) * Math.sin(y[i][j]); } } // グラフを起動してデータをプロット RinearnGraph3D graph = new RinearnGraph3D(); graph.setData(x, y, z); // オプション設定(点プロット無効化して曲面プロット有効化) graph.setOptionSelected(RinearnGraph3DOptionItem.POINT, false); graph.setOptionSelected(RinearnGraph3DOptionItem.MESH, true); // 範囲設定 graph.setXRange(0.0, 5.0); graph.setYRange(0.0, 5.0); graph.setZRange(-1.0, 1.0); } }