|
ROOT
Reference Guide |
|
Combinatorial Solid Geometry example.
void csgdemo ()
{
bar->AddButton(
"How to run ",
"help()",
"Instructions ");
bar->AddButton(
"Union ",
"s_union()",
"A + B ");
bar->AddButton(
"Intersection ",
"s_intersection()",
"A * B ");
bar->AddButton(
"Difference ",
"s_difference()",
"A - B ");
bar->AddButton(
"Complex composite",
"complex_1()",
"(A * B) + (C - D)");
}
void MakePicture()
{
}
void s_union()
{
gROOT->GetListOfCanvases()->Delete();
TCanvas *
c =
new TCanvas(
"composite shape",
"Union boolean operation", 700, 1000);
MakePicture();
pt->
AddText(
"----- It's an example of boolean union operation : A + B");
pt->
AddText(
"----- A == part of sphere (5-175, 0-340), B == pgon");
}
void s_intersection()
{
gROOT->GetListOfCanvases()->Delete();
TCanvas *
c =
new TCanvas(
"composite shape",
"Intersection boolean operation", 700, 1000);
MakePicture();
pt->
AddText(
"----- Here is an example of boolean intersection operation : A * B");
pt->
AddText(
"----- A == sphere (with inner radius non-zero), B == box");
}
void s_difference()
{
gROOT->GetListOfCanvases()->Delete();
TCanvas *
c =
new TCanvas(
"composite shape",
"Difference boolean operation", 700, 1000);
MakePicture();
pt->
AddText(
"----- It's an example of boolean difference: A - B");
pt->
AddText(
"----- A == part of sphere (0-180, 0-270), B == partial torus (45-145)");
}
void complex_1()
{
gROOT->GetListOfCanvases()->Delete();
MakePicture();
pt->
AddText(
"----- (sphere * box) + (sphere - box) ");
}
{
memcpy(&
line[0], datamember, strlen(datamember));
char number[20];
sprintf(number, "%5.2f", value);
memcpy(&
line[12], number, strlen(number));
}
{
memcpy(&
line[0], datamember, strlen(datamember));
char number[20];
sprintf(number, "%5i", value);
memcpy(&
line[12], number, strlen(number));
}
{
if (!pave || !pf) return;
AddText(pave,
"fNdiv",finder->
GetNdiv(),
"number of divisions");
AddText(pave,
"fStart",finder->
GetStart(),
"start divisioning position");
AddText(pave,
"fStep",finder->
GetStep(),
"division step");
}
void raytrace() {
if (!painter) return;
}
void help() {
new TCanvas(
"chelp",
"Help to run demos",200,10,700,600);
welcome->
AddText(
"Welcome to the new geometry package");
hdemo->
AddText(
"- Demo for building TGeo composite shapes");
}
- Author
- Andrei Gheata
Definition in file csgdemo.C.
virtual void SetRaytracing(Bool_t flag=kTRUE)=0
TGeoShape * GetShape() const
virtual void SetName(const char *name)
Set the name of the TNamed.
TGeoVolume * MakeBox(const char *name, TGeoMedium *medium, Double_t dx, Double_t dy, Double_t dz)
Make in one step a volume pointing to a box shape with given medium.
R__EXTERN TGeoManager * gGeoManager
virtual void SetTextColor(Color_t tcolor=1)
Set the text color.
void CloseGeometry(Option_t *option="d")
Closing geometry implies checking the geometry validity, fixing shapes with negative parameters (run-...
virtual void SetAllWith(const char *text, Option_t *option, Double_t value)
Set attribute option for all lines containing string text.
void box(Int_t pat, Double_t x1, Double_t y1, Double_t x2, Double_t y2)
virtual void AddNode(TGeoVolume *vol, Int_t copy_no, TGeoMatrix *mat=0, Option_t *option="")
Add a TGeoNode to the list of nodes.
virtual void SetTextSize(Float_t tsize=1)
Set the text size.
TGeoVolume * GetVolume() const
virtual void SetLineColor(Color_t lcolor)
Set the line color.
virtual int Load(const char *module, const char *entry="", Bool_t system=kFALSE)
Load a shared library.
static constexpr double bar
Class describing translations.
A Control Bar is a fully user configurable tool which provides fast access to frequently used operati...
Base class describing materials.
Base finder class for patterns.
Class handling Boolean composition of shapes.
void SetNsegments(Int_t nseg)
Set number of segments for approximating circles in drawing.
virtual void Draw(Option_t *option="")
Draw this pavetext with its current attributes.
void SetTopVolume(TGeoVolume *vol)
Set the top volume and corresponding node as starting point of the geometry.
Base abstract class for all shapes.
TVirtualGeoPainter * GetGeomPainter()
Make a default painter if none present. Returns pointer to it.
virtual void Draw(Option_t *option="")
draw top volume according to option
virtual TText * AddText(Double_t x1, Double_t y1, const char *label)
Add a new Text line to this pavetext at given coordinates.
virtual void DefineSection(Int_t snum, Double_t z, Double_t rmin, Double_t rmax)
Defines z position of a section plane, rmin and rmax at this z.
R__EXTERN TSystem * gSystem
virtual const char * GetAxisName(Int_t iaxis) const =0
virtual void SetTextAlign(Short_t align=11)
Set the text alignment.
Base class for several text objects.
Double_t GetStart() const
Abstract class for geometry painters.
virtual void SetFillColor(Color_t fcolor)
Set the fill area color.
Mother of all ROOT objects.
A Pave (see TPave) with text, lines or/and boxes inside.
virtual void RegisterYourself()
Register the matrix in the current manager, which will become the owner.
Media are used to store properties related to tracking and which are useful only when using geometry ...
virtual const char * GetName() const
Returns name of object.
The manager class for any TGeo geometry.
virtual void SetTextFont(Font_t tfont=62)
Set the text font.
TGeoVolume, TGeoVolumeMulti, TGeoVolumeAssembly are the volume classes.