Re: Constructive Quadric Geometry

From: Andrei Gheata <>
Date: Fri, 09 Dec 2005 11:13:09 +0100

Hi Steven,

If I well understood, you want to be able to transpose/visualize a quadric surface-oriented model into ROOT. As you noticed, the geometry models supported by ROOT are CSG-based. This does not necessary mean that you do not have quadric-based objects, but indeed the allowed topologies are rather poor: generally you can make and draw objects that are the result of rotating a quadric about one axis: spheres, paraboloids, hyperboloids. Drawing such objects (in pad or GL) is done by providing the solid mesh made of points, then the segments and polygons that are the final "drawable" objects. There are several examples on how doing this in all classes deriving from TGeoShape. Once you provide a class that implements these methods you have the drawing in any supported viewer. Of course one has to provide the algorithms to make "closed" CSG bodies out of quadrics. The problem is that what you want to solve is too general and complex to hope that you will get some direct support in ROOT in the near future, so let me know if you need some help in trying to implement it yourself...


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 Fri Dec 09 2005 - 11:13:25 MET

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