12#ifndef ALICEO2_BASE_O2TESSELLATED_
13#define ALICEO2_BASE_O2TESSELLATED_
17#include "TGeoVector3.h"
18#include "TGeoTypedefs.h"
19#include "TGeoTessellated.h"
36 bool fDefined =
false;
37 bool fClosedBody =
false;
40 std::vector<Vertex_t> fVertices;
41 std::vector<TGeoFacet> fFacets;
42 std::vector<Vertex_t> fOutwardNormals;
44 std::multimap<long, int> fVerticesMap;
45 bool fIsClosed =
false;
53 void CalculateNormals();
67 void CloseShape(
bool check =
true,
bool fixFlipped =
true,
bool verbose =
true);
71 bool AddFacet(
int i1,
int i2,
int i3);
72 bool AddFacet(
int i1,
int i2,
int i3,
int i4);
84 const TGeoFacet&
GetFacet(
int i)
const {
return fFacets[
i]; }
88 const TBuffer3D&
GetBuffer3D(
int reqSections, Bool_t localFrame)
const override;
89 void GetMeshNumbers(
int& nvert,
int& nsegs,
int& npols)
const override;
93 void Print(Option_t* option =
"")
const override;
95 void SetPoints(
double* points)
const override;
106 for (
auto facet : fFacets)
110 bool CheckClosure(
bool fixFlipped =
true,
bool verbose =
true);
116 Double_t
DistFromOutside(
const Double_t* point,
const Double_t* dir, Int_t iact = 1,
117 Double_t step = TGeoShape::Big(), Double_t* safe =
nullptr)
const override;
118 Double_t
DistFromInside(
const Double_t* point,
const Double_t* dir, Int_t iact = 1, Double_t step = TGeoShape::Big(),
119 Double_t* safe =
nullptr)
const override;
120 bool Contains(
const Double_t* point)
const override;
121 Double_t
Safety(
const Double_t* point, Bool_t in = kTRUE)
const override;
122 void ComputeNormal(
const Double_t* point,
const Double_t* dir, Double_t* norm)
const override;
133 template <
bool closest_facet = false>
134 Double_t SafetyKernel(
const Double_t* point,
bool in,
int* closest_facet_id =
nullptr)
const;
Tessellated::Vertex_t Vertex_t
const TGeoFacet & GetFacet(int i) const
void SetSegsAndPols(TBuffer3D &buff) const override
Fills TBuffer3D structure for segments and polygons.
~O2Tessellated() override
Double_t Safety(const Double_t *point, Bool_t in=kTRUE) const override
Safety.
bool Contains(const Double_t *point) const override
Contains.
int GetNmeshVertices() const override
void GetMeshNumbers(int &nvert, int &nsegs, int &npols) const override
Returns numbers of vertices, segments and polygons composing the shape mesh.
Double_t DistFromOutside_Loop(const Double_t *point, const Double_t *dir) const
trivial (non-BVH) DistFromOutside function
bool AddFacet(const Vertex_t &pt0, const Vertex_t &pt1, const Vertex_t &pt2)
Adding a triangular facet from vertex positions in absolute coordinates.
bool FacetCheck(int ifacet) const
Check validity of facet.
const TBuffer3D & GetBuffer3D(int reqSections, Bool_t localFrame) const override
Fills a static 3D buffer and returns a reference.
Double_t Capacity() const override
Capacity.
void Sizeof3D() const override
void ComputeBBox() override
Compute bounding box.
void InspectShape() const override
void CloseShape(bool check=true, bool fixFlipped=true, bool verbose=true)
Close the shape: calculate bounding box and compact vertices.
void FlipFacets()
Flip all facets.
int DistancetoPrimitive(int, int) override
static O2Tessellated * ImportFromObjFormat(const char *objfile, bool check=false, bool verbose=false)
Reader from .obj format.
Double_t DistFromInside_Loop(const Double_t *point, const Double_t *dir) const
trivial (non-BVH) DistFromInside function
bool CheckClosure(bool fixFlipped=true, bool verbose=true)
Check closure of the solid and check/fix flipped normals.
void ComputeNormal(const Double_t *point, const Double_t *dir, Double_t *norm) const override
ComputeNormal interface.
bool IsClosedBody() const
void Print(Option_t *option="") const override
Prints basic info.
const Vertex_t & GetVertex(int i) const
void ResizeCenter(double maxsize)
Resize and center the shape in a box of size maxsize.
TBuffer3D * MakeBuffer3D() const override
int AddVertex(const Vertex_t &vert)
Add a vertex checking for duplicates, returning the vertex index.
Vertex_t FacetComputeNormal(int ifacet, bool °enerated) const
Compute normal for a given facet.
bool Contains_Loop(const Double_t *point) const
trivial (non-BVH) Contains
Tessellated::Vertex_t Vertex_t
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
DistFromOutside.
void SetPoints(double *points) const override
Fill tessellated points to an array.
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
DistFromOutside.
void SavePrimitive(std::ostream &, Option_t *) override
GLuint const GLchar * name
void check(const std::vector< std::string > &arguments, const std::vector< ConfigParamSpec > &workflowOptions, const std::vector< DeviceSpec > &deviceSpecs, CheckMatrix &matrix)
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...