Hi,
I’m using the geometry classes but I’m stuck on a problem.

Is there a way to get the main points of a geometry ?

For example :
I produce this geometry by cutting cylinders using TGeoIntersection. For the red TGeoCompositeShape, I have to get the A,B points, the center (ok for this) and a point on the arc.

Yes, you can use the DistanceToIn/Out interface of TGeoShape. For example, if you know the coordinates of a point on the AB line and the direction of AB vector, you can call DistanceToIn/Out for the component cylinders after converting the point to their local coordinates. Think of this method as using a “ruler”. It may be tricky to find your reference points, but TGeoCompositeShape cannot offer this kind of functionality due to the complexity and infinite number of shape combinations.

Hi,
I tried this, it works fine in a lot of cases, but I found unexpected results with a TGeoPgon.

I launched DistanceFromOutside with the (0;0;0) starting point and the (0;1;0) vector to find the first intersection. But it returns 80.0 instead of 40.0 on the Y axis. I changed the size values of the tube but no changes.
I found a solution to this problem by moving the starting point to (0;0.00001;0).
Did I miss something ?

The DistanceFromInside seems work well and returns 50, the good value. These methods are working well with a cylindrical tube.

Hi, for the Pgon you may have hit a singularity where the algorithm behaves bad. To fix the bug, I would need the shape (preferrably saved in a ROOT file) and starting point/direction.

Note that the call for DistanceFromInside from (0,0,0) gives a “correct” answer just by chance since a point inside the “hole” of the Pgon shape is not considered inside the shape, so you are supposed to call only DistanceFromOutside

Note that when you use distance methods as a “ruler”, you should avoid querying along side planes, which may give unpredictible results.