How to make My Own Geometry


I’m trying to test some geometry for light guide and evaluate their performance using track as “ray tracing”. At this moment, I have obtained very atractive results, with primitives and composite shapes, like the picture attached, but I want to use more complex shape for the light guide, like a tube blended in two axis at the same time, or blended like an “s” in one of this axis, as a regular shape.

Could anybody helpme with this kind of “My Own Geometry”, or an shortcut for obtain this kind of shapes.


I presume you use TGeo geometry and its functionality to compute normal vectors to do reflections. I am not sure I understand your blended shapes, could you send something to get a better idea ?


Yes, I’m using TGeo for make this picture. By blended shape I mean that I take a torus shape for simulate a blended light guide.
So, my problem is that I need to simulate a light guide in a more complex way.
The first picture that a show was made it with this code:

//--- Define some Shapes TGeoTorus *tor = new TGeoTorus("tor",toroR,0,tubR,0,toroA);// The toroidal part TGeoVolume *cub = geom->MakeBox("cub", Plexi, tubR/TMath::Sqrt(2), tubR/TMath::Sqrt(2), tubR/TMath::Sqrt(2)); TGeoTrap *trapShape = new TGeoTrap("trap1",tubR,0,0,tubR/TMath::Sqrt(2),tubR/TMath::Sqrt(2),tubR/TMath::Sqrt(2),0,tubR,tubR,tubR,0); TGeoTube *cil1Shape = new TGeoTube("cil1",0,tubR,tubR);

//--- Defining the whole volume TGeoCompositeShape *wholeShape = new TGeoCompositeShape("WS1","(cil1*trap1):t2 + cub:t1 + tor:c1"); TGeoVolume *lGuide1 = new TGeoVolume("lguide1",wholeShape,Plexi); lGuide1->SetLineColor(kGreen); top->AddNode(lGuide1,1);
toro.C (5.5 KB)

Hi again,
Thanks for sharing your macro. I played a bit and added some modifications. First, you should not use getting outside the light guide volume as condition for stopping the ray. The sequence FindNextBoundary() + Step() has big numerical instabilities for torusaes. Better: use FindNextBoundaryAndStep() and do a cd() inside this volume because you can actually force the ray to stay inside and do a reflection. I attached some modification.

Now related to your original question, I guess for blended fibers you would need some spiraling torus shape, which we do not have, You could approximate such shape with small torus segments (small phi) connected end to end via a small rotation. Nothing else coming to mi mind…

toro.C (6.03 KB)

Thank you very much. This gives me a guide to continue my work

By the way, you can do spirals to represent blended fibers like in the attached macro.


spiral.C (2.52 KB)