formZ SDK | 5.0 API Reference | Project | Modeling | Objects | Editing Operations
Description
Decomposes all faces of an object into simple polygonal faces. It also computes
normal vectors at each point of each face. The direction of the normal
vector is determined by the smooth shading attribute associated with the object.
For example, at a corner of a cube, three faces meet. At that corner, three
point normals will be calculated. If the corner is not smooth shaded, the
normals will all point in a different direction, which is the direction of the
face that the point belongs to. If the corner is smooth shaded (the
user may have selected to smooth shade all faces of that object), all three
normals will point in the same direction.
Four levels of decomposition are available :
Level 1 : Removing holes. All faces, which have holes
connect the holes to the outer boundary of the face.
Level 2 : Removing concavities. Same as level 1, plus concave
corners are removed.
Level 3 : Creating quadrangles. Same as level 2, plus all faces
which have more then 4 sides are split into quadrangles
and possibly triangles.
Level 4 : Creating triangles. Same as level 3, plus all faces
are split into triangles.
Open wire faces that may be part of the object are ignored. The number
of decomposed faces is returned in the argument num_faces. The face
topology is returned in the pindx_list argument. It is a list which
contains integer values. The first value is a counter "n". It indicates
how many sides the first face has. The next "n" values in the list are point
indices which reference the points of the facetted topology of the object.
The next value in the list is again the counter "n", now for the second
face. etc. The counter "n" show up exactly num_faces times in the pindx_list
argument.
n1
pindx(0)
pindx(1)
...
pindx(n1-1)
n2
pindx(0)
pindx(1)
...
pindx(n2-1)
.
.
.
nm
pindx(0)
pindx(1)
...
pindx(nm-1)
When the "Level 4: Creating Triangles" level is selected, the counter is obviously redundant, but
is included in the pindx_list, for consistency purposes.
The optional findx_list argument contains the index of the original face
of the object. Note, if the object is a smooth object, the face index
references a face in the smooth topology, not the facetted topology. (unlike the indices in the
pindx_list, which always reference the facetted points).
The normals are returned in the norm_list argument. They are of type fz_xyz_td. This list is structured
in the same way as the pindx_list list, but does not have the counter for each face.
That is, the normals are stored for each face in the order of the points around the face.
normal of point 1 of face 1
normal of point 2 of face 1
...
normal of point n1 of face 1
normal of point 1 of face 2
normal of point 2 of face 2
...
normal of point n2 of face 2
.
.
.
normal of point 1 of face m
normal of point 2 of face m
...
normal of point nm of face m
Plugin Prototype
fzrt_error_td fz_objt_decompose_simple_with_normals(
fzrt_int | windex, |
obj, | |
decomp_type, | |
fzrt_int * | num_faces, |
pindx_list, | |
findx_list, | |
norm_list ) |
Parameters
windex [Input]
project window index
obj [Input]
object
decomp_type [Input]
The type of decomposition requested
num_faces [Result]
The number of faces resulting from the decomposition
pindx_list [Result]
The list with point indices (as variable fzrt_int) of the facetted topology
findx_list [Result, Optional]
The list with indices (as variable fzrt_int) of the original face
norm_list [Result, Optional]
The list with normals (as variable fz_xyz_td), one for each point of each face
Returns
Error codes
Availability
5.5.0.0
Example Files
Function Set
Defined in