52 std::unique_ptr<RootCsg::TBaseMesh> res;
60 for (
UInt_t i = 0; i < b3d->NbPnts(); ++i) {
68 res.reset(RootCsg::ConvertToMesh(*b3d.get()));
73 if (matr) { mleft = *matr; mright = *matr; }
75 mleft.
Multiply(node->GetLeftMatrix());
76 auto left =
MakeGeoMesh(&mleft, node->GetLeftShape());
78 mright.
Multiply(node->GetRightMatrix());
79 auto right =
MakeGeoMesh(&mright, node->GetRightShape());
81 if (node->IsA() ==
TGeoUnion::Class()) res.reset(RootCsg::BuildUnion(left.get(), right.get()));
105 Int_t nv = mesh->NumberOfVertices();
108 for (
Int_t i = 0; i < nv; ++i) {
109 auto v = mesh->GetVertex(i);
113 fNbPols = mesh->NumberOfPolys();
117 for (
Int_t i = 0; i <
fNbPols; ++i) descSize += mesh->SizeOfPoly(i) + 1;
121 for (
Int_t polyIndex = 0; polyIndex <
fNbPols; ++polyIndex) {
122 Int_t polySize = mesh->SizeOfPoly(polyIndex);
126 for (
Int_t i = 0; i < polySize; ++i)
127 fPolyDesc.push_back(mesh->GetVertexIndex(polyIndex, i));
154 std::cout <<
"Shape " << shape->
GetName() <<
" has empty TBuffer3D\n";
208 descSize += pols[j] + 1;
214 for (
Int_t numPol = 0, currInd = 0, j = 1; numPol <
fNbPols; ++numPol)
216 Int_t segmentInd = pols[j] + j;
217 Int_t segmentCol = pols[j];
220 Int_t s2 = pols[segmentInd];
223 segs[s2 * 3 + 1],
segs[s2 * 3 + 2]};
226 if (segEnds[0] == segEnds[2]) {
227 numPnts[0] = segEnds[1]; numPnts[1] = segEnds[0]; numPnts[2] = segEnds[3];
228 }
else if (segEnds[0] == segEnds[3]) {
229 numPnts[0] = segEnds[1]; numPnts[1] = segEnds[0]; numPnts[2] = segEnds[2];
230 }
else if (segEnds[1] == segEnds[2]) {
231 numPnts[0] = segEnds[0]; numPnts[1] = segEnds[1]; numPnts[2] = segEnds[3];
233 numPnts[0] = segEnds[0]; numPnts[1] = segEnds[1]; numPnts[2] = segEnds[2];
237 Int_t sizeInd = currInd++;
241 Int_t lastAdded = numPnts[2];
244 for (; segmentInd != end; segmentInd--) {
245 segEnds[0] =
segs[pols[segmentInd] * 3 + 1];
246 segEnds[1] =
segs[pols[segmentInd] * 3 + 2];
247 if (segEnds[0] == lastAdded) {
249 lastAdded = segEnds[1];
252 lastAdded = segEnds[0];
297 pnts + norm[2] * 3, &
fNormals[i * 3]);
308 pnts + norm[2] * 3, &
fNormals[i * 3]);
333 }
else if (
Eq(p1, p3)) {
358 return (dx < 1
e-10) && (dy < 1
e-10) && (dz < 1
e-10);
369 b.ClearSectionsValid();
385 std::map<Edge_t, Int_t> edges;
391 for (
Int_t j = 0; j < nv; ++j) {
392 Edge_t e(pd[j], (j != nv - 1) ? pd[j + 1] : pd[0]);
393 if (edges.find(
e) == edges.end()) {
394 edges.insert(std::make_pair(
e, 0));
405 Int_t si = 0, scnt = 0;
406 for (
auto &edge : edges) {
408 b.fSegs[si++] = edge.first.fI;
409 b.fSegs[si++] = edge.first.fJ;
410 edge.second = scnt++;
420 for (
Int_t j = 0; j < nv; ++j) {
421 b.fPols[pi++] = edges[
Edge_t(pd[j], (j != nv - 1) ? pd[j + 1] : pd[0])];
std::unique_ptr< RootCsg::TBaseMesh > MakeGeoMesh(TGeoMatrix *matr, TGeoShape *shape)
Function produces mesh for provided shape, applying matrix to the result.
int Int_t
Signed integer 4 bytes (int).
unsigned int UInt_t
Unsigned integer 4 bytes (unsigned int).
bool Bool_t
Boolean (0=false, 1=true) (bool).
double Double_t
Double 8 bytes.
std::vector< UInt_t > & RefPolyDesc()
void ProcessData(const std::vector< Double_t > &verts, const std::vector< UInt_t > &polys, const Int_t n_polys)
ProcessData.
REveGeoManagerHolder Exception-safe global variable holders.
void FillRenderData(REveRenderData &rd)
static Bool_t fgAutoCalculateNormals
static void SetAutoEnforceTriangles(Bool_t f)
const TBuffer3D & GetBuffer3D(Int_t reqSections, Bool_t localFrame) const override
Fill static buffer 3D.
std::vector< UInt_t > fPolyDesc
static void SetAutoCalculateNormals(Bool_t f)
void EnforceTriangles()
Use GLU tesselator to replace all polygons with N > 3 with triangles.
void BuildFromShape(TGeoShape *shape, Int_t n_seg=60)
Produce all polygons from normal shape.
void BuildFromComposite(TGeoCompositeShape *cshp, Int_t n_seg=60)
Produce all polygons from composite shape.
std::vector< Double_t > fNormals
REveGeoPolyShape(const REveGeoPolyShape &)=delete
void FillBuffer3D(TBuffer3D &buffer, Int_t reqSections, Bool_t localFrame) const override
Fill the passed buffer 3D.
std::vector< Double_t > fVertices
static Bool_t GetAutoCalculateNormals()
void CalculateNormals()
CalculateNormals per polygon (flat shading).
static Bool_t GetAutoEnforceTriangles()
static Bool_t fgAutoEnforceTriangles
TBuffer3D * MakeBuffer3D() const override
Create buffer 3D and fill it with point/segment/poly data.
Int_t CheckPoints(const UInt_t *source, UInt_t *dest) const
CheckPoints.
void SetFromBuff3D(const TBuffer3D &buffer)
Set data-members from a Csg mesh.
static Bool_t Eq(const Double_t *p1, const Double_t *p2)
Test equality of points with epsilon 1e-10.
static TGeoManager * GetGeoManager()
Return static geo-manager that is used internally to make shapes lead a happy life.
void Reserve(int size_vert=0, int size_norm=0, int size_idx=0)
Reserve place for render data.
Generic 3D primitive description class.
virtual const Double_t * GetOrigin() const
TGeoBBox(const TGeoBBox &)=delete
virtual Double_t GetDX() const
virtual Double_t GetDZ() const
virtual Double_t GetDY() const
Composite shapes are Boolean combinations of two or more shape components.
TGeoBoolNode * GetBoolNode() const
Matrix class used for computing global transformations Should NOT be used for node definition.
void Multiply(const TGeoMatrix *right)
multiply to the right with an other transformation if right is identity matrix, just return
Geometrical transformation package.
virtual void LocalToMaster(const Double_t *local, Double_t *master) const
convert a point by multiplying its column vector (x, y, z, 1) to matrix inverse
Base abstract class for all shapes.
TGeoShape()
Default constructor.
const char * GetName() const override
Get the shape name.
virtual TBuffer3D * MakeBuffer3D() const
void box(Int_t pat, Double_t x1, Double_t y1, Double_t x2, Double_t y2)
Namespace for ROOT features in testing.
T * Normal2Plane(const T v1[3], const T v2[3], const T v3[3], T normal[3])
Calculates a normal vector of a plane.
Short_t Abs(Short_t d)
Returns the absolute value of parameter Short_t d.