Re: Constructive Quadric Geometry

From: Rene Brun <>
Date: Thu, 8 Dec 2005 16:17:37 +0100 (MET)

Hi Steven,

The ROOT geometry package does not support quadrics (it is unusual to build detector geometries this way ::)

However, you can visualize quadrics via the TF3 class. Below you will find two examples.

Currently the graphics output is only in the normal ROOT pad. It would be nice to have also the output via the GL viewer. We have defined a general protocol to translate user 3-d objects into a 3-D viewer (abstract interface TVirtualViewer3D). The description of this interface will be part of the coming ROOT Users Guide. We can provide it in the coming days if you like. We will try to come with a TF3 output in GL too in teh short term.

Rene Brun

//script f3a.C

    double d = 0.9;
    TF3 *f3 = new TF3("f3","x*x+z*z-exp(-y*y)",-d,d,-d,d,-d,d);     f3->SetFillColor(38);

//script f3b.C

     TF3 *f = new TF3("test","sqrt(x**2+y**2)-z",-1,1,-1,1,0,1);


Thu, 8 Dec 2005, Steven Morrow wrote:

> Hello,
> I have a general question regarding a visualisation of geometries which I
> would like to do with ROOT. (Please excuse the length of this mail.)
> I am a user of a Monte Carlo simulation code called PENELOPE
> ( The geometry package of this code
> uses quadric surfaces for the construction of the 3D geometry. This is
> different from ROOT, or GEANT or other codes that I've known before, which
> use solid primitives such as cylinders or boxes and then a 'Constructive
> Solid Geometry' (CSG) to combine these primitives to make more complicated
> shapes (Phys.Med.Biol. 46 (2001) 1163-1186).
> The implicit equation for a quadric is:
> F(x,y,z) = A*x*x + B*x*y + C*x*z + D*y*y + E*y*z + F*z*z + G*x + H*y + I*z +
> J = 0
> which allows to draw planes, pairs of planes, spheres, cylinders, cones,
> ellipsoids, paraboloids, hyperboloids, etc.
> My problem is to be able to visualise in 3D the geometries created by
> PENELOPE. I would like to create a ROOT application for this. (The
> visualisation codes provided with PENELOPE are fairly primitive.) For this I
> need a library that will allow me to draw a quadric surface (from its
> equation above) and then combine these quadrics in a 'Constructive Quadric
> Geometry'. The only code I have found which allows this is POV-Ray, however
> this renders the image very slowly and doesn't allow interaction with the
> mouse.
> I like very much the graphics possibilities provided by ROOT and I would like
> to use it for this task. However ROOT doesn't have the possibility to draw
> quadrics. I see that openGL classes are being added to ROOT, however openGL
> doesn't seem capable of an intrinsic quadric either. (Only specific cases
> such as cylinders or spheres can be rendered .)
> I would have liked to contribute to ROOT by adding a class to permit the use
> of quadrics, but my programming skills are not up to the job and I don't know
> the internal workings of ROOT well enough to manage this.
> Might quadric geometries be added to ROOT at some time in the future? Does
> anyone have any experience of using quadric surfaces for this purpose? Or
> know of an existing code which can do what I need now?
> Regards,
> Steven Morrow
Received on Thu Dec 08 2005 - 16:18:14 MET

This archive was generated by hypermail 2.2.0 : Tue Jan 02 2007 - 14:45:14 MET