Logo ROOT  
Reference Guide
REvePolygonSetProjected.hxx
Go to the documentation of this file.
1 // @(#)root/eve7:$Id$
2 // Authors: Matevz Tadel & Alja Mrak-Tadel: 2006, 2007
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_REvePolygonSetProjected
13 #define ROOT7_REvePolygonSetProjected
14 
15 #include <ROOT/REveVector.hxx>
16 #include <ROOT/REveShape.hxx>
17 
18 #include <vector>
19 
20 class TBuffer3D;
21 
22 namespace ROOT {
23 namespace Experimental {
24 
25 // =========================================================================
26 // REvePolygonSetProjected
27 // Set of projected polygons with outline; typically produced from a TBuffer3D.
28 // =========================================================================
29 
31  public REveProjected
32 {
33 private:
36 
37 protected:
38  struct Polygon_t {
39  std::vector<UInt_t> fPnts; // point indices
40 
41  Polygon_t() = default;
42  Polygon_t(std::vector<UInt_t> &&pnts) : fPnts(pnts){};
43  ~Polygon_t() = default;
44 
45  int NPoints() const { return (UInt_t)fPnts.size(); }
46 
47  int FindPoint(int pi)
48  {
49  auto dist = std::distance(fPnts.begin(), std::find(fPnts.begin(), fPnts.end(), pi));
50  return (dist >= (int) fPnts.size()) ? -1 : (int) dist;
51  }
52  };
53 
54  typedef std::list<Polygon_t> vpPolygon_t;
55 
56 private:
57  std::unique_ptr<TBuffer3D> fBuff; // buffer of projectable object
58 
60  Float_t AddPolygon(std::list<UInt_t> &pp, std::list<Polygon_t> &p);
61 
62  std::vector<UInt_t> ProjectAndReducePoints();
63  Float_t MakePolygonsFromBP(std::vector<UInt_t> &idxMap);
64  Float_t MakePolygonsFromBS(std::vector<UInt_t> &idxMap);
65 
66 protected:
67  vpPolygon_t fPols; ///<! polygons
68  vpPolygon_t fPolsBS; ///<! polygons build from TBuffer3D segments
69  vpPolygon_t fPolsBP; ///<! polygons build from TBuffer3D polygons
70 
71  std::vector<REveVector> fPnts; ///<! reduced and projected points
72 
73  void SetDepthLocal(Float_t d) override;
74 
75  Float_t PolygonSurfaceXY(const Polygon_t &poly) const;
76 
77 public:
78  REvePolygonSetProjected(const std::string &n = "REvePolygonSetProjected", const std::string &t = "");
79  virtual ~REvePolygonSetProjected();
80 
81  void ComputeBBox() override;
82  // TClass* ProjectedClass() same as for REveShape
83 
85  void UpdateProjection() override;
86  REveElement *GetProjectedAsElement() override { return this; }
87 
88  void ProjectBuffer3D();
89 
90  virtual void DumpPolys() const;
91  void DumpBuffer3D();
92 
93  Int_t WriteCoreJson(nlohmann::json &j, Int_t rnr_offset) override;
94  void BuildRenderData() override;
95 };
96 
97 } // namespace Experimental
98 } // namespace ROOT
99 
100 #endif
ROOT::Experimental::REvePolygonSetProjected::fPolsBS
vpPolygon_t fPolsBS
! polygons build from TBuffer3D segments
Definition: REvePolygonSetProjected.hxx:68
ROOT::Experimental::REveProjected
Definition: REveProjectionBases.hxx:81
n
const Int_t n
Definition: legend1.C:16
ROOT::Experimental::REvePolygonSetProjected::Polygon_t
Definition: REvePolygonSetProjected.hxx:38
ROOT::Experimental::REvePolygonSetProjected::Polygon_t::~Polygon_t
~Polygon_t()=default
ROOT::Experimental::REvePolygonSetProjected::IsFirstIdxHead
Bool_t IsFirstIdxHead(Int_t s0, Int_t s1)
Compare the two segments and check if the first index of first segment is starting.
Definition: REvePolygonSetProjected.cxx:203
ROOT::Experimental::REvePolygonSetProjected::ProjectBuffer3D
void ProjectBuffer3D()
Project current buffer.
Definition: REvePolygonSetProjected.cxx:466
ROOT::Experimental::REvePolygonSetProjected::AddPolygon
Float_t AddPolygon(std::list< UInt_t > &pp, std::list< Polygon_t > &p)
Check if polygon has dimensions above REveProjection::fgEps and add it to a list if it is not a dupli...
Definition: REvePolygonSetProjected.cxx:272
REveShape.hxx
ROOT::Experimental::REvePolygonSetProjected::Polygon_t::Polygon_t
Polygon_t()=default
ROOT::Experimental::REvePolygonSetProjected::ComputeBBox
void ComputeBBox() override
Override of virtual method from TAttBBox.
Definition: REvePolygonSetProjected.cxx:153
ROOT::Experimental::REvePolygonSetProjected::fPols
vpPolygon_t fPols
! polygons
Definition: REvePolygonSetProjected.hxx:67
ROOT::Experimental::REvePolygonSetProjected::Polygon_t::Polygon_t
Polygon_t(std::vector< UInt_t > &&pnts)
Definition: REvePolygonSetProjected.hxx:42
ROOT::Experimental::REvePolygonSetProjected::operator=
REvePolygonSetProjected & operator=(const REvePolygonSetProjected &)=delete
Float_t
float Float_t
Definition: RtypesCore.h:57
Int_t
int Int_t
Definition: RtypesCore.h:45
ROOT::Experimental::REvePolygonSetProjected::SetProjection
void SetProjection(REveProjectionManager *mng, REveProjectable *model) override
This is virtual method from base-class REveProjected.
Definition: REvePolygonSetProjected.cxx:167
ROOT::Experimental::REvePolygonSetProjected::GetProjectedAsElement
REveElement * GetProjectedAsElement() override
Returns this projected dynamic-casted to REveElement.
Definition: REvePolygonSetProjected.hxx:86
ROOT::Experimental::REvePolygonSetProjected::MakePolygonsFromBS
Float_t MakePolygonsFromBS(std::vector< UInt_t > &idxMap)
Build polygons from the set of buffer segments.
Definition: REvePolygonSetProjected.cxx:399
ROOT::Experimental::REveElement
Definition: REveElement.hxx:41
bool
ROOT::Experimental::REvePolygonSetProjected::MakePolygonsFromBP
Float_t MakePolygonsFromBP(std::vector< UInt_t > &idxMap)
Build polygons from list of buffer polygons.
Definition: REvePolygonSetProjected.cxx:341
ROOT::Experimental::REvePolygonSetProjected::UpdateProjection
void UpdateProjection() override
This is virtual method from base-class REveProjected.
Definition: REvePolygonSetProjected.cxx:191
ROOT::Experimental::REvePolygonSetProjected::Polygon_t::fPnts
std::vector< UInt_t > fPnts
Definition: REvePolygonSetProjected.hxx:39
ROOT::Math::gv_detail::dist
double dist(Rotation3D const &r1, Rotation3D const &r2)
Definition: 3DDistances.cxx:48
s0
#define s0(x)
Definition: RSha256.hxx:90
TBuffer3D
Generic 3D primitive description class.
Definition: TBuffer3D.h:18
ROOT::Experimental::REvePolygonSetProjected::ProjectAndReducePoints
std::vector< UInt_t > ProjectAndReducePoints()
Project and reduce buffer points.
Definition: REvePolygonSetProjected.cxx:214
ROOT::Experimental::REvePolygonSetProjected::~REvePolygonSetProjected
virtual ~REvePolygonSetProjected()
Destructor.
Definition: REvePolygonSetProjected.cxx:61
ROOT::Experimental::REvePolygonSetProjected
Definition: REvePolygonSetProjected.hxx:32
ROOT::Experimental::REveShape
Definition: REveShape.hxx:31
ROOT::Experimental::REvePolygonSetProjected::DumpPolys
virtual void DumpPolys() const
Dump information about built polygons.
Definition: REvePolygonSetProjected.cxx:521
s1
#define s1(x)
Definition: RSha256.hxx:91
ROOT::Experimental::REvePolygonSetProjected::fBuff
std::unique_ptr< TBuffer3D > fBuff
Definition: REvePolygonSetProjected.hxx:57
ROOT::Experimental::REveProjectable
Definition: REveProjectionBases.hxx:38
ROOT::Experimental::REvePolygonSetProjected::Polygon_t::FindPoint
int FindPoint(int pi)
Definition: REvePolygonSetProjected.hxx:47
ROOT::Experimental::REvePolygonSetProjected::vpPolygon_t
std::list< Polygon_t > vpPolygon_t
Definition: REvePolygonSetProjected.hxx:54
ROOT::Experimental::REvePolygonSetProjected::Polygon_t::NPoints
int NPoints() const
Definition: REvePolygonSetProjected.hxx:45
ROOT::Experimental::REvePolygonSetProjected::REvePolygonSetProjected
REvePolygonSetProjected(const REvePolygonSetProjected &)=delete
ROOT::Experimental::REvePolygonSetProjected::PolygonSurfaceXY
Float_t PolygonSurfaceXY(const Polygon_t &poly) const
Calculate XY surface of a polygon.
Definition: REvePolygonSetProjected.cxx:505
ROOT::Experimental::REvePolygonSetProjected::DumpBuffer3D
void DumpBuffer3D()
Dump information about currently projected buffer.
Definition: REvePolygonSetProjected.cxx:540
unsigned int
ROOT::Experimental::REvePolygonSetProjected::SetDepthLocal
void SetDepthLocal(Float_t d) override
Set depth (z-coordinate) of the projected points.
Definition: REvePolygonSetProjected.cxx:180
ROOT::Experimental::REvePolygonSetProjected::WriteCoreJson
Int_t WriteCoreJson(nlohmann::json &j, Int_t rnr_offset) override
Fill core part of JSON representation.
Definition: REvePolygonSetProjected.cxx:69
TGeant4Unit::pi
static constexpr double pi
Definition: TGeant4SystemOfUnits.h:67
ROOT::Experimental::REvePolygonSetProjected::fPolsBP
vpPolygon_t fPolsBP
! polygons build from TBuffer3D polygons
Definition: REvePolygonSetProjected.hxx:69
REveVector.hxx
d
#define d(i)
Definition: RSha256.hxx:102
make_cnn_model.model
model
Definition: make_cnn_model.py:6
ROOT::Experimental::REveProjectionManager
REveProjectionManager Manager class for steering of projections and managing projected objects.
Definition: REveProjectionManager.hxx:30
ROOT
VSD Structures.
Definition: StringConv.hxx:21
ROOT::Experimental::REvePolygonSetProjected::fPnts
std::vector< REveVector > fPnts
! reduced and projected points
Definition: REvePolygonSetProjected.hxx:71
ROOT::Experimental::REvePolygonSetProjected::BuildRenderData
void BuildRenderData() override
Crates representation for rendering.
Definition: REvePolygonSetProjected.cxx:86
int