Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions README/ReleaseNotes/v642/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,10 @@ Such file can be loaded locally in any web browser or send as attachment in emai

## Geometry

The [TGeometry](https://root.cern/doc/master/classTGeometry.html) classes (Geant 3 shapes) have been moved out of Graf3D into their own library.
To link to these classes, use the cmake target `TGeometry` (preferred), `root-config --libs`, or link with `-lTGeometry`.
When ROOT is configured with `-Dgeom=Off`, these classes are now off as well.

## Documentation and Examples

## Build, Configuration and Testing
Expand Down
2 changes: 1 addition & 1 deletion config/root-config.in
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ fi
newlib="-lNew"
rootglibs="-lGui"
rootevelibs="-lEve -lEG -lGeom -lGed -lRGL"
rootlibs="-lCore -lImt -lRIO -lNet -lHist -lGraf -lGraf3d -lGpad -lROOTVecOps -lTree -lTreePlayer\
rootlibs="-lCore -lImt -lRIO -lNet -lHist -lGraf -lGraf3d -lTGeometry -lGpad -lROOTVecOps -lTree -lTreePlayer\
-lRint -lPostscript -lMatrix -lPhysics -lMathCore -lThread -lROOTNTuple -lROOTNTupleUtil"

# MultiProc is not supported on Windows
Expand Down
22 changes: 14 additions & 8 deletions graf3d/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,27 @@
# For the licensing terms see $ROOTSYS/LICENSE.
# For the list of contributors see $ROOTSYS/README/CREDITS.

add_subdirectory(g3d) # special CMakeLists.txt
add_subdirectory(g3d)

if(NOT WIN32 AND x11)
add_subdirectory(x3d) # special CMakeLists.txt
add_subdirectory(x3d)
endif()

add_subdirectory(csg) # special CMakeLists.txt
add_subdirectory(csg)

if (opengl)
if(geom)
add_subdirectory(gl)
endif()

if(geom)
add_subdirectory(TGeometry)

if(opengl)
add_subdirectory(eve)
add_subdirectory(gviz3d)
endif()
add_subdirectory(gl)
endif()

if(webgui AND root7 AND geom)
add_subdirectory(eve7) # special CMakeLists.txt
if(webgui AND root7)
add_subdirectory(eve7)
endif()
endif()
68 changes: 68 additions & 0 deletions graf3d/TGeometry/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# Copyright (C) 1995-2026, Rene Brun and Fons Rademakers.
# All rights reserved.
#
# For the licensing terms see $ROOTSYS/LICENSE.
# For the list of contributors see $ROOTSYS/README/CREDITS.

############################################################################
# CMakeLists.txt file for building ROOT's TGeometry package
############################################################################

ROOT_STANDARD_LIBRARY_PACKAGE(TGeometry
HEADERS
TGeometry.h
TMaterial.h
TNode.h
TRotMatrix.h
TShape.h
TMixture.h
TBRIK.h
TCONE.h
TCONS.h
TCTUB.h
TELTU.h
TGTRA.h
THelix.h
THYPE.h
TNodeDiv.h
TPARA.h
TPCON.h
TPGON.h
TSPHE.h
TTRAP.h
TTRD1.h
TTRD2.h
TTUBE.h
TTUBS.h
TXTRU.h
SOURCES
TGeometry.cxx
TMaterial.cxx
TNode.cxx
TRotMatrix.cxx
TShape.cxx
TMixture.cxx
TBRIK.cxx
TCONE.cxx
TCONS.cxx
TCTUB.cxx
TELTU.cxx
TGTRA.cxx
THelix.cxx
THYPE.cxx
TNodeDiv.cxx
TPARA.cxx
TPCON.cxx
TPGON.cxx
TSPHE.cxx
TTRAP.cxx
TTRD1.cxx
TTRD2.cxx
TTUBE.cxx
TTUBS.cxx
TXTRU.cxx
DEPENDENCIES
Graf3d
)

ROOT_ADD_TEST_SUBDIRECTORY(test)
44 changes: 44 additions & 0 deletions graf3d/TGeometry/inc/LinkDef.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/*************************************************************************
* Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *
* All rights reserved. *
* *
* For the licensing terms see $ROOTSYS/LICENSE. *
* For the list of contributors see $ROOTSYS/README/CREDITS. *
*************************************************************************/

#ifdef __CLING__

#pragma link off all globals;
#pragma link off all classes;
#pragma link off all functions;

#pragma link C++ enum EHelixRangeType;

#pragma link C++ global gGeometry;
#pragma link C++ class TGeometry-;
#pragma link C++ class TMaterial-;
#pragma link C++ class TMixture-;
#pragma link C++ class TNode-;
#pragma link C++ class TRotMatrix-;
#pragma link C++ class TShape-;
#pragma link C++ class TBRIK+;
#pragma link C++ class TCONE+;
#pragma link C++ class TCONS+;
#pragma link C++ class TCTUB-;
#pragma link C++ class TELTU+;
#pragma link C++ class TGTRA+;
#pragma link C++ class THelix-;
#pragma link C++ class THYPE+;
#pragma link C++ class TNodeDiv+;
#pragma link C++ class TPARA+;
#pragma link C++ class TPCON-;
#pragma link C++ class TPGON+;
#pragma link C++ class TSPHE-;
#pragma link C++ class TTRAP+;
#pragma link C++ class TTRD1+;
#pragma link C++ class TTRD2+;
#pragma link C++ class TTUBE-;
#pragma link C++ class TTUBS+;
#pragma link C++ class TXTRU+;

#endif
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,11 @@ class TGeometry : public TNamed {
TRotMatrix *GetCurrentPosition(Float_t *x,Float_t *y,Float_t *z) const;
Bool_t GetCurrentReflection() const;
Bool_t IsFolder() const override {return kTRUE;}
virtual void Local2Master(Double_t *local, Double_t *master);
virtual void Local2Master(Float_t *local, Float_t *master);
virtual void Local2Master(Double_t const *local, Double_t *master) const;
virtual void Local2Master(Float_t const *local, Float_t *master) const;
void ls(Option_t *option="rsn2") const override;
virtual void Master2Local(Double_t *master, Double_t *local);
virtual void Master2Local(Float_t *master, Float_t *local);
virtual void Master2Local(Double_t const *master, Double_t *local) const;
virtual void Master2Local(Float_t const *master, Float_t *local) const;
virtual void Node(const char *name, const char *title, const char *shapename, Double_t x=0, Double_t y=0, Double_t z=0
, const char *matrixname="", Option_t *option="");
virtual Int_t PushLevel(){return fGeomLevel++;}
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
6 changes: 3 additions & 3 deletions graf3d/g3d/inc/TNode.h → graf3d/TGeometry/inc/TNode.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@
#ifndef ROOT_TNode
#define ROOT_TNode

#include "TShape.h"
#include "TAttLine.h"
#include "TAttFill.h"
#include "TAtt3D.h"

#include "TRotMatrix.h"
#include "TNamed.h"

class TBrowser;
class TShape;
class TRotMatrix;

class TNode : public TNamed , public TAttLine, public TAttFill, public TAtt3D {

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
3 changes: 1 addition & 2 deletions graf3d/g3d/inc/TShape.h → graf3d/TGeometry/inc/TShape.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,12 @@
//////////////////////////////////////////////////////////////////////////

#include "TNamed.h"
#include "TMaterial.h"
#include "TAttLine.h"
#include "TAttFill.h"
#include "TAtt3D.h"
#include "X3DBuffer.h"

class TBuffer3D;
class TMaterial;
class TNode;

class TShape : public TNamed, public TAttLine, public TAttFill, public TAtt3D {
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#include "TBuffer3D.h"
#include "TBuffer3DTypes.h"
#include "TGeometry.h"

#include "X3DBuffer.h"

/** \class TBRIK
\ingroup g3d
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,3 @@ TELTU::TELTU(const char *name, const char *title, const char *material, Float_t
TELTU::~TELTU()
{
}

File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,30 @@
* For the list of contributors see $ROOTSYS/README/CREDITS. *
*************************************************************************/

#include "TROOT.h"
#include "TBuffer.h"
#include "THashList.h"
#include "TObjArray.h"
#include "TGeometry.h"
#include "TNode.h"
#include "TMaterial.h"
#include "TNode.h"
#include "TRotMatrix.h"
#include "TShape.h"
#include "TGeometryTransformer.h"

#include "TBrowser.h"
#include "TBuffer.h"
#include "THashList.h"
#include "TObjArray.h"
#include "TROOT.h"

TGeometry *gGeometry = nullptr;

namespace {
// When a TGeometry is active, classes like TPolyline3D and similar transform their points.
// This function executes this transformation, and allowed for moving TGeometry out of graf3d.
void transformLocalToMasterWithCurrentGeometry(double *local, double *master)
{
assert(gGeometry);
gGeometry->Local2Master(local, master);
}
} // namespace

/** \class TGeometry
\ingroup g3d
Expand Down Expand Up @@ -103,6 +116,7 @@ TGeometry::TGeometry()
fMatrixPointer = nullptr;
fShapePointer = nullptr;
gGeometry = this;
ROOT::Internal::currentTGeometryTransformer = &transformLocalToMasterWithCurrentGeometry;
fBomb = 1;
fMatrix = nullptr;
fX=fY=fZ =0.0;
Expand All @@ -124,6 +138,7 @@ TGeometry::TGeometry(const char *name,const char *title ) : TNamed (name, title)
fMatrixPointer = nullptr;
fShapePointer = nullptr;
gGeometry = this;
ROOT::Internal::currentTGeometryTransformer = &transformLocalToMasterWithCurrentGeometry;
fBomb = 1;
fMatrix = nullptr;
fX=fY=fZ =0.0;
Expand Down Expand Up @@ -222,6 +237,8 @@ TGeometry::~TGeometry()
gGeometry = (TGeometry*) gROOT->GetListOfGeometries()->First();
if (gGeometry == this)
gGeometry = (TGeometry*) gROOT->GetListOfGeometries()->After(gGeometry);
if (gGeometry)
ROOT::Internal::currentTGeometryTransformer = nullptr;
}
gROOT->GetListOfGeometries()->Remove(this);
}
Expand Down Expand Up @@ -403,12 +420,12 @@ TShape *TGeometry::GetShapeByNumber(Int_t number) const
/// This is automatically done by the Paint functions.
/// Otherwise TNode::UpdateMatrix should be called before.

void TGeometry::Local2Master(Double_t *local, Double_t *master)
void TGeometry::Local2Master(Double_t const *local, Double_t *master) const
{
if (GeomLevel()) {
Double_t x,y,z;
Double_t bomb = GetBomb();
Double_t *matrix = &fRotMatrix[GeomLevel()][0];
Double_t const *matrix = &fRotMatrix[GeomLevel()][0];
x = bomb*fX
+ local[0]*matrix[0]
+ local[1]*matrix[3]
Expand Down Expand Up @@ -437,13 +454,13 @@ void TGeometry::Local2Master(Double_t *local, Double_t *master)
/// This is automatically done by the Paint functions.
/// Otherwise TNode::UpdateMatrix should be called before.

void TGeometry::Local2Master(Float_t *local, Float_t *master)
void TGeometry::Local2Master(Float_t const *local, Float_t *master) const
{
if (GeomLevel()) {
Float_t x,y,z;
Float_t bomb = GetBomb();

Double_t *matrix = &fRotMatrix[GeomLevel()][0];
Double_t const *matrix = &fRotMatrix[GeomLevel()][0];

x = bomb*fX
+ local[0]*matrix[0]
Expand Down Expand Up @@ -499,12 +516,12 @@ void TGeometry::ls(Option_t *option) const
/// This is automatically done by the Paint functions.
/// Otherwise TNode::UpdateMatrix should be called before.

void TGeometry::Master2Local(Double_t *master, Double_t *local)
void TGeometry::Master2Local(Double_t const *master, Double_t *local) const
{
if (GeomLevel()) {
Double_t x,y,z;
Double_t bomb = GetBomb();
Double_t *matrix = &fRotMatrix[GeomLevel()][0];
Double_t const *matrix = &fRotMatrix[GeomLevel()][0];

Double_t xms = master[0] - bomb*fX;
Double_t yms = master[1] - bomb*fY;
Expand All @@ -528,13 +545,13 @@ void TGeometry::Master2Local(Double_t *master, Double_t *local)
/// This is automatically done by the Paint functions.
/// Otherwise TNode::UpdateMatrix should be called before.

void TGeometry::Master2Local(Float_t *master, Float_t *local)
void TGeometry::Master2Local(Float_t const *master, Float_t *local) const
{
if (GeomLevel()) {
Float_t x,y,z;
Float_t bomb = GetBomb();

Double_t *matrix = &fRotMatrix[GeomLevel()][0];
Double_t const *matrix = &fRotMatrix[GeomLevel()][0];

Double_t xms = master[0] - bomb*fX;
Double_t yms = master[1] - bomb*fY;
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#include "TBuffer3D.h"
#include "TBuffer3DTypes.h"
#include "TGeometry.h"

#include "X3DBuffer.h"

/** \class TPCON
\ingroup g3d
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#include "TBuffer3DTypes.h"
#include "TGeometry.h"
#include "TMath.h"

#include "X3DBuffer.h"

/** \class TSPHE
\ingroup g3d
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#include "TBuffer3DTypes.h"
#include "TGeometry.h"
#include "TMath.h"

#include "X3DBuffer.h"

/** \class TTUBE
\ingroup g3d
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#include "TBuffer3DTypes.h"
#include "TGeometry.h"
#include "TMath.h"

#include "X3DBuffer.h"

/** \class TTUBS
\ingroup g3d
Expand Down
Loading
Loading