![]() |
| home | graph lib | utility lib | custom lib | auxiliary lib | tutorials | |
|
Make PackageFunctions for shape creation: fan, disk, cylinder, sphere, sphere2, shell, toroid, extrude, sweep, tween, contour3, contour4, isosurf, delaunay, field, grid2points, grid2quads, grid2cube, data2color, normal2, normal3, normal4, sort. arr - a zeArray of double floating type.r - radius. s - number of slices. a - start angle. b - sweep angle. The function creates GL_TRIANGLE_FAN vertices and texture coordinates. The first three vectors of arr contain vertices and the next two vectors contain texture coordinates. The texture coordinate at the center is (0.5, 0) and those along the edge are from (0, 1) to (1, 1). For use in a 3D scene, you should assign one normal pointing to the z-direction to the shape. arr - a zeArray of double floating type.r0 - inner radius. r1 - outer radius. s - number of slices. a - start angle. b - sweep angle. The function creates GL_QUAD_STRIP vertices and texture coordinates. The first three vectors of arr contain vertices and the next two vectors contain texture coordinates. The texture coordinates along the inner edge vary from (0, 0) to (1, 0) and those along the outer edge from (0, 1) to (1, 1). For use in a 3D scene, you should assign one normal pointing to the z-direction to the shape. .cylinder(arr, r0, r1, s, a, b) arr - a zeArray of double floating type.r0 - base radius. r1 - top radius. s - number of slices. a - start angle. b - sweep angle. The function creates GL_QUAD_STRIP vertices, normals, and texture coordinates. The first three vectors of arr contain vertices, the next three vectors contain normal, and the last two vectors contain texture coordinates. The texture coordinates along the base edge vary from (0, 0) to (1, 0) and those along the top edge from (0, 1) to (1, 1). arr - a zeArray of double floating type.r - radius. n - number of iterations. The function creates GL_TRIANGLES vertices and their normal that can be used as sphere surface. The first three vectors of arr contain vertices and the next three vectors contain vertex normal. A vertex normal points outward. arr - a zeArray of double floating type.r - radius. n - number of iterations. The function calls shell() function 8 times to creates GL_TRIANGLES vertices, normal, and texture coordinates that can be used to form sphere surface. The first three vectors of arr contain vertices, the next three vectors contain vertex normal, and the last two contains texture coordinates. A vertex normal points outward. arr - a zeArray of double floating type.r - radius. n - number of iterations. k - phase index. The function creates GL_TRIANGLES vertices, normal, and texture coordinates that can be used form a sphere surface. The first three vectors of arr contain vertices, the next three vectors contain normal, and the last two vectors contain texture coordinates. A vertex normal points outward. The argument k = 1 to 8 corresponds to eight x-y-z phases of (1, 1, 1), (-1, 1, 1), (-1, -1, 1), (1, -1, 1), (1, 1, -1), (-1, 1, -1), (-1, -1, -1), and (1, -1, -1). The corresponding texture coordinates of those phases are {(0, 0.5), (0.25, 1)}, {(0.25, 0.5), (0.5, 1)}, {(0.5, 0.5), (0.75, 1)}, {(0.75, 0.5), (1, 1)}, {(0, 0), (0.25, 0.5)}, {(0.25, 0), (0.5, 0.5)}, {(0.5, 0), (0.75, 0.5)}, {(0.75, 0), (1, 0.5)}, respectively. arr - a zeArray of double floating type.r1 - radius from the center to the middle of a ring. r2 - radius of the cross section of a ring. a - start angle. b - sweep angle. n - number of slices of the cross section. The function creates GL_QUAD_STRIP vertices, normal, and texture coordinates that can be used form a ring or torus. The first three vectors of arr contain vertices, the next three vectors contain normal, and the last two vectors contain texture coordinates. A vertex normal points outward. The texture s-coordinates of 0 and 1 correspond to angles of 0 to 360 degree; and t-coordinates of 0 and 1 correspond to the cross section from outer, to top, to inner and then to bottom. arr - a zeArray of double floating type to hold results.z - extrude depth. curve - a zeArray of double floating type as source curve. The function creates GL_QUAD_STRIP vertices, normal, and texture by extruding the curve in the z-axis direction. The first three vectors of arr contain vertices, the next three vectors contain normal, and the last two vectors contain texture coordinates. The normal direction depends on directions of curve segments. The texture coordinate of the first vertex of the curve is (0, 0) and that of the last vertex is (1, 0). The texture coordinate of the first vertex of the extruded curve is (0, 1) and that of the last vertex is (1, 1). arr - a zeArray of double floating type to hold results.a - sweep angle. curve - a zeArray of double floating type as source curve. The function creates GL_QUAD_STRIP vertices, normal, and texture by sweeping the curve around the z-axis. The first three vectors of arr contain vertices, the next three vectors contain normal, and the last two vectors contain texture coordinates. The normal points outward if the angle is positive; otherwise points inward. The texture coordinate of the first vertex of the curve is (0, 0) and that of the last vertex is (0, 1). The texture coordinate of the first vertex of the sweeped curve is (1, 0) and that of the last vertex is (1, 1). arr - a zeArray of double floating type to hold results.curve1, curve2- zeArray of double floating type as source curves. The function creates GL_QUAD_STRIP vertices, normal, and texture by connecting the two curves. The first three vectors of arr contain vertices, the next three vectors contain normal, and the last two vectors contain texture coordinates. The texture coordinate of the first vertex of the curve is (0, 0) and that of the last vertex is (0, 1). .contour3(arr, iso, fill, xyz) arr - a zeArray of double floating type to hold results.iso - the iso-value of contour. fill - zero indicating contour line; otherwise filled contour. xyz - a zeArray of double floating type containing triangle vertices. The function creates GL_LINES or GL_TRINAGLES vertices resulted from contouring. .contour4(arr, iso, fill, xyz) arr - a zeArray of double floating type to hold results.iso - the iso-value of contour. fill - zero indicating contour line; otherwise filled contour. xyz - a zeArray of double floating type containing quad vertices. The function creates GL_LINES or GL_TRINAGLES vertices resulted from contouring. arr - a zeArray of double floating type to hold results.iso - the iso-value of the iso-surface. vol - a zeArray of double floating type containing volume data. The function creates GL_TRIANGLES vertices and normal resulted from marching cube volume-rendering algorithm. The volume data at the eight points of a 3D grid should be counted anti-clockwise first for the bottom plane and then for the top plane. The iso-surface encloses vertices with values higher than the iso-value. The first three vectors of arr contain vertex outputs and the next three vectors contain normal outputs. arr - a zeArray of double floating type for output.xyz - a zeArray of double floating type for input. The function creates GL_TRIANGLES vertices using the Denaulay triangulation method. arr - a zeArray of double floating type for output.arrow - arrow head length. xyuv - a zeArray of double floating type for input. The function creates GL_LINES vertices that comprise arrows of wind field. The first two vectors of xyuv should contain x- and y-values of position and the next two vectors contain u- and v-wind. arr - a zeArray of double floating type as output.scale - a number for scale factor. xyz - a zeArray of double floating type as input. Converts regular grid data to an array that can be used by the vertex object of a point object. The x and y of the ouput array are the vector and record indices, respectively, multiplied by the scale factor. The z ouputs are zero. arr - a zeArray of double floating type as output.scale - a number for scale factor. xyz - a zeArray of double floating type as input. Converts regular grid data to an array that can be used by the vertex object of a polygon object of GL_QUADS. The x and y of the ouput array are the vector and record indices, respectively, multiplied by the scale factor. The z outputs are zero. .grid2cube(arr, scale, gr1, gr2) arr - a zeArray of double floating type as output.scale - a number for scale factor. gr1 - a zeArray of double floating type as input. gr2 - a zeArray of double floating type as input. Converts two layers of regular grid data to an array that can be used by the iso-surface function. arr - a zeArray of double type as output of color.dat - a n by 1 zeArray of double type as input data. clr - a m by 3 zeArray of double type as color table of red, green, abd blue. Calculates colors for the data using the color table. The minimum of data has the first color and the maxinum has the last color in ctb. .normal2(x0, y0, z0, x1, y1, z1, x2, y2, z2) x0, y0, z0 - position of the origin vertex.x1, y1, z1 - position of the first vertex. x2, y2, z2 - position of the second vertex. Calculates the normal vector of the plane formed by vectors of (x1, y1, z1) - (x0, y0, z0) and (x2, y2, z2) - (x0, y0, z0). arr - a zeArray of double type as output of vertex normals.scale - a number to scale z-values in normal calculation. xyz - a zeArray of double type as input of vertices. Calculates per vertex normal for xyz that is planned to be used by the vertex object of a polygon object of GL_TRIANGLES. arr - a zeArray of double type as output of vertex normals.scale - a number to scale z-values in normal calculation. xyz - a zeArray of double type as input of vertices. Calculates per vertex normal for xyz that is planned to be used by the vertex object of a polygon object of GL_QUADS. |