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
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<int> fPnts; // point indices
40
41 Polygon_t() = default;
42 Polygon_t(std::vector<int> &&pnts) : fPnts(pnts){};
43 ~Polygon_t() = default;
44
45 int NPoints() const { return (int)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<Int_t> &pp, std::list<Polygon_t> &p);
61
62 std::vector<Int_t> ProjectAndReducePoints();
63 Float_t MakePolygonsFromBP(std::vector<Int_t> &idxMap);
64 Float_t MakePolygonsFromBS(std::vector<Int_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
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
float Float_t
Definition: RtypesCore.h:53
void SetProjection(REveProjectionManager *mng, REveProjectable *model) override
This is virtual method from base-class REveProjected.
virtual void DumpPolys() const
Dump information about built polygons.
REvePolygonSetProjected & operator=(const REvePolygonSetProjected &)
Bool_t IsFirstIdxHead(Int_t s0, Int_t s1)
Compare the two segments and check if the first index of first segment is starting.
Float_t AddPolygon(std::list< Int_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...
vpPolygon_t fPolsBS
! polygons build from TBuffer3D segments
REvePolygonSetProjected(const REvePolygonSetProjected &)
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
Float_t MakePolygonsFromBS(std::vector< Int_t > &idxMap)
Build polygons from the set of buffer segments.
std::vector< REveVector > fPnts
! reduced and projected points
REveElement * GetProjectedAsElement() override
Returns this projected dynamic-casted to REveElement.
std::vector< Int_t > ProjectAndReducePoints()
Project and reduce buffer points.
Float_t PolygonSurfaceXY(const Polygon_t &poly) const
Calculate XY surface of a polygon.
void ComputeBBox() override
Override of virtual method from TAttBBox.
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< Int_t > &idxMap)
Build polygons from list of buffer polygons.
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
double dist(Rotation3D const &r1, Rotation3D const &r2)
Definition: 3DDistances.cxx:48
VSD Structures.
Definition: StringConv.hxx:21
static constexpr double pi