Functions | |
void | Insert_Mesh (int rows, int columns, const HC_POINT *points) |
HC_KEY | KInsert_Mesh (int rows, int columns, const HC_POINT *points) |
void | QInsert_Mesh (const char *segment, int rows, int columns, const HC_POINT *points) |
HC_KEY | QKInsert_Mesh (const char *segment, int rows, int columns, const HC_POINT *points) |
void | Insert_Mesh_By_Ref (int rows, int columns, const HC_POINT *points) |
HC_KEY | KInsert_Mesh_By_Ref (int rows, int columns, const HC_POINT *points) |
void | QInsert_Mesh_By_Ref (const char *segment, int rows, int columns, const HC_POINT *points) |
HC_KEY | QKInsert_Mesh_By_Ref (const char *segment, int rows, int columns, const HC_POINT *points) |
void | DInsert_Mesh (int rows, int columns, const HCD_POINT *points) |
HC_KEY | DKInsert_Mesh (int rows, int columns, const HCD_POINT *points) |
void | DQInsert_Mesh (const char *segment, int rows, int columns, const HCD_POINT *points) |
HC_KEY | DQKInsert_Mesh (const char *segment, int rows, int columns, const HCD_POINT *points) |
void Insert_Mesh | ( | int | rows, | |
int | columns, | |||
const HC_POINT * | points | |||
) |
Puts a rectangular array of faces into the database.
rows | - Number of rows of vertices in the mesh. | |
columns | - Number of columns of vertices in the mesh. | |
points | - A rows x columns array of x-y-z triplets of the coordinates of the vertices of the mesh. You can also use a simple rows x columns x 3 array of floats. A one-dimensional array of floats (with the entries packed row by row) may be used in place of the full 2-D/3-D array. Passed by reference always. |
For drawing purposes, meshes are made of markers (at the vertices), edges, and faces. Visibility and other drawing attributes for any of these can be set as usual on the segment. Or they can be set locally and individually within the mesh by doing an Open_Face() , Open_Edge() , or Open_Vertex() and then setting the attribute. See the Open routines later in this chapter for details.
One difference between a mesh and a shell in HOOPS is that the shell requires you to give a "face list" to tell the system which vertices to connect to form the edges and faces. In a mesh, the connections are automatic. Another difference is that meshes (in the situations in which they can be used) tend to be both stored and displayed more efficiently than shells.
The faces of a mesh are arbitrary quadrilaterals. Since arbitrary quadrilaterals are usually not planar, HOOPS divides each one into two triangles in order to light and draw them. Specifically, the quadrilateral between vertices (r, c) and (r+1, c+1) will be triangulated by adding an edge from (r+1, c) to (r, c+1). That diagonal edge will be visible whenever edges are visible, unless you use Open_Edge() and Set_Visibility() to turn it off.
Open_Edge() and Open_Vertex() require "vertex numbers" to be passed in, and Show_Selection_Element() returns vertex numbers to you. For a rows x columns mesh with a vertex at (r, c), the "vertex number" is just r * columns + c.
The Open_Face() similarly requires a "face number". For a rows x columns mesh, the mesh triangle between (r, c), (r+1, c), and (r, c+1) is numbered 2*(r * (columns - 1)+ c). The triangle between (r + 1, c + 1), (r, c + 1), and (r + 1, c)---is numbered 2*(r * (columns - 1) + c)+1.
The _By_Ref() ("by reference") routines differ from the regular routines only in that HOOPS is allowed not to make a copy of your data (at the system's option). Instead HOOPS remembers where your mesh data was located. Then whenever the mesh needs to be recomputed the memory originally referenced by points is used. This can speed up the call to Insert_Mesh() and save significant memory. But be careful---when you insert "by reference" you are guaranteeing that the data is going to remain valid and that you're not going to touch it (except via Edit_Mesh() ) until such time as the whole mesh database entry gets deleted. Also, as mentioned, the system makes a copy of the data anyhow if it needs to, so don't assume that edits will be observable back in the original array.
When running on machines that can handle "triangle strips", a mesh will automatically be sent directly to the hardware as one or more such strips. If you want to take advantage of such hardware, a mesh is the proper choice. HOOPS does not have a separate "triangle strip" primitive.
It is permissible for a mesh to be degenerate---the number of points in a mesh can be zero and points can be redundant.
In the present implementation there are no "sharp" edges or vertices. In other words, smooth-shading, if turned on, will always proceed across the shared edges and vertices, thus "rounding off" the edge or vertex. The only way to disable the smooth shading across an edge is to divide the mesh into two separate meshes.
Prior to HOOPS version 14 (and beyond 14 if the "legacy mesh face numbering" setting is enabled -- see Define_System_Options), face ids were assigned as follows: for a rows x columns mesh, the mesh triangle between (r, c), (r+1, c), and (r, c+1) is numbered r * columns + c. The "other" triangle cornered at (r, c)---the one between (r, c), (r-1, c), and (r, c-1)---is numbered -(r * columns + c).
The mesh as a whole may intersect itself.
If you work with a C compiler (and matching HOOPS library) with an "int" defined as only 16 bits, life can be uncooperative. You might be able to create a mesh with rows and columns each as large as 32767. But be warned that Open_Face() , Open_Edge() , Open_Vertex() , and Show_Selection_Element() deal with rows times columns offsets and might overflow.
If there is an error the KInsert routine returns a -1.
HC_KEY KInsert_Mesh | ( | int | rows, | |
int | columns, | |||
const HC_POINT * | points | |||
) |
Similar to Insert_Mesh(), but returns an HC_KEY to the object.
rows | - Number of rows of vertices in the mesh. | |
columns | - Number of columns of vertices in the mesh. | |
points | - A rows x columns array of x-y-z triplets of the coordinates of the vertices of the mesh. You can also use a simple rows x columns x 3 array of floats. A one-dimensional array of floats (with the entries packed row by row) may be used in place of the full 2-D/3-D array. Passed by reference always. |
void QInsert_Mesh | ( | const char * | segment, | |
int | rows, | |||
int | columns, | |||
const HC_POINT * | points | |||
) |
Similar to Insert_Mesh(), but operates on a given segment rather than the currently open one.
segment | - Segment(s) to be inserted into, if other than the currently- open segment. | |
rows | - Number of rows of vertices in the mesh. | |
columns | - Number of columns of vertices in the mesh. | |
points | - A rows x columns array of x-y-z triplets of the coordinates of the vertices of the mesh. You can also use a simple rows x columns x 3 array of floats. A one-dimensional array of floats (with the entries packed row by row) may be used in place of the full 2-D/3-D array. Passed by reference always. |
HC_KEY QKInsert_Mesh | ( | const char * | segment, | |
int | rows, | |||
int | columns, | |||
const HC_POINT * | points | |||
) |
Similar to Insert_Mesh(), but operates on a given segment and returns an HC_KEY to the object.
segment | - Segment(s) to be inserted into, if other than the currently- open segment. | |
rows | - Number of rows of vertices in the mesh. | |
columns | - Number of columns of vertices in the mesh. | |
points | - A rows x columns array of x-y-z triplets of the coordinates of the vertices of the mesh. You can also use a simple rows x columns x 3 array of floats. A one-dimensional array of floats (with the entries packed row by row) may be used in place of the full 2-D/3-D array. Passed by reference always. |
void Insert_Mesh_By_Ref | ( | int | rows, | |
int | columns, | |||
const HC_POINT * | points | |||
) |
Similar to Insert_Mesh(), but does not create a copy of the shell data within HOOPS.
rows | - Number of rows of vertices in the mesh. | |
columns | - Number of columns of vertices in the mesh. | |
points | - A rows x columns array of x-y-z triplets of the coordinates of the vertices of the mesh. You can also use a simple rows x columns x 3 array of floats. A one-dimensional array of floats (with the entries packed row by row) may be used in place of the full 2-D/3-D array. Passed by reference always. |
HC_KEY KInsert_Mesh_By_Ref | ( | int | rows, | |
int | columns, | |||
const HC_POINT * | points | |||
) |
Similar to Insert_Mesh_By_Ref(), but returns an HC_KEY to the shell.
rows | - Number of rows of vertices in the mesh. | |
columns | - Number of columns of vertices in the mesh. | |
points | - A rows x columns array of x-y-z triplets of the coordinates of the vertices of the mesh. You can also use a simple rows x columns x 3 array of floats. A one-dimensional array of floats (with the entries packed row by row) may be used in place of the full 2-D/3-D array. Passed by reference always. |
void QInsert_Mesh_By_Ref | ( | const char * | segment, | |
int | rows, | |||
int | columns, | |||
const HC_POINT * | points | |||
) |
Similar to Insert_Mesh_By_Ref(), but inserts the shell in a given segment.
segment | - Segment(s) to be inserted into, if other than the currently- open segment. | |
rows | - Number of rows of vertices in the mesh. | |
columns | - Number of columns of vertices in the mesh. | |
points | - A rows x columns array of x-y-z triplets of the coordinates of the vertices of the mesh. You can also use a simple rows x columns x 3 array of floats. A one-dimensional array of floats (with the entries packed row by row) may be used in place of the full 2-D/3-D array. Passed by reference always. |
HC_KEY QKInsert_Mesh_By_Ref | ( | const char * | segment, | |
int | rows, | |||
int | columns, | |||
const HC_POINT * | points | |||
) |
Similar to Insert_Mesh_By_Ref(), but inserts the shell in a given segment and returns an HC_KEY to the shell.
segment | - Segment(s) to be inserted into, if other than the currently- open segment. | |
rows | - Number of rows of vertices in the mesh. | |
columns | - Number of columns of vertices in the mesh. | |
points | - A rows x columns array of x-y-z triplets of the coordinates of the vertices of the mesh. You can also use a simple rows x columns x 3 array of floats. A one-dimensional array of floats (with the entries packed row by row) may be used in place of the full 2-D/3-D array. Passed by reference always. |
void DInsert_Mesh | ( | int | rows, | |
int | columns, | |||
const HCD_POINT * | points | |||
) |
Similar to Insert_Mesh() but accepts and/or returns double-precision values. This command can only be used when the application source includes the HOOPS double-precision header, hcd.h.
rows | - Number of rows of vertices in the mesh. | |
columns | - Number of columns of vertices in the mesh. | |
points | - A rows x columns array of x-y-z triplets of the coordinates of the vertices of the mesh. You can also use a simple rows x columns x 3 array of floats. A one-dimensional array of floats (with the entries packed row by row) may be used in place of the full 2-D/3-D array. Passed by reference always. |
HC_KEY DKInsert_Mesh | ( | int | rows, | |
int | columns, | |||
const HCD_POINT * | points | |||
) |
Similar to DInsert_Mesh(), but returns an HC_KEY to the object.
rows | - Number of rows of vertices in the mesh. | |
columns | - Number of columns of vertices in the mesh. | |
points | - A rows x columns array of x-y-z triplets of the coordinates of the vertices of the mesh. You can also use a simple rows x columns x 3 array of floats. A one-dimensional array of floats (with the entries packed row by row) may be used in place of the full 2-D/3-D array. Passed by reference always. |
void DQInsert_Mesh | ( | const char * | segment, | |
int | rows, | |||
int | columns, | |||
const HCD_POINT * | points | |||
) |
Similar to DInsert_Mesh(), but operates on a given segment rather than the currently open one.
segment | - Segment(s) to be inserted into, if other than the currently- open segment. | |
rows | - Number of rows of vertices in the mesh. | |
columns | - Number of columns of vertices in the mesh. | |
points | - A rows x columns array of x-y-z triplets of the coordinates of the vertices of the mesh. You can also use a simple rows x columns x 3 array of floats. A one-dimensional array of floats (with the entries packed row by row) may be used in place of the full 2-D/3-D array. Passed by reference always. |
HC_KEY DQKInsert_Mesh | ( | const char * | segment, | |
int | rows, | |||
int | columns, | |||
const HCD_POINT * | points | |||
) |
Similar to DInsert_Mesh(), but operates on a given segment and returns an HC_KEY to the object.
segment | - Segment(s) to be inserted into, if other than the currently- open segment. | |
rows | - Number of rows of vertices in the mesh. | |
columns | - Number of columns of vertices in the mesh. | |
points | - A rows x columns array of x-y-z triplets of the coordinates of the vertices of the mesh. You can also use a simple rows x columns x 3 array of floats. A one-dimensional array of floats (with the entries packed row by row) may be used in place of the full 2-D/3-D array. Passed by reference always. |