+/* Marching Cube (for drawing isosurface) */
+typedef struct MCubePoint {
+ Int key; /* key = ((ix*ny+iy)*nz+iz)*3+ii, ii=0/1/2 for x/y/z direction, respectively */
+ float d; /* offset toward the direction; 0 <= d < 1 */
+ float pos[3]; /* cartesian coordinate of the point */
+ float grad[3]; /* gradient vector */
+} MCubePoint;
+
+typedef struct MCube {
+ char hidden; /* If non-zero, then this MCube is not drawn */
+ Int idn; /* MO number */
+ Vector origin; /* Cube origin */
+ Double dx, dy, dz; /* Cube steps */
+ Int nx, ny, nz; /* Cube dimension (must be multiples of 8) */
+ Double thres; /* Threshold value */
+ Double *dp; /* Value for point (ix, iy, iz) is in dp[(ix*ny+iy)*nz+iz] */
+ Int nradii;
+ Double *radii; /* Estimated radius (with margin) for each atom */
+ Double expand; /* Expand the estimated radius by this value (default: 1.0) */
+ struct {
+ /* Flags for cube (ix, iy, iz)-(ix+1, iy+1, iz+1). It is an 8-bit */
+ /* integer representing whether the values at the 8 corners are */
+ /* larger than the threshold value or not. As special cases, */
+ /* the values 0 and 255 (all corners are below or above the threshold) */
+ /* are represented as 255, and the value 0 is used to indicate "yet undefined". */
+ unsigned char *fp;
+ /* Cube points and triangles: for positive and negative surfaces */
+ Int ncubepoints;
+ MCubePoint *cubepoints;
+ Int ntriangles;
+ Int *triangles; /* Triangles; indices to cubepoints[] */
+ float rgba[4]; /* Surface color */
+ } c[2];
+} MCube;
+