Intersection between TGeoHalfSpace and a TGeoBox in OpenGL

Hello all

With this small macro, I would like to build a composite shape using a TGeoHalfSpace (intersection between a box and half a space). I am expecting to see half a box and what I see is a plane and not where it might be expected when I draw the corresponding volume in the ROOT’s GL viewer.
Do I missed something ? Is there something wrong ?

many thanks

Olivier

PS: tested with root 5.12/00 on SL4
HalfSpace.C (771 Bytes)

Hi Olivier,

The shape is OK (replacing Draw(“ogl”) with Raytrace() in your macro produces the right picture) - the problem is that half-spaces are not yet supported with any viewer…

Regards,

[quote]Hello all

With this small macro, I would like to build a composite shape using a TGeoHalfSpace (intersection between a box and half a space). I am expecting to see half a box and what I see is a plane and not where it might be expected when I draw the corresponding volume in the ROOT’s GL viewer.
Do I missed something ? Is there something wrong ?
[/quote]

I guess it’s not a plane what we see in a gl-viewer, it can be literally intersection of a box and a plane?

TGeoHalfSpace is not just a plane, but the infinite space bounded on one side by a plane (the normal pointing outwards). It is not possible to draw it standalone (infinite), but can be used in Boolean combinations like intersection and subtraction (A*H, A-H, where A is a finite body). One solution is to make the viewer “see” it as a huge box and work with it as it would be finite… I don’t know, maybe there are better solutions with GL and CSG stuff…

[quote]
TGeoHalfSpace is not just a plane,
[/quote]]
My guess was about a picture in the gl-viewer, not about how TGeoHalfSpace implemented or infinity of half-spaces.

[quote]
One solution is to make the viewer “see” it as a huge box and work with it as it would be finite… I don’t know, maybe there are better solutions with GL and CSG stuff…[/quote]
Yes, I think it’s the only solution for us. But how to do it? TGeoHalfSpace::SetPoints has an empty implementation. Which sizes should be used here?

Yes, because SetPoints() makes sense only for finite bodies. If we chose to fake a half-space with a box (for visualization) we have of course to implement this method and the size of the box should probably depend on the Boolean combination the hspace enters into.
Something to work on when I will have some time…

Cheers,

We can add specific types of operations, for example kCSIntersectionHS (CS for compound shapes, HS for half space here :slight_smile: ). And have additional switch branches in TGLViewer::BuildComposite.