RE: Constructive Quadric Geometry

From: Fine, Valeri <fine_at_bnl.gov>
Date: Thu, 8 Dec 2005 10:16:31 -0500


Hello Steven,

  I think your letter contains 2 separate questions.

  1. How to visualize the arbitrary "shape" with 3d rendering software
  2. How to make your object ROOT-compatible

I paid attention your package can already visualize things. http://www.nea.fr/abs/html/nea-1525.html

" . . .
. RELATED AND AUXILIARY PROGRAMS - The distribution package includes:   

for me this sounds like you can more / less quickly make use of the QGLViewer, the low level package the Root / Qt system uses as its 3D rendering tool.
http://artis.imag.fr/Members/Gilles.Debunne/QGLViewer/index.html

I believe QGLViewer is extremely powerful and simple to use package, that is available (free) for all Unixes and Windows systems.

Since this package is used by Qt/ROOT this means as soon as you can use that package stand-alone you can use it from within ROOT also. See the talk:

"Qt & ROOT" by Valeri Fine (BNL/STAR)

http://agenda.cern.ch/askArchive.php?base=agenda&categ=a055638&id=a05563 8s1t6/transparencies

from

http://agenda.cern.ch/fullAgenda.php?ida=a055638

What about your second question. This should be not too trouble either.

There are many way to do that. One of them (very rough idea, sorry).

One should subclass TGeoShape ROOT C++ class and create two extra classes, let's call them: TQuadricModel and TQuadricView .

Like this:

  class TQuadricShape : public TGeoShape {

     private:
           TQuadricModel *fQudaricModel;
           TQuadricView  *fQudaricView;  
     public:

    void SetPoints(Double_t *points) const };

The first fQudaricModel is the data-member to represent your "Quadric Geometry" (I guess it should be some C++ wrapper around of your Fortran code), that has no 3D rendering capability / dependencies. It should provide an access (interface) to the parameters of your " Quadric"

The second one fQudaricView is to create an array is so-called Mesh-points (See for example:)
http://root.cern.ch/root/htmldoc//src/TGeoSphere.cxx.html#TGeoSphere:Set Points

The TQuadricView is supposed to have no ROOT C++ library dependency either.

The later should be enough to make your class objects rendered with Qt/ROOT built-it 3D rendering. However, Qt is not only ROOT rendering engine. To make your geometry available to other engines (with no Qt layer) you should provide an extra implementations of a few more methods
(To be discussed later. I am just drawing a very raw picture)

Of course, one may not separate the job by 3 classes: TQuadricShape, TQuadricModel, TQuadricView.

However, I think such separation worth your effort because it would have allowed you to render your TQuadricModel with ROOT and with NO ROOT (let say with QGLViewer alone or with Coint3D package.). In fact you may start from the TQuadricView with no ROOT and as soon as it does what you want move on with ROOT TQuadricShape wrappers and provide your classes as a ROOT plug-in.

This is the very rough picture of the effort needed to be undertaken to bring the new "geometry" shape into ROOT. Since you already can render your objects somehow, I am wondering if you already know how to do the 90% of the job.

I am begging a pardon I cannot go further because at this point I need to learn your packages a little bit more to be more specific.

My best regards,

                       Valeri


----
Dr. Valeri Fine                          
Brookhaven National Laboratory
P.O.Box 5000
Upton, NY 11973-5000

Phone: +1 631 344 7806
Fax: +1 631 344 4206
E-mail: fine_at_bnl.gov

> -----Original Message-----
> From: owner-roottalk_at_pcroot.cern.ch
[mailto:owner-roottalk_at_pcroot.cern.ch] On

> Behalf Of Steven Morrow
> Sent: Thursday, December 08, 2005 6:04 AM
> To: roottalk_at_pcroot.cern.ch
> Subject: [ROOT] Constructive Quadric Geometry
> 
> 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
> (http://www.nea.fr/abs/html/nea-1525.html). 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
> 
> --
> ========================================================
>  Steven MORROW, DOSIsoft, | Tel: +33(0)1 41 24 26 21
>  45-47, avenue Carnot,    | Fax: +33(0)1 41 24 26 28
>  94230 CACHAN, FRANCE     | E-mail: morrow_at_dosisoft.com
> ========================================================
> 
Received on Thu Dec 08 2005 - 16:17:13 MET

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