Clipping precision using TGeoCompositeShape

I’m new on ROOT.

Today, I simply tried clip a geometry (a cube and a cylinder) by using TGeocompositeShape and TGeoIntersection.

When i clip a cube by four, the result is good but not on the following cases.

I link a file with my very simple test cases and my results just below.
We can see that there is differences between the expected and the real result.

Then, am I doing something wrong to cut my geometry ?
Are the cylinders polygonized when I clip the geo ? (3.6 KB)

Results :

-> Cylinder clip 1/4
tubeV capacity > 90477.8684234
Result > 22595.3240232
Expected > 22619.4671058
Difference > -18.4829020139

-> Cylinder clip 1/8
tubeV capacity > 90477.8684234
Result > 11233.7637009
Expected > 11309.7335529
Difference > 22.6979674083

-> Cube clip 1/4
singleBoxV capacity > 2000000.0
Result > 500000.0
Expected > 500000.0
Difference > 0.0
==============> OK

-> Cube clip 1/8
singleBoxV capacity > 2000000.0
Result > 248991.584084
Expected > 250000.0
Difference > 2426.22301446

I think @agheata will know.

Thanks for your answer @couet. I hope @agheata will see this thread.

I thought that maybe, when clipping, the shape is good but my results are bad because i use the TGeoVolume.Capacity() to control my operation and this method could be not accurate.

ps : I re-uploaded the source file due to a mistake on the first one.


The capacity for composite shapes cannot be accurate, it is computed by sampling (i.e. sample N point in the bounding box, then capacity = bbox_capacity*Ninside/N). The number of sampling points is now hard-coded to 10000. This could be configurable, but it will never be an accurate number.

Thanks for the answer.
I have two others questions

Do you know how is described an arc once a tube is cut (is it polygonized or really described as an arc) ?

Actually, I’m making an intersection of my big geometry with a simple shape (extruded polygon). I intersect recursively all the nodes one by one.
Is there an easy way to cut a massive hierarchical geometry by a shape ?

No shape is “polygonized”, it is only the shape representation used for visualization that does. It would be interesting to know why you need to do such a complex operation - if it is just for visualization this is done in the GL viewer (you can not use arbitrary shape however.

… you can also try TGeoManager::SetClippingShape(), which allows you to cut the geometry with a shape when using TGeoVolume::Raytrace()

I’m working on a tool for reactor core conception.
Today, the first version of this tool is using shapely to compute the geometries. All the circles, arcs are “polygonized”. Once the geometry is created, it is send to a mesh tool and then to a solver.

We are studying ROOT to replace shapely and the actual complex geometry management.
It is why I’m asking about the precision of the operations. I do not found this information in the doc for the moment.

The reactor core are very large geometry then we need to cut them by 1/4 or 1/8 for example. I didn’t find a easier way to cut it than to recursively intersect all the interesting nodes by a shape.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.