# How to define a cone with varying curvature

Hi! I would need to draw with root a cone whowas a curved surface (see attachment). Moreover, it would have a hexagonal entrance surface and a circulare (or squared) surface at its exit. Any idea how to define such shape within ROOT.

Many Thanks

You mean with TGeo ?

Hi! Yes! Or is there another possibility?

Hi,
There is no shape which can provide natively the curvature you mention. You can however approximate this with a polycone having many Z sections. Then you can subtract this from a standard polygon shape. I’ll send you an example tomorrow.

Cheers,

Hi Andrei! A small example would be fantastic!

Hi,

Sorry, I’ve had no time to do it today, but yes, I’ll send you a small example as soon as I can.

Cheers,

Hi,
Here it is, code and resulting picture(s). Hope this helps.
Best,
hexaround.C (1.36 KB)

Or this which will get a more accurate drawing closer to what you wanted.
hexaround2.C (1.42 KB)

Cheers,

Hi Andrei! Thank you so much! I did not get any notification that you replied and just saw now by chance your answer. Looking to what you get, I already see one “problem”, i.e. that actually the surfaces of my object are not flat but also curved…Still this is only an approximation (obviously the more points added the better the match. I am using a drawing program to create the object from which I can save the following information:
(x,y,z) spline value (can vary between 0 and 1). Do you see any solution how to use this information to create the object in ROOT?

Cheers

Cornelia

[quote=“agheata”]Or this which will get a more accurate drawing closer to what you wanted.
hexaround2.C
hexaround2.gif
Cheers,[/quote]
punti_WC.txt (3.47 KB)

Hi Andrei!

Again many thanks for the solution you provided me with! However I would need a more accurate way to create the object within the ROOT framework. Isn’t there any chance to use TSpline to define the surfaces?

I attached a file with the coordinates of such SPline in my previous post.

Many thanks!

C

Hi,

As I’ve mentioned, there is no native way to use of splines or special surfaces in defining geometry objects in ROOT. However, you can use the macro that I attached and compute the radii of the clipping polycone using splines, and use as many Z sections as you need to have a more accurate drawing. On the other hand you won’t be able to morph from the planar surface to the conical surface smoothly. The ROOT shapes are simple because this allows to have performance when navigating in detector geometry setups.

Cheers,

Dear Andrei!

Thanks again! May I suggest then to implement the possibility to usea grid of points then to draw more complex geometries based on bs3 surfaces as used to define the object I am woring and which I attached? For the time being, what if making and extrusion of the TGEoPcon from an inscribed circle?

Cheers

C

p.s. googling a bit it seems that a c++ class for 3D bslpine surfaces exists already doc.spatial.com/qref/ACIS/html/g … METRY.html