PK_BODY_make_manifold_bodies   

PK_ERROR_code_t   PK_BODY_make_manifold_bodies
(
--- received arguments ---
PK_BODY_t         body,         --- body to decompose

--- returned arguments ---
int        *const n_components, --- number of manifold bodies
PK_BODY_t **const components    --- array of manifold bodies
)


This function breaks a body into manifold pieces.


If the given body is general, an array of manifold bodies is returned.  The
given body is decomposed such that:

(1) Each solid region becomes a solid body.

(2) Any face with the same solid region on both sides is deleted.

(3) Using any faces which are not on the boundary of a solid region, each
maximal connected subset of them which is manifold (i.e. each edge is adjacent
to no more than 2 faces) will be returned as a sheet body.

(4) Each maximal connected set of wireframe edges which is manifold (i.e. each
vertex is adjacent to no more than 2 edges) will be returned as a wire body.

(5) Any acorn vertices are deleted unless the body consists solely of acorn
vertices in which case a minumum or acorn body will be returned depending
upon whether the number of vertices was one or greater than one.

If the 'body' is of type PK_BODY_type_empty_c then 'n_components' will be
returned as zero and the body will be deleted.

This function has no effect on bodies which are not general, and the single
component returned will be the original body.

Although all the bodies returned will have valid manifold topology, they may
not be valid for geometrical reasons.  This is because there may be a face,
edge, or vertex in the original body which must be split to produce a manifold
result.  Any edge with more than 2 faces incident with it will be split into
several edges, one for each incident face.  If only 2 two of these remain in
the same body they will be rejoined to avoid coincident edges, but if more than
2 remain they will not be rejoined.  Coincident vertices are treated similarly
to edges.

When a sheet body is returned, all its face normals are made to be compatible
in order to satisfy the conditions for a manifold sheet body.  The direction of
these face normals is not defined (they could all be reversed without
invalidating the sheet) and, in particular, is not guaranteed to remain the
same between versions.

It is possible for a sheet body to be non-orientable.  In this case some edges
will be disjoined in order to satisfy the conditions for a manifold sheet body,
and this will result in coincident geometry.  It is not defined which edges
will be disjoined if a sheet is not orientable.