ATLAS Offline Software
Loading...
Searching...
No Matches
VP1Lines::Imp Class Reference
Collaboration diagram for VP1Lines::Imp:

Public Member Functions

 Imp (VP1Lines *, SoSeparator *attachsep)
void rebuild3DObjects ()
void updateColour ()

Public Attributes

VP1Linestheclass
SoSeparator * attachSep
bool shown
SbColor4f colourAndTransp
SbVec3f direction
SoSeparator * sep

Detailed Description

Definition at line 18 of file VP1Lines.cxx.

Constructor & Destructor Documentation

◆ Imp()

VP1Lines::Imp::Imp ( VP1Lines * tc,
SoSeparator * attachsep )

Definition at line 53 of file VP1Lines.cxx.

54 : theclass(tc), attachSep(as), shown(false),
55 // lines are white by default
56 colourAndTransp(SbColor4f(1,1,1,1)),
57 // this is if you want them black
58 // colourAndTransp(SbColor4f(0,0,0,1)),
59 direction(SbVec3f(0,0,0)),
60 sep(0)
61{
62 attachSep->ref();
63}
static Double_t tc
SbVec3f direction
Definition VP1Lines.cxx:27
VP1Lines * theclass
Definition VP1Lines.cxx:22
SoSeparator * sep
Definition VP1Lines.cxx:29
SoSeparator * attachSep
Definition VP1Lines.cxx:23
SbColor4f colourAndTransp
Definition VP1Lines.cxx:26

Member Function Documentation

◆ rebuild3DObjects()

void VP1Lines::Imp::rebuild3DObjects ( )

Definition at line 66 of file VP1Lines.cxx.

67{
68 theclass->messageVerbose("(Re)building 3D objects");
69
70 if (sep) {
71 sep->removeAllChildren();
72 } else {
73 sep = new SoSeparator;
74 sep->ref();
75 }
76
77 const bool save = sep->enableNotify(false);
78
79 SoVertexProperty * line_vertices = new SoVertexProperty();
80
81 line_vertices->vertex.set1Value(0,0.0,0.0,0.0);
82 line_vertices->vertex.set1Value(1,direction[0],direction[1],direction[2]);
83
84 line_vertices->materialBinding=SoMaterialBinding::OVERALL;
85 line_vertices->normalBinding=SoNormalBinding::OVERALL;
86 SoLineSet * line = new SoLineSet();
87 line->numVertices.enableNotify(FALSE);
88 // line->numVertices.setNum(1);
89 // line->numVertices.set1Value(0,2);
90 line->vertexProperty = line_vertices;
91 line->numVertices.enableNotify(TRUE);
92 line->numVertices.touch();
93
94 // This is here if you want to
95 // convert lines into cylinders
96 constexpr bool convert = false;
97 if (convert) {
98 SbVec3f p1 = line_vertices->vertex[0].getValue();
99 SbVec3f p2 = line_vertices->vertex[1].getValue();
100 SoCylinder * cylinder = new SoCylinder;
101 cylinder->radius = 4.0;
102 float height = std::sqrt( direction[0]*direction[0]+
103 direction[1]*direction[1]+
104 direction[2]*direction[2]);
105 cylinder->height = height;
106
107 SbMatrix m;
108 m.setTranslate(SbVec3f(0,0.5*height,0));
109 SbVec3f v(p2); v -= p1;
110 SbRotation rotation(SbVec3f(0,1,0),v);
111 SbMatrix m2; m2.setRotate(rotation);
112 m.multRight(m2);
113 SbMatrix m3;
114 m3.setTranslate(p1);
115 m.multRight(m3);
116 SbMatrix mat;
117 mat = m;
118 SoMatrixTransform * mt = new SoMatrixTransform;
119 mt->matrix.setValue(mat);
120 sep->addChild(mt);
121 sep->addChild(cylinder);
122 } else sep->addChild(line);
123
124 updateColour();
125
126 if (save) {
127 sep->enableNotify(true);
128 sep->touch();
129 }
130
131}
void updateColour()
Definition VP1Lines.cxx:134
std::unique_ptr< MVAUtils::BDT > convert(TMVA::MethodBDT *bdt, bool isRegression=true, bool useYesNoLeaf=false)

◆ updateColour()

void VP1Lines::Imp::updateColour ( )

Definition at line 134 of file VP1Lines.cxx.

135{
136 theclass->messageVerbose("Updating packed colour");
137 if (!sep||sep->getNumChildren()<1)
138 return;
139 SoNode * n = sep->getChild(0);
140 if (!n||n->getTypeId()!=SoLineSet::getClassTypeId())
141 return;
142 SoLineSet * line = static_cast<SoLineSet*>(n);
143 SoVertexProperty * vertices = static_cast<SoVertexProperty *>(line->vertexProperty.getValue());
144 if (!vertices)
145 return;
146 vertices->orderedRGBA = colourAndTransp.getPackedValue();
147}

Member Data Documentation

◆ attachSep

SoSeparator* VP1Lines::Imp::attachSep

Definition at line 23 of file VP1Lines.cxx.

◆ colourAndTransp

SbColor4f VP1Lines::Imp::colourAndTransp

Definition at line 26 of file VP1Lines.cxx.

◆ direction

SbVec3f VP1Lines::Imp::direction

Definition at line 27 of file VP1Lines.cxx.

◆ sep

SoSeparator* VP1Lines::Imp::sep

Definition at line 29 of file VP1Lines.cxx.

◆ shown

bool VP1Lines::Imp::shown

Definition at line 25 of file VP1Lines.cxx.

◆ theclass

VP1Lines* VP1Lines::Imp::theclass

Definition at line 22 of file VP1Lines.cxx.


The documentation for this class was generated from the following file: