I am new to Open Cascade (OCC) and would be very grateful for your help and advice.

One of my student project tasks is to convert data from a "geometrical" (preferable IGES; maybe STL and STEP, because they are supported from OCC, too) into a "bitmapped" representation. This means, to VOXELIZE the data.

Right now, I have two possibilities in mind but don?t know if and how I can employ Open Cascade to solve them.

1) Scan line algorithm
1. Read in IGES
2. Calculate intersection points between IGES data surface and scan lines
3. Rasterize between intersection points in order to mark a voxel as inside our outside

Questions to the 2. step in this approach:
* How to calculate intersections? GeomAPI_IntCS returns intersections between a curve and a surface. How to convert the imported IGES data (probably an instance of TopoDS_Shape ?) into the required Geom_Surface instance?
* Is there a better way of calculating the intersections?

2) Tessellate with OCC and use already implemented scan line algorithm (with VTK)
1. Read in IGES
2. Tessellate/triangulate IGES data surface into CLOSED polygonal/triangular mesh
3. Export polygonal (triangular) mesh and apply scan line algorithm by means of VTK

Questions to the 2. step in this approach:
* Is there a way to tessellate/triangulate the surface and get a closed polygonal mesh? (The VTK scan line algorithm requires a closed mesh.)

Which way is the one to go? Or could you suggest me another/better solution?

Best regards,

trillion's picture

I have the same quesion! esspacialy question 2

Torsten Sadowski's picture


I use IntCurvesFace_ShapeIntersector to calculate the intersections between the scanlines and the shape. The scanlines are on a grid in an area a bit larger than the shapes bounding box. That means all voxels from the start to the scanline to the first intersection are outside, then inside to the next and so on. If you have an odd number of intersections on a scanline then the line is just touching somewhere. Then you need additional checks with BRepClass3d_SolidClassifier. The simple approach of using BRepClass3d_SolidClassifier throughout is too slow.

Cheers, Torsten