# Intersector: Mesh-Intersection-Based Services

## Version: 2.5 (20/09/2017)

## Author: Onera

### Preamble

This module provides pre ans post processing services relying on mesh-intersection computations on arbitrary polyhedral meshes.

It also gives auxiliary functions that transform topologically and geometrically polyhedral meshes which are useful in the process of mesh generation by intersection.

A mesh can be stored as an array (as defined in the Converter documentation)
or in a zone node of a CGNS/python tree (pyTree).

This module is part of Cassiopee.

When using the array interface, import the Intersector module:

import Intersector as XOR (array version)

or

import Intersector.PyTree as XOR (PyTree version)

### Main Functions

**XOR.conformUnstr**: conformizes a TRI or BAR soup (i.e. a set of elements not necessarily connected as a mesh) by detecting and solving all the collisions between elements.

Colliding elements are cut to get a conformal set. Mixed type BAR/TRI are not handled.
**Parameter** |
**Meaning** |

s1 |
input mesh (BAR or TRI). If s2 is 'None' self-intersections are solved over s1. |

[s2] |
optional : conformize s1 taking into account collisions that might occur with s2 |

tol |
merging tolerance when points (exisiting or computed by intersections) are too close. |

left_or_right |
Tells the function what to ouput : the transformed s1 (left operand), s2(right operand) or both. |

itermax |
Number of intersection/merging iterations. 10 is the default value. |

**Parameter values** |
**Meaning** |

tol>0. |
use the input value as an absolute merging tolerance. |

tol=0. (default) |
Computes the tolerance as 5% of the overall min edge length. |

tol<0. |
Consider this input value (must be between 0. and 1.) as a ratio to apply to the min edge length to get the tolerance. |

left_or_right=0 |
Output s1 |

left_or_right=1 |
Output s2. |

left_or_right=2 (default) |
Output both s1 and s2. |

*Tip: set itermax to 1. to improve speed and the Delaunay kernel robustness. The result might have poorer quality triangles though.*

B = XOR.conformUnstr(s1, s2=None, tol=0., left_or_right=2, itermax=10)

*Example of use: * conformize a TRI or BAR soup (array),
conformize a TRI or BAR soup (pyTree).

**XOR.booleanUnion**: performs a boolean union of two TRI-surfaces:
b = XOR.booleanUnion(a1, a2, tol=0.)

*Example of use: * union of two surfaces (array),
union of two surfaces (pyTree).

**XOR.booleanMinus**: performs a boolean difference of two TRI-surfaces:
b = XOR.booleanMinus(a1, a2, tol=0.)

*Example of use: * difference of two surfaces (array),
difference of two surfaces (pyTree).

**XOR.booleanIntersection**: performs a boolean intersection of two TRI-surfaces:
b = XOR.booleanIntersection(a1, a2, tol=0.)

*Example of use: * intersection of two surfaces (array),
intersection of two surfaces (pyTree).

**XOR.intersection**: returns the 'BAR' contour defining the intersection between two TRI-surfaces:
b = XOR.intersection(a1, a2, tol=0.)

*Example of use: * intersection contour of two surfaces (array),
intersection contour of two surfaces (pyTree).

**XOR.XcellN**: computes the cell nature field of a background mesh (bgm) in an overset configuration : similarily to the blanCells functions, the input maskMesh are volume meshes that hide bgm.
The computed celln is accurate, giving a floating value ranging from 0. (fully masked) to 1. (fully visible).

The input grids (bgm and makingMesh) are defined by coords located at nodes as a list of arrays.

*Warning: location of celln must be located at centers.*

*Warning: In order to set the celln to 0. inside blanking bodies, you need to create BCWall type boundaries on the body faces.*

celln = XOR.XcellN(bgm, celln, maskMesh)

* Example of use: * computing the cellN (pyTree).

### Auxiliary Functions

**XOR.triangulateExteriorFaces**: Triangulates any external polygon on a polyhedral mesh (NGON format)
b = XOR.triangulateExteriorFaces(NGON3Dmesh)

*Example of use: * array version,
pyTree version.

**XOR.convexifyFaces**: Makes a convex decomposition of any concave polygon (NGON format)
b = XOR.convexifyFaces(NGON3Dmesh)

*Example of use: * array version,
pyTree version.