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 <TGeoBBox.h>
15
16#include <cstdint>
17#include <memory>
18#include <limits>
19#include <string>
20
21class TGeoTessellated;
22class TopoDS_Shape;
23class TGeoMatrix;
24class TBuffer3D;
25class TGeoVolume;
26
27namespace g4occt::detail {
28class TGeoOCCTSolidBridge;
29}
30
42class TGeoOCCTSolid : public TGeoBBox {
43public:
45 TGeoOCCTSolid(const char* name, const TopoDS_Shape& shape);
46 ~TGeoOCCTSolid() override;
47
48 TGeoOCCTSolid(const TGeoOCCTSolid&) = delete;
50
51 static TGeoOCCTSolid* FromSTEP(const char* name, const std::string& path);
52
53 Double_t Capacity() const override;
54 void ComputeBBox() override;
55 void ComputeNormal(const Double_t* point, const Double_t* dir, Double_t* norm) const override;
56 Bool_t Contains(const Double_t* point) const override;
57 Bool_t CouldBeCrossed(const Double_t* point, const Double_t* dir) const override;
58 Int_t DistancetoPrimitive(Int_t px, Int_t py) override;
59 Double_t DistFromInside(const Double_t* point, const Double_t* dir, Int_t iact = 1,
60 Double_t step = TGeoShape::Big(),
61 Double_t* safe = nullptr) const override;
62 Double_t DistFromOutside(const Double_t* point, const Double_t* dir, Int_t iact = 1,
63 Double_t step = TGeoShape::Big(),
64 Double_t* safe = nullptr) const override;
65 TGeoVolume* Divide(TGeoVolume* voldiv, const char* divname, Int_t iaxis, Int_t ndiv,
66 Double_t start, Double_t step) override;
67 const char* GetAxisName(Int_t iaxis) const override;
68 Double_t GetAxisRange(Int_t iaxis, Double_t& xlo, Double_t& xhi) const override;
69 void GetBoundingCylinder(Double_t* param) const override;
70 const TBuffer3D& GetBuffer3D(Int_t reqSections, Bool_t localFrame) const override;
71 Int_t GetByteCount() const override;
72 Bool_t GetPointsOnSegments(Int_t npoints, Double_t* array) const override;
73 Int_t GetFittingBox(const TGeoBBox* parambox, TGeoMatrix* mat, Double_t& dx, Double_t& dy,
74 Double_t& dz) const override;
75 void GetMeshNumbers(Int_t& nvert, Int_t& nsegs, Int_t& npols) const override;
76 TGeoShape* GetMakeRuntimeShape(TGeoShape* mother, TGeoMatrix* mat) const override;
77 Bool_t IsCylType() const override;
78 Bool_t IsValidBox() const override;
79 void InspectShape() const override;
80 TBuffer3D* MakeBuffer3D() const override;
81 Double_t Safety(const Double_t* point, Bool_t in = kTRUE) const override;
82 void SetDimensions(Double_t* param) override;
83 void SetPoints(Double_t* points) const override;
84 void SetPoints(Float_t* points) const override;
85 void SetSegsAndPols(TBuffer3D& buff) const override;
86 void Sizeof3D() const override;
87
88 const TopoDS_Shape& GetOCCTShape() const;
89 void SetOCCTShape(const TopoDS_Shape& shape);
90
91private:
92 void EnsureDisplayHelper() const;
93
94 std::unique_ptr<g4occt::detail::TGeoOCCTSolidBridge> fBridge;
95 mutable std::unique_ptr<TGeoTessellated> fDisplayHelper;
96 mutable std::uint64_t fDisplayGeneration{std::numeric_limits<std::uint64_t>::max()};
97};
98
99#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