|
G4OCCT 0.1.0
Geant4 interface to Open CASCADE Technology (OCCT) geometry definitions
|
Shared OCCT-backed query kernel used by adapter frontends. More...
#include <G4OCCTSolidKernel.hh>
Classes | |
| struct | AxisAlignedBounds |
| Axis-aligned bounds in the imported OCCT coordinate system. More... | |
| struct | ClassifierCache |
| struct | InscribedSphere |
| Cached inscribed sphere used to accelerate deep-interior classifications. More... | |
| struct | IntersectorCache |
| struct | SphereCacheData |
| struct | SurfaceSamplingCache |
| struct | SurfaceTriangle |
| Tessellated triangle entry used for random surface-point sampling. More... | |
Public Types | |
| enum class | PointClassification { kInside , kSurface , kOutside } |
| Classification result for point-in-solid queries. More... | |
Public Member Functions | |
| G4OCCTSolidKernel (const TopoDS_Shape &shape) | |
| void | SetShape (const TopoDS_Shape &shape) |
| const TopoDS_Shape & | Shape () const |
| Read-only access to the currently wrapped OCCT shape. | |
| std::uint64_t | ShapeGeneration () const |
Monotonic generation counter incremented after successful SetShape(). | |
| const AxisAlignedBounds & | Bounds () const |
| Return the cached axis-aligned bounds for the current shape. | |
| PointClassification | ClassifyPoint (const G4ThreeVector &p, ClassifierCache &classifierCache, IntersectorCache &intersectorCache, SphereCacheData &sphereCache) const |
| Classify a point as inside, on, or outside the solid. | |
| G4ThreeVector | SurfaceNormal (const G4ThreeVector &p) const |
Return the outward surface normal at the face nearest point p. | |
| G4double | DistanceToIn (const G4ThreeVector &p, const G4ThreeVector &v, IntersectorCache &intersectorCache) const |
| Exact ray distance from an exterior point to the first entry intersection. | |
| G4double | DistanceToIn (const G4ThreeVector &p, ClassifierCache &classifierCache) const |
| Conservative lower bound on the shortest exterior distance to the solid. | |
| G4double | DistanceToOut (const G4ThreeVector &p, const G4ThreeVector &v, IntersectorCache &intersectorCache, const G4bool calcNorm=false, G4bool *validNorm=nullptr, G4ThreeVector *n=nullptr) const |
| Exact ray distance from an interior point to the first exit intersection. | |
| G4double | DistanceToOut (const G4ThreeVector &p, SphereCacheData &sphereCache) const |
| Conservative lower bound on the shortest interior distance to the surface. | |
| G4double | ExactDistanceToIn (const G4ThreeVector &p, ClassifierCache &classifierCache) const |
| Exact shortest distance from an exterior point to the surface. | |
| G4double | ExactDistanceToOut (const G4ThreeVector &p) const |
| Exact shortest distance from a point to the surface. | |
| G4double | GetCubicVolume () |
| Compute and cache the solid volume for the current shape generation. | |
| G4double | GetSurfaceArea () |
| Compute and cache the solid surface area for the current shape generation. | |
| G4ThreeVector | GetPointOnSurface (const char *diagnosticName=nullptr) const |
| const SurfaceSamplingCache & | GetOrBuildSurfaceCache () const |
| Build or return the shared surface-sampling cache for the current shape. | |
Static Public Member Functions | |
| static G4double | Infinity () |
| Return the Geant4 navigation infinity sentinel used by the kernel. | |
Static Public Attributes | |
| static constexpr std::size_t | kMaxInscribedSpheres = 64 |
| Maximum number of inscribed spheres retained in a per-thread sphere cache. | |
Shared OCCT-backed query kernel used by adapter frontends.
G4OCCTSolidKernel owns the shape-dependent state that is common to all frontends over the OCCT solid-query implementation: cached bounds, per-face metadata, tessellation/BVH state, and generation-tagged caches for exact OCCT query helpers.
The kernel is intentionally Geant4-dependent today because it reuses G4ThreeVector, G4double, kInfinity, and the Geant4 tolerance/error model. It is nevertheless separated from G4OCCTSolid so that adapter responsibilities such as G4VSolid integration, worker-thread G4Cache ownership, and visualisation-specific polyhedron generation remain outside the core shape-query implementation.
Definition at line 56 of file G4OCCTSolidKernel.hh.
|
strong |
Classification result for point-in-solid queries.
| Enumerator | |
|---|---|
| kInside | |
| kSurface | |
| kOutside | |
Definition at line 62 of file G4OCCTSolidKernel.hh.
|
explicit |
Construct the kernel around an OCCT shape and eagerly derive shape-dependent metadata.
| std::invalid_argument | if shape is null or has no computable bounding box. |
Definition at line 365 of file G4OCCTSolidKernel.cc.
|
inline |
Return the cached axis-aligned bounds for the current shape.
Definition at line 155 of file G4OCCTSolidKernel.hh.
| G4OCCTSolidKernel::PointClassification g4occt::detail::G4OCCTSolidKernel::ClassifyPoint | ( | const G4ThreeVector & | p, |
| ClassifierCache & | classifierCache, | ||
| IntersectorCache & | intersectorCache, | ||
| SphereCacheData & | sphereCache | ||
| ) | const |
Classify a point as inside, on, or outside the solid.
Definition at line 697 of file G4OCCTSolidKernel.cc.
References classifier, g4occt::detail::G4OCCTSolidKernel::IntersectorCache::expandedBoxes, g4occt::detail::G4OCCTSolidKernel::IntersectorCache::faceIntersectors, kInside, kOutside, kSurface, g4occt::detail::G4OCCTSolidKernel::AxisAlignedBounds::max, g4occt::detail::G4OCCTSolidKernel::AxisAlignedBounds::min, and g4occt::detail::G4OCCTSolidKernel::SphereCacheData::spheres.
| G4double g4occt::detail::G4OCCTSolidKernel::DistanceToIn | ( | const G4ThreeVector & | p, |
| ClassifierCache & | classifierCache | ||
| ) | const |
Conservative lower bound on the shortest exterior distance to the solid.
Definition at line 1015 of file G4OCCTSolidKernel.cc.
References ExactDistanceToIn(), and Infinity().
| G4double g4occt::detail::G4OCCTSolidKernel::DistanceToIn | ( | const G4ThreeVector & | p, |
| const G4ThreeVector & | v, | ||
| IntersectorCache & | intersectorCache | ||
| ) | const |
Exact ray distance from an exterior point to the first entry intersection.
Definition at line 914 of file G4OCCTSolidKernel.cc.
References g4occt::detail::G4OCCTSolidKernel::IntersectorCache::expandedBoxes, g4occt::detail::G4OCCTSolidKernel::IntersectorCache::faceIntersectors, and Infinity().
| G4double g4occt::detail::G4OCCTSolidKernel::DistanceToOut | ( | const G4ThreeVector & | p, |
| const G4ThreeVector & | v, | ||
| IntersectorCache & | intersectorCache, | ||
| const G4bool | calcNorm = false, |
||
| G4bool * | validNorm = nullptr, |
||
| G4ThreeVector * | n = nullptr |
||
| ) | const |
Exact ray distance from an interior point to the first exit intersection.
Definition at line 1032 of file G4OCCTSolidKernel.cc.
References g4occt::detail::G4OCCTSolidKernel::IntersectorCache::expandedBoxes, g4occt::detail::G4OCCTSolidKernel::IntersectorCache::faceIntersectors, and Infinity().
| G4double g4occt::detail::G4OCCTSolidKernel::DistanceToOut | ( | const G4ThreeVector & | p, |
| SphereCacheData & | sphereCache | ||
| ) | const |
Conservative lower bound on the shortest interior distance to the surface.
Definition at line 1112 of file G4OCCTSolidKernel.cc.
References ExactDistanceToOut(), and Infinity().
| G4double g4occt::detail::G4OCCTSolidKernel::ExactDistanceToIn | ( | const G4ThreeVector & | p, |
| ClassifierCache & | classifierCache | ||
| ) | const |
Exact shortest distance from an exterior point to the surface.
Definition at line 948 of file G4OCCTSolidKernel.cc.
References classifier, and Infinity().
Referenced by DistanceToIn().
| G4double g4occt::detail::G4OCCTSolidKernel::ExactDistanceToOut | ( | const G4ThreeVector & | p | ) | const |
Exact shortest distance from a point to the surface.
Definition at line 1104 of file G4OCCTSolidKernel.cc.
Referenced by DistanceToOut().
| G4double g4occt::detail::G4OCCTSolidKernel::GetCubicVolume | ( | ) |
Compute and cache the solid volume for the current shape generation.
Definition at line 1132 of file G4OCCTSolidKernel.cc.
| const G4OCCTSolidKernel::SurfaceSamplingCache & g4occt::detail::G4OCCTSolidKernel::GetOrBuildSurfaceCache | ( | ) | const |
Build or return the shared surface-sampling cache for the current shape.
Definition at line 1152 of file G4OCCTSolidKernel.cc.
References g4occt::detail::G4OCCTSolidKernel::SurfaceSamplingCache::cumulativeAreas, g4occt::detail::G4OCCTSolidKernel::SurfaceSamplingCache::faces, g4occt::detail::kOCCTRelativeDeflection, g4occt::detail::G4OCCTSolidKernel::SurfaceSamplingCache::totalArea, and g4occt::detail::G4OCCTSolidKernel::SurfaceSamplingCache::triangles.
Referenced by GetPointOnSurface().
| G4ThreeVector g4occt::detail::G4OCCTSolidKernel::GetPointOnSurface | ( | const char * | diagnosticName = nullptr | ) | const |
Sample a point on the tessellated surface.
| diagnosticName | Optional caller-provided identifier used only in fatal diagnostic messages. |
Definition at line 1235 of file G4OCCTSolidKernel.cc.
References g4occt::detail::G4OCCTSolidKernel::SurfaceSamplingCache::cumulativeAreas, g4occt::detail::G4OCCTSolidKernel::SurfaceTriangle::faceIndex, g4occt::detail::G4OCCTSolidKernel::SurfaceSamplingCache::faces, GetOrBuildSurfaceCache(), g4occt::detail::G4OCCTSolidKernel::SurfaceTriangle::p1, g4occt::detail::G4OCCTSolidKernel::SurfaceTriangle::p2, g4occt::detail::G4OCCTSolidKernel::SurfaceTriangle::p3, g4occt::detail::G4OCCTSolidKernel::SurfaceSamplingCache::totalArea, and g4occt::detail::G4OCCTSolidKernel::SurfaceSamplingCache::triangles.
| G4double g4occt::detail::G4OCCTSolidKernel::GetSurfaceArea | ( | ) |
Compute and cache the solid surface area for the current shape generation.
Definition at line 1142 of file G4OCCTSolidKernel.cc.
|
inlinestatic |
Return the Geant4 navigation infinity sentinel used by the kernel.
Definition at line 59 of file G4OCCTSolidKernel.hh.
Referenced by DistanceToIn(), DistanceToIn(), DistanceToOut(), DistanceToOut(), ExactDistanceToIn(), g4occt::detail::TGeoOCCTSolidBridge::InfinityCm(), and SurfaceNormal().
| void g4occt::detail::G4OCCTSolidKernel::SetShape | ( | const TopoDS_Shape & | shape | ) |
Replace the current shape and invalidate all generation-tagged caches.
Existing per-thread cache objects become stale and will rebuild lazily on their next use.
| std::invalid_argument | if shape is null or has no computable bounding box. |
Definition at line 372 of file G4OCCTSolidKernel.cc.
|
inline |
Read-only access to the currently wrapped OCCT shape.
Definition at line 149 of file G4OCCTSolidKernel.hh.
|
inline |
Monotonic generation counter incremented after successful SetShape().
Definition at line 152 of file G4OCCTSolidKernel.hh.
| G4ThreeVector g4occt::detail::G4OCCTSolidKernel::SurfaceNormal | ( | const G4ThreeVector & | p | ) | const |
Return the outward surface normal at the face nearest point p.
Definition at line 848 of file G4OCCTSolidKernel.cc.
References Infinity().
|
staticconstexpr |
Maximum number of inscribed spheres retained in a per-thread sphere cache.
Definition at line 107 of file G4OCCTSolidKernel.hh.