G4OCCT 0.1.0
Geant4 interface to Open CASCADE Technology (OCCT) geometry definitions
Loading...
Searching...
No Matches
TGeoOCCTSolid.hh
Go to the documentation of this file.
1// SPDX-License-Identifier: LGPL-2.1-or-later
2// Copyright (C) 2026 G4OCCT Contributors
3
6
7#ifndef G4OCCT_TGeoOCCTSolid_hh
8#define G4OCCT_TGeoOCCTSolid_hh
9
10#ifndef G4OCCT_WITH_ROOT_TGEO_SUPPORT
11#error "G4OCCT/TGeoOCCTSolid.hh requires BUILD_ROOT_TGEO_SUPPORT=ON when G4OCCT is built."
12#endif
13
14#include <TGeoShape.h>
15
16#include <cstdint>
17#include <memory>
18#include <limits>
19#include <string>
20
21class TGeoBBox;
22class TGeoTessellated;
23class TopoDS_Shape;
24class TGeoMatrix;
25class TBuffer3D;
26class TGeoVolume;
27
28namespace g4occt::detail {
29class TGeoOCCTSolidBridge;
30}
31
43class TGeoOCCTSolid : public TGeoShape {
44public:
46 TGeoOCCTSolid(const char* name, const TopoDS_Shape& shape);
47 ~TGeoOCCTSolid() override;
48
49 TGeoOCCTSolid(const TGeoOCCTSolid&) = delete;
51
52 static TGeoOCCTSolid* FromSTEP(const char* name, const std::string& path);
53
54 Double_t Capacity() const override;
55 void ComputeBBox() override;
56 void ComputeNormal(const Double_t* point, const Double_t* dir, Double_t* norm) const override;
57 Bool_t Contains(const Double_t* point) const override;
58 Bool_t CouldBeCrossed(const Double_t* point, const Double_t* dir) const override;
59 Int_t DistancetoPrimitive(Int_t px, Int_t py) override;
60 Double_t DistFromInside(const Double_t* point, const Double_t* dir, Int_t iact = 1,
61 Double_t step = TGeoShape::Big(),
62 Double_t* safe = nullptr) const override;
63 Double_t DistFromOutside(const Double_t* point, const Double_t* dir, Int_t iact = 1,
64 Double_t step = TGeoShape::Big(),
65 Double_t* safe = nullptr) const override;
66 TGeoVolume* Divide(TGeoVolume* voldiv, const char* divname, Int_t iaxis, Int_t ndiv,
67 Double_t start, Double_t step) override;
68 const char* GetAxisName(Int_t iaxis) const override;
69 Double_t GetAxisRange(Int_t iaxis, Double_t& xlo, Double_t& xhi) const override;
70 void GetBoundingCylinder(Double_t* param) const override;
71 const TBuffer3D& GetBuffer3D(Int_t reqSections, Bool_t localFrame) const override;
72 Int_t GetByteCount() const override;
73 Bool_t GetPointsOnSegments(Int_t npoints, Double_t* array) const override;
74 Int_t GetFittingBox(const TGeoBBox* parambox, TGeoMatrix* mat, Double_t& dx, Double_t& dy,
75 Double_t& dz) const override;
76 void GetMeshNumbers(Int_t& nvert, Int_t& nsegs, Int_t& npols) const override;
77 TGeoShape* GetMakeRuntimeShape(TGeoShape* mother, TGeoMatrix* mat) const override;
78 Bool_t IsCylType() const override;
79 Bool_t IsValidBox() const override;
80 void InspectShape() const override;
81 TBuffer3D* MakeBuffer3D() const override;
82 Double_t Safety(const Double_t* point, Bool_t in = kTRUE) const override;
83 void SetDimensions(Double_t* param) override;
84 void SetPoints(Double_t* points) const override;
85 void SetPoints(Float_t* points) const override;
86 void SetSegsAndPols(TBuffer3D& buff) const override;
87 void Sizeof3D() const override;
88
89 const TopoDS_Shape& GetOCCTShape() const;
90 void SetOCCTShape(const TopoDS_Shape& shape);
91
92private:
93 TGeoBBox BuildBBoxHelper() const;
94 void EnsureDisplayHelper() const;
95
96 std::unique_ptr<g4occt::detail::TGeoOCCTSolidBridge> fBridge;
97 mutable std::unique_ptr<TGeoTessellated> fDisplayHelper;
98 mutable std::uint64_t fDisplayGeneration{std::numeric_limits<std::uint64_t>::max()};
99};
100
101#endif // G4OCCT_TGeoOCCTSolid_hh
ROOT/TGeo adapter backed by the shared G4OCCT solid-query kernel.
Double_t Safety(const Double_t *point, Bool_t in=kTRUE) const override
void ComputeNormal(const Double_t *point, const Double_t *dir, Double_t *norm) const override
void SetDimensions(Double_t *param) override
Int_t GetFittingBox(const TGeoBBox *parambox, TGeoMatrix *mat, Double_t &dx, Double_t &dy, Double_t &dz) const override
TGeoShape * GetMakeRuntimeShape(TGeoShape *mother, TGeoMatrix *mat) const override
void SetSegsAndPols(TBuffer3D &buff) const override
Bool_t CouldBeCrossed(const Double_t *point, const Double_t *dir) const override
const TopoDS_Shape & GetOCCTShape() const
Int_t DistancetoPrimitive(Int_t px, Int_t py) override
~TGeoOCCTSolid() override
TGeoOCCTSolid & operator=(const TGeoOCCTSolid &)=delete
Bool_t IsValidBox() const override
Int_t GetByteCount() const override
TGeoVolume * Divide(TGeoVolume *voldiv, const char *divname, Int_t iaxis, Int_t ndiv, Double_t start, Double_t step) override
const TBuffer3D & GetBuffer3D(Int_t reqSections, Bool_t localFrame) const override
Bool_t GetPointsOnSegments(Int_t npoints, Double_t *array) const override
void SetOCCTShape(const TopoDS_Shape &shape)
Double_t Capacity() const override
void ComputeBBox() override
TBuffer3D * MakeBuffer3D() const override
void InspectShape() const override
Double_t GetAxisRange(Int_t iaxis, Double_t &xlo, Double_t &xhi) const override
Bool_t IsCylType() const override
Bool_t Contains(const Double_t *point) const override
Double_t DistFromInside(const Double_t *point, const Double_t *dir, Int_t iact=1, Double_t step=TGeoShape::Big(), Double_t *safe=nullptr) const override
void SetPoints(Double_t *points) const override
static TGeoOCCTSolid * FromSTEP(const char *name, const std::string &path)
void GetBoundingCylinder(Double_t *param) const override
const char * GetAxisName(Int_t iaxis) const override
void Sizeof3D() const override
TGeoOCCTSolid(const TGeoOCCTSolid &)=delete
void GetMeshNumbers(Int_t &nvert, Int_t &nsegs, Int_t &npols) const override
Double_t DistFromOutside(const Double_t *point, const Double_t *dir, Int_t iact=1, Double_t step=TGeoShape::Big(), Double_t *safe=nullptr) const override