# Converting B-Reps to Trees in Data Structure

Data Structure AlgorithmsAnalysis of AlgorithmsAlgorithms

## 1 B-rep Streams

It is clearly stated to set up a producer process importing a B-rep, externally defined by some standard polygonal format, e.g. either a wave front or java3D obj file, into an input stream for our geometric pipeline. The boundary representation provided by polygons and normal must be coherently oriented. A filtering of the input file to cope with nonplanar polygons and other geometric inaccuracies may be required for generally archived geometric models implemented primarily in computer graphics. The output stream of coherently-oriented triangles, is then transformed into our twin progressive-BSP (Binary Search Partitioning) trees by the algorithmic steps described below.

## 2 B-rep to BSP Algorithm Outline

A basic procedure of our method is the calculation of the inertia of triangle subsets by contraction of the pre-computed inertia of each triangle, and the Eigen decomposition of the inertia of triangle subsets to bound their shape optimally and recursively.

In case of the d-dimensional case, the shape confinement is obtained implementing 2 extremal tangent hyperplanes for each of the d eigenvectors of the Euler matrix. The intersection of the corresponding 2d hyperspaces creates the best-fitting (hyper)parallelepiped of the boundary subset included in the current cell. In 3Dimension, there is 6=2×3 such planes.

Initialization

• The affinely extended Euler tensors of each input triangle are first calculated (in linear time).
• The entire set of input triangles is joined with the BSP root.
• The entire E3 space (that is convex) is joined to the root.
• Root label is set to FUZZY.

Recursive case

• The current FUZZY cell is divided by at most 6 orthogonal hyperplanes that are perpendicular to the eigenvectors of the matrix representation of the Euler tensor of the current triangle subset.
• Such planes are calculated via the lowest and the highest value of the linear function w = a • v evaluated on the vertices v of the current triangle subset, where a is denoted as the current eigenvector.
• In case of each eigenvector, maximum three convex cells are produced by two max-min parallel hyperplanes, that are either {OUT, FUZZY, IN} or {OUT, FUZZY, OUT}.
• Each FUZZY cell is further divided by the principal hyper-plane associated to the maximum eigenvector.
• A smaller subset of triangles is joined to each divided cell via containment test of their vertices.
• Triangles crossing a dividing plane are divided, and the (sub)triangles are joined to node subtrees.

Basic case

The recursive inertia-based division stops when the current cell only consists of a small number of boundary triangles. A final cell division is executed implementing the planes of the boundary triangles.