Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
REveGeoPolyShape.hxx
Go to the documentation of this file.
1// @(#)root/eve7:$Id$
2// Author: Matevz Tadel 2007, 2018
3
4/*************************************************************************
5 * Copyright (C) 1995-2019, Rene Brun and Fons Rademakers. *
6 * All rights reserved. *
7 * *
8 * For the licensing terms see $ROOTSYS/LICENSE. *
9 * For the list of contributors see $ROOTSYS/README/CREDITS. *
10 *************************************************************************/
11
12#ifndef ROOT7_REveGeoPolyShape
13#define ROOT7_REveGeoPolyShape
14
15#include "TGeoBBox.h"
16
17#include <vector>
18
19class TBuffer3D;
21class TGeoShape;
22
23namespace ROOT {
24namespace Experimental {
25
26class REveRenderData;
27
29{
30private:
33
34protected:
35 std::vector<Double_t> fVertices;
36 std::vector<Double_t> fNormals;
37 std::vector<UInt_t> fPolyDesc;
39
40 virtual void FillBuffer3D(TBuffer3D &buffer, Int_t reqSections, Bool_t localFrame) const;
41
42 void SetFromBuff3D(const TBuffer3D &buffer);
43
44 Int_t CheckPoints(const UInt_t *source, UInt_t *dest) const;
45
46 static Bool_t Eq(const Double_t *p1, const Double_t *p2);
47
48 struct Edge_t
49 {
52 {
53 if (i <= j) { fI = i; fJ = j; }
54 else { fI = j; fJ = i; }
55 }
56
57 bool operator<(const Edge_t& e) const
58 {
59 if (fI == e.fI) return fJ < e.fJ;
60 else return fI < e.fI;
61 }
62 };
63
66
67public:
68 REveGeoPolyShape() = default;
69
70 virtual ~REveGeoPolyShape() = default;
71
72 Int_t GetNumFaces() const { return fNbPols; }
73
75
76 void BuildFromComposite(TGeoCompositeShape *cshp, Int_t n_seg = 60);
77 void BuildFromShape(TGeoShape *shape, Int_t n_seg = 60);
78
79 void EnforceTriangles();
80 void CalculateNormals();
81
82 virtual const TBuffer3D& GetBuffer3D(Int_t reqSections, Bool_t localFrame) const;
83 virtual TBuffer3D *MakeBuffer3D() const;
84
85 static void SetAutoEnforceTriangles(Bool_t f);
87 static void SetAutoCalculateNormals(Bool_t f);
89
90 ClassDef(REveGeoPolyShape, 1); // A shape with arbitrary tesselation for visualization of CSG shapes.
91};
92
93}}
94
95#endif
#define f(i)
Definition RSha256.hxx:104
#define e(i)
Definition RSha256.hxx:103
bool Bool_t
Definition RtypesCore.h:63
static void SetAutoEnforceTriangles(Bool_t f)
virtual void FillBuffer3D(TBuffer3D &buffer, Int_t reqSections, Bool_t localFrame) const
Fill the passed buffer 3D.
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.
REveGeoPolyShape(const REveGeoPolyShape &)=delete
REveGeoPolyShape & operator=(const REveGeoPolyShape &)=delete
virtual TBuffer3D * MakeBuffer3D() const
Create buffer 3D and fill it with point/segment/poly data.
virtual const TBuffer3D & GetBuffer3D(Int_t reqSections, Bool_t localFrame) const
Fill static buffer 3D.
void CalculateNormals()
CalculateNormals per polygon (flat shading)
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.
Generic 3D primitive description class.
Definition TBuffer3D.h:18
Box class.
Definition TGeoBBox.h:18
Composite shapes are Boolean combinations of two or more shape components.
Base abstract class for all shapes.
Definition TGeoShape.h:26
This file contains a specialised ROOT message handler to test for diagnostic in unit tests.
#define dest(otri, vertexptr)
Definition triangle.c:1041