Re: Sphere

From: Andrei Gheata <Andrei.Gheata_at_cern.ch>
Date: Wed, 10 Aug 2005 09:20:38 +0200


Hi Zaldy,

Below is how you can draw a sphere with TGeo classes. Note that when using TGeo you have to create always a geometry :

void draw_sph()
{

   gSystem->Load("libGeom");
   TGeoManager *geom = new TGeoManager("myGlobe", "Globe");    TGeoMaterial *mat = new TGeoMaterial("vacuum",0,0,0);    TGeoMedium *med = new TGeoMedium("vacuum", 1, mat);    // Create the top volume of your geometry    TGeoVolume *top = geom->MakeBox("TOP",med,100,100,100);    geom->SetTopVolume(top);
   // Now make the sphere
   TGeoVolume *sph = geom->MakeSphere("GLOBE",med, 0, 40); // *    // put the sphere in the origin of the top volume    top->AddNode(sph,1);
   // Close the geometry
   geom->CloseGeometry();
   // Draw the top volume; note that just the sphere is visible    top->Draw();
   // If you want you can change the number of "meridians"    geom->SetNsegments(24);
}

If you want a "cut" globe along the equator, replace //* line with:

   geom->MakeSphere("GLOBE",med,0,40,90,180,0,360);

Note that when drawing in wireframe mode you will get the projections you want in this case.

Cheers,
Andrei

zaldy wrote:

>Dear Folks,
>
>I would like to draw a Sphere.
>In the sphere I want to draw also the grid/curve/linemarker similar to the
>lattitude and longitude lines of the globe.
>
>Then I want to project these grids/curves onto a plane that divides the
>sphere half. This plane divides the sphere or globe along its axis.
>The figures that would appear on the plane is like a "net".
>
>
>There is a class "TGeoSphere and SPHE" but
>
>how to start this one? Is this possible?
>
>What about the projection on the plane?
>
>
>Thanks a lot.
>
>
Received on Wed Aug 10 2005 - 09:15:10 MEST

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