Next: Vector field samples, Previous: 2D samples, Up: Examples [Contents][Index]
This section is devoted to visualization of 3D data arrays. 3D means the data which depend on 3 indexes (parameters) like tensor a(i,j,k)=a(x(i),y(j),x(k)), i=1...n, j=1...m, k=1...l or in parametric form {x(i,j,k),y(i,j,k),z(i,j,k),a(i,j,k)}. Most of samples will use the same data for plotting. So, I put its initialization in separate function
void mgls_prepare3d(mglData *a, mglData *b=0) { register long i,j,k,n=61,m=50,l=40,i0; if(a) a->Create(n,m,l); if(b) b->Create(n,m,l); mreal x,y,z; for(i=0;i<n;i++) for(j=0;j<m;j++) for(k=0;k<l;k++) { x=2*i/(n-1.)-1; y=2*j/(m-1.)-1; z=2*k/(l-1.)-1; i0 = i+n*(j+m*k); if(a) a->a[i0] = -2*(x*x + y*y + z*z*z*z - z*z - 0.1); if(b) b->a[i0] = 1-2*tanh((x+y)*(x+y)); } }
or using C functions
void mgls_prepare3d(HMDT a, HMDT b=0) { register long i,j,k,n=61,m=50,l=40,i0; if(a) mgl_data_create(a,n,m,l); if(b) mgl_data_create(b,n,m,l); mreal x,y,z; for(i=0;i<n;i++) for(j=0;j<m;j++) for(k=0;k<l;k++) { x=2*i/(n-1.)-1; y=2*j/(m-1.)-1; z=2*k/(l-1.)-1; i0 = i+n*(j+m*k); if(a) mgl_data_set_value(a, -2*(x*x + y*y + z*z*z*z - z*z - 0.1), i,j,k); if(b) mgl_data_set_value(b, 1-2*tanh((x+y)*(x+y)), i,j,k); } }
• Surf3 sample: | ||
• Surf3C sample: | ||
• Surf3A sample: | ||
• Surf3CA sample: | ||
• Cloud sample: | ||
• Dens3 sample: | ||
• Cont3 sample: | ||
• ContF3 sample: | ||
• Dens projection sample: | ||
• Cont projection sample: | ||
• ContF projection sample: | ||
• TriPlot and QuadPlot: | ||
• Dots sample: | ||
• Fractal sample: |
Next: Vector field samples, Previous: 2D samples, Up: Examples [Contents][Index]