Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
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
20class TBuffer3D;
21
22namespace ROOT {
23namespace Experimental {
24
25// =========================================================================
26// REvePolygonSetProjected
27// Set of projected polygons with outline; typically produced from a TBuffer3D.
28// =========================================================================
29
31 public REveProjected
32{
33private:
36
37protected:
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
56private:
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
66protected:
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
77public:
78 REvePolygonSetProjected(const std::string &n = "REvePolygonSetProjected", const std::string &t = "");
80
81 void ComputeBBox() override;
82 // TClass* ProjectedClass() same as for REveShape
83
84 void SetProjection(REveProjectionManager *mng, REveProjectable *model) override;
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
#define d(i)
Definition RSha256.hxx:102
#define s0(x)
Definition RSha256.hxx:90
#define s1(x)
Definition RSha256.hxx:91
float Float_t
Definition RtypesCore.h:57
winID h TVirtualViewer3D TVirtualGLPainter p
void SetProjection(REveProjectionManager *mng, REveProjectable *model) override
This is virtual method from base-class REveProjected.
virtual void DumpPolys() const
Dump information about built polygons.
Bool_t IsFirstIdxHead(Int_t s0, Int_t s1)
Compare the two segments and check if the first index of first segment is starting.
vpPolygon_t fPolsBS
! polygons build from TBuffer3D segments
void BuildRenderData() override
Crates representation for rendering.
void DumpBuffer3D()
Dump information about currently projected buffer.
void UpdateProjection() override
This is virtual method from base-class REveProjected.
vpPolygon_t fPolsBP
! polygons build from TBuffer3D polygons
std::vector< UInt_t > ProjectAndReducePoints()
Project and reduce buffer points.
std::vector< REveVector > fPnts
! reduced and projected points
REveElement * GetProjectedAsElement() override
Returns this projected dynamic-casted to REveElement.
Float_t PolygonSurfaceXY(const Polygon_t &poly) const
Calculate XY surface of a polygon.
void ComputeBBox() override
Override of virtual method from TAttBBox.
REvePolygonSetProjected & operator=(const REvePolygonSetProjected &)=delete
Float_t MakePolygonsFromBS(std::vector< UInt_t > &idxMap)
Build polygons from the set of buffer segments.
Int_t WriteCoreJson(nlohmann::json &j, Int_t rnr_offset) override
Fill core part of JSON representation.
void SetDepthLocal(Float_t d) override
Set depth (z-coordinate) of the projected points.
Float_t MakePolygonsFromBP(std::vector< UInt_t > &idxMap)
Build polygons from list of buffer polygons.
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...
REvePolygonSetProjected(const REvePolygonSetProjected &)=delete
REveProjectionManager Manager class for steering of projections and managing projected objects.
Generic 3D primitive description class.
Definition TBuffer3D.h:18
const Int_t n
Definition legend1.C:16
This file contains a specialised ROOT message handler to test for diagnostic in unit tests.
basic_json<> json