PK_TOPOL_clash   

PK_ERROR_code_t           PK_TOPOL_clash
(
--- received arguments ---
const int                 n_targets,    --- Number of target topologies
const PK_TOPOL_t          targets[],    --- Array of target topols
const PK_TRANSF_t         tf1[],        --- Transforms for targets
const int                 n_tools,      --- Number of tool topologies
const PK_TOPOL_t          tools[],      --- Array of tool topols
const PK_TRANSF_t         tf2[],        --- Transforms for tools
const PK_TOPOL_clash_o_t *options,      --- Options to be used [PF]

--- returned arguments ---
int                *const n_clash,      --- Number of clashes found
PK_TOPOL_clash_t  **const clashes       --- Returned array of clashes
)


This function clashes sets of topologies and returns the (list of)
body, face or edge pairs which clash; the test can be comprehensive, or just
find the first set, and can also return types of clashes.

This function supports body v body, body v face, and face v face clashing.
This function offers partial support for facet geometry [PF]


Specific Errors:
    PK_ERROR_bad_combination (MILD) cannot clash classic and facet geometry
                                    unless all 'targets' and 'tools' are sheet
                                    or solid bodies.


See also Clash detection of bodies for more information.

Terminology
Two entities have a "clash" if they have a one, two, or three-
dimensional overlap. Two entities are "clashed" together when we
inspect them to see if they have a clash.

Clashing entities of the same topological dimension:

Entities with the same topological dimesion may be two solid bodies (but
not a solid body with a wire or sheet body), or two faces etc. If the
two entities clash, the bounding topologies of the entities (faces in
the case of solid bodies, edges in the case of faces, and vertices in
the case of edges) which clash are returned; if there is no such
clash of bounding topologies, then the entities are examined to see
whether one lies within the other.

Clashing entities of differing topological dimension:

Entities with different topological dimension may also be considered; for
example, a three-dimensional solid body may be clashed with a
two-dimensional sheet body, or a single face with a vertex etc. The
clashes returned will depend on the types of topological entities
under consideration. Clashes are first sought at the level of the
entity with the lowest topological dimension; if no clash exists at this
level, the next highest topological dimension is examined and so on. If no
clash exists, the topology with the lower topological dimension is
examined to see if it lies entirely within the topology with the
higher topological dimension. Thus when clashing a vertex with a solid
body, vertex - vertex  clashes are first sought. If no such clashes
exist, vertex - edge clashes are then examined, then vertex - face and
finally if no clashes are detected, the vertex is examined to see
whether it lies within the body.

Clash classifications:

Clashes between two entities may be classified as "interference",
"abutment" or "containment". The distinction between the three types
of classification is made by considering shared points in space
between the two entities.

Two entities interfere if there exists a point in space which lies
within, but not touching, the bounding topologies of both
entities. Thus two solid bodies will interfere if they share a common
volume, faces will interfere if they share a common area.

If one entity is confined entirely within the bounding topologies of
the other, and their bounding topologies do not touch, then that
entity is said to contain the other. This is a special case of
interference.

Where the bounding topologies of the two entities touch, yet they do
not fulfill the requirements of interfere and containment mentioned
above, then the entities are said to abut. While abutment is possible
for real-world solid objects, interference is not. Solid bodies will
abut if they have faces which touch, but do not share a common volume.

Special cases:

When clashing two vertices, no attempt is made to classify the
particular type of clash. If the two vertices lie within their local
tolerance, then a clash type of PK_TOPOL_clash_exists will be returned.

Similarly, no attempt is made to classify clashes between wire
bodies. Any edge clashes returned will be of type
PK_TOPOL_clash_exists. No examination of whether one wire body lies
within another is made - only edge clashes will be returned.

The clash classifications described above, which rely on the bounding
topology of the two entities, do not always apply in the case of sheet
bodies with multiple faces and / or wire bodies that have multiple
edges. For example, a wire body and sheet body will only interfere if
one or more edges of the wire body pass through an interior point of a
face or faces  of the sheet body.

Two sheet bodies will abut if their face clashes lie coincident with
each other. They will only interfere if the clashing faces cross.


Returned information
If no clashes are found then 'n_clash' is set to zero and 'clashes' to NULL.

If clashes are found, then 'n_clash' is the number of clashes found
and 'clashes' points to a list of the clashes.

When clashing a face with a body, the types of clashes returned (if
requested) will be the same as those produced when clashing the
equivalent single-faced sheet body with the body.


Dealing with transforms
If you supply PK_ENTITY_null in place of a transform,
PK_TOPOL_clash substitutes an identity transform internally.

This can be used as a shortcut to supply identity transforms for all
the topologies in the target and/or tool lists. Leave the
mul_target_tf (and/or mul_tool_tf) field in the options structure as
PK_LOGICAL_false, and supply PK_ENTITY_null as the first element  of
tf1 (and/or tf2).  PK_TOPOL_clash will use the same transform for each
member of the list, and will substitute an identity transform for the
PK_ENTITY_null.

The 'tf1' and 'tf2' arguments may not be NULL pointers, and
perspective terms are not permitted in transforms supplied
to PK_TOPOL_clash.