Logo ROOT   6.08/07
Reference Guide
TPolyLineShape.cxx
Go to the documentation of this file.
1 // @(#)root/table:$Id$
2 // Author: Valeri Fine 1999
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2000, 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 #include "TPolyLineShape.h"
13 
14 #include "TPoints3D.h"
15 #include "TVolume.h"
16 #include "TVolumePosition.h"
17 #include "TTUBE.h"
18 #include "TBRIK.h"
19 #include "TSPHE.h"
20 #include "TView.h"
21 #include "TVirtualPad.h"
22 #include "TTablePadView3D.h"
23 #include "TPoint.h"
24 #include "TVirtualPS.h"
25 #include "TMath.h"
26 
27 //////////////////////////////////////////////////////////////////////////////////////
28 // //
29 // STAR 3D geometry Object Model //
30 // ============================= //
31 // //
32 // TDataSet Legend: //
33 // | "classA" //
34 // | | "classB" is derived from//
35 // v v the "classA" //
36 // TVolume "classB" //
37 // ^ //
38 // | "classQ" //
39 // | ^ "classQ" has a pointer //
40 // TShape | to "classT" //
41 // | "classT" //
42 // v //
43 // ----------------------------------------------------- //
44 // | | | | | //
45 // | | | . . . | | //
46 // | | | | | //
47 // V v v v v //
48 // TPolyLineShape TBRIK TTUBE TPCON TTRD1 //
49 // | ^ //
50 // | | <a href="http://root.cern.ch/root/html/TShape.html#TShape:description">R O O T S H A P E S</a> //
51 // V | (see <a href="https://cern-tex.web.cern.ch/cern-tex/geant_html3/node109.html#SECTION041000000000000000000000">GEANT 3.21 shapes</a> as well) //
52 // St_PolyLine3D | //
53 // | //
54 // TPoints3DABC //
55 // | //
56 // | //
57 // v //
58 // -------------------------------------------------------- //
59 // | | | | //
60 // | | | | //
61 // | | | | //
62 // V v v v //
63 //StHits3DPoints StHelix3DPoints TTable3Points TPoints3D //
64 // ^ ^ ^ ^ //
65 // | | | | //
66 // | | | | //
67 // StObjArray StTrack / StHelixD TTableSorter flat floating //
68 // ^ point array //
69 // | (see St_PolyLine3D as well) //
70 // | //
71 // TTable //
72 // //
73 // //
74 // S T A R S H A P E S //
75 // ------------------------------- //
76 // //
77 //////////////////////////////////////////////////////////////////////////////////////
78 
80 
81 ////////////////////////////////////////////////////////////////////////////////
82 ///to be documented
83 
85 {
86  fShape = 0;
87  fSmooth = kFALSE;
88  fConnection= 0;
89  fPoints=0;
90  SetWidthFactor();
91  fHasDrawn = kFALSE;
92  fShapeType = kNULL;
93  fSizeX3D = 0;
94  fPointFlag = kFALSE;
95  fLineFlag = kFALSE;
96 }
97 
98 ////////////////////////////////////////////////////////////////////////////////
99 /// fShape = new TTUBE("tube","tube","void",0.5,0.5);
100 
102 {
103  fShape = 0;
104  fShapeType = kNULL;
105  fSmooth = kFALSE;
106  fConnection = 0;
107  fPoints = points;
108  fHasDrawn = kFALSE;
109  fSizeX3D = 0;
110  // Take in account the current node if any
111  if (!fPoints) {
112  Error("TPolyLineShape","No polyline is defined");
113  return;
114  }
115  fPointFlag = strchr(option,'P')?kTRUE:kFALSE;
116  fLineFlag = strchr(option,'L')?kTRUE:kFALSE;
117 
118  SetWidthFactor();
119  Create();
120 }
121 
122 ////////////////////////////////////////////////////////////////////////////////
123 ///to be documented
124 
126 {
129 }
130 
131 ////////////////////////////////////////////////////////////////////////////////
132 ///to be documented
133 
135 {
137 }
138 
139 ////////////////////////////////////////////////////////////////////////////////
140 ///to be documented
141 
143 {
144  if (!fSizeX3D) fSizeX3D = new Size3D;
145  fSizeX3D->numPoints = 0;
146  fSizeX3D->numSegs = 0;
147  fSizeX3D->numPolys = 0; //NOTE: Because of different structure, our
148  if (fPoints) {
149  Int_t size = fPoints->Size();
150  if (marker) {
151  Int_t mode;
152  if (size > 10000) mode = 1; // One line marker '-'
153  else if (size > 3000) mode = 2; // Two lines marker '+'
154  else mode = 3; // Three lines marker '*'
155 
156  fSizeX3D->numSegs = size*mode;
157  fSizeX3D->numPoints = size*mode*2;
158  fSizeX3D->numPolys = 0;
159  } else {
160  fSizeX3D->numSegs = size-1;
161  fSizeX3D->numPoints = size;
162  }
163  fSizeX3D->numPolys = 0; //NOTE: Because of different structure, our
164  }
165  return fSizeX3D;
166 }
167 
168 ////////////////////////////////////////////////////////////////////////////////
169 ///to be documented
170 
172 {
173  Float_t size = 0.5*GetWidthFactor()*GetLineWidth();
174 
175  if (fShapeType != connection) {
177  fShapeType = connection;
178  switch (fShapeType) {
179  case kSphere:
180  SetConnection(new TSPHE("connection","sphere","void",0,size,0,90,0,360));
181  break;
182  default:
183  SetConnection(new TBRIK("connection","brik","void",size,size,size));
184  break;
185  };
186  }
187  return 0;
188 }
189 
190 ////////////////////////////////////////////////////////////////////////////////
191 ///*-*-*-*-*-*-*-*Compute distance from point px,py to a 3-D polyline*-*-*-*-*-*-*
192 ///*-* ===================================================
193 ///*-*
194 ///*-* Compute the closest distance of approach from point px,py to each segment
195 ///*-* of the polyline.
196 ///*-* Returns when the distance found is below DistanceMaximum.
197 ///*-* The distance is computed in pixels units.
198 ///*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
199 
201 {
202  if (fPoints) {
203  Int_t ret = fPoints->DistancetoPrimitive( px, py);
204  if (ret == -1) ret = PointDistancetoPrimitive(px, py);
205  return ret;
206  }
207  return 999999;
208 }
209 
210 ////////////////////////////////////////////////////////////////////////////////
211 ///*-*-*-*-*-*-*Compute distance from point px,py to a 3-D points *-*-*-*-*-*-*
212 ///*-* =====================================================
213 ///*-*
214 ///*-* Compute the closest distance of approach from point px,py to each segment
215 ///*-* of the polyline.
216 ///*-* Returns when the distance found is below DistanceMaximum.
217 ///*-* The distance is computed in pixels units.
218 ///*-*
219 ///*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
220 
222 {
223  const Int_t inaxis = 7;
224  Float_t dist = 999999;
225 
226  Int_t puxmin = gPad->XtoAbsPixel(gPad->GetUxmin());
227  Int_t puymin = gPad->YtoAbsPixel(gPad->GetUymin());
228  Int_t puxmax = gPad->XtoAbsPixel(gPad->GetUxmax());
229  Int_t puymax = gPad->YtoAbsPixel(gPad->GetUymax());
230 
231  TView *view = 0;
232 //*-*- return if point is not in the user area
233  if (px < puxmin - inaxis) goto END;
234  if (py > puymin + inaxis) goto END;
235  if (px > puxmax + inaxis) goto END;
236  if (py < puymax - inaxis) goto END;
237 
238  view = gPad->GetView();
239  if (view) {
240  Int_t i;
241  Float_t dpoint;
242  Float_t xndc[3];
243  Int_t x1,y1;
244  Int_t pointSize = fPoints->Size();
245  for (i=0;i<pointSize;i++) {
246  Float_t thisPoints[3];
247  view->WCtoNDC(fPoints->GetXYZ(thisPoints,i), xndc);
248  x1 = gPad->XtoAbsPixel(xndc[0]);
249  y1 = gPad->YtoAbsPixel(xndc[1]);
250  dpoint = (px-x1)*(px-x1) + (py-y1)*(py-y1);
251  if (dpoint < dist) dist = dpoint;
252  }
253  dist = (TMath::Sqrt(dist));
254  }
255 END:
256  return Int_t(dist);
257 }
258 
259 ////////////////////////////////////////////////////////////////////////////////
260 ///to be documented
261 
263 {
264  Create();
265  AppendPad();
266 }
267 
268 ////////////////////////////////////////////////////////////////////////////////
269 /// forward the ExecuteEvent call to the decorated object
270 
272 {
273  if (fPoints) fPoints->ExecuteEvent(event,px, py);
274 }
275 
276 ////////////////////////////////////////////////////////////////////////////////
277 ///to be documented
278 
280 {
281  return ((TPolyLineShape *)this)->GetLineColor();
282 }
283 ////////////////////////////////////////////////////////////////////////////////
284 /// forward the GetName call to the decorated object
285 
286 const char *TPolyLineShape::GetName() const
287 {
288  return fPoints ? fPoints->GetName() : TShape::GetName();
289 }
290 ////////////////////////////////////////////////////////////////////////////////
291 /// forward the GetObjectInfo call to the decorated object
292 
294 {
295  return fPoints ? fPoints->GetObjectInfo(px, py) : TShape::GetObjectInfo(px,py);
296 }
297 
298 ////////////////////////////////////////////////////////////////////////////////
299 ///to be documented
300 
302 {
303  return ((TPolyLineShape *)this)->GetMarkerSize();
304 }
305 
306 ////////////////////////////////////////////////////////////////////////////////
307 ///to be documented
308 
310 {
311  return ((TPolyLineShape *)this)->GetLineStyle();
312 }
313 
314 ////////////////////////////////////////////////////////////////////////////////
315 /// forward the GetObjectInfo call to the decorated object
316 
317 const char *TPolyLineShape::GetTitle() const
318 {
319  return fPoints ? fPoints->GetTitle() : TShape::GetTitle();
320 }
321 ////////////////////////////////////////////////////////////////////////////////
322 /// Double_t *start - coordinate of the start point of the current segment
323 /// Double_t *end - coordinate of the end point of the current segment
324 
326 {
327  // Calculate the vector
328  const Int_t kDimension = 3;
329  Double_t vector[kDimension];
330  Double_t nodeposition[kDimension];
331  Int_t i=0;
332  for (i=0;i<kDimension;i++) {
333  vector[i]=end[i]-start[i];
334  nodeposition[i]=0.5*(start[i]+end[i]);
335  }
336  Double_t length = TMath::Normalize(vector);
337 
338  // Calculate the rotation axis for Axis Oz
339 
340  Double_t oz[3]={0,0,1};
341  Double_t rotate[3];
342 
343  Double_t sina = TMath::Normalize(TMath::Cross(vector,oz,rotate));
344  Double_t cosa = Product(vector,oz);
345  Double_t mrot[3][3];
346 
347  TShape *shape = fShape;
348  if (!shape) shape = fConnection;
349 
350  Gyrot(rotate,cosa,sina,mrot);
351 
352  Float_t width = GetWidthFactor()*GetLineWidth();
353 
354  mrot[0][0] *= width;
355  mrot[0][1] *= width;
356  mrot[0][2] *= width;
357 
358  mrot[1][0] *= width;
359  mrot[1][1] *= width;
360  mrot[1][2] *= width;
361 
362  mrot[2][0] *= length;
363  mrot[2][1] *= length;
364  mrot[2][2] *= length;
365 
366  Color_t color = GetLineColor();
367 
368  TVolume node("SegmentNode","SegmentNode", shape);
369  node.SetLineColor(color);
370  if (!fShape) node.SetVisibility();
371  node.SetLineColor(color);
372 
373  TRotMatrix matrix ("rotate","rotate",&mrot[0][0]);
374  TVolumePosition position(&node,nodeposition[0],nodeposition[1]
375  ,nodeposition[2],&matrix);
376 
377  if (!(fSmooth || fConnection)) {
378  node.PaintNodePosition(option, &position);
379  return;
380  }
381 
382  // Add the connection
383 
384  memset(mrot,0,9*sizeof(Double_t));
385 
386  length = width/length;
387  mrot[2][2] = length;
388  mrot[0][0] = 1;
389  mrot[1][1] = 1;
390 
391  TRotMatrix kneeMatrix("knee","knee",&mrot[0][0]);
392  TVolume knee("ConnectionNode","ConnectionNode", fConnection);
393  TVolumePosition kneePosition(&knee, 0, 0, 0.5, &kneeMatrix);
394  knee.SetLineColor(color);
395  node.Add(&knee,&kneePosition);
396 
397  node.PaintNodePosition(option, &position);
398 }
399 
400 ////////////////////////////////////////////////////////////////////////////////
401 ///to be documented
402 
404 {
405  if (!GetPoints()) return;
406 
407  Bool_t rangeView = opt && opt[0] && strcmp(opt,"range")==0 ? kTRUE : kFALSE;
408  TTablePadView3D *view3D = 0;
409  if (!rangeView && (view3D = (TTablePadView3D*)gPad->GetView3D()) ) {
410  TString mode;
411 
412  mode="";
413  if (fLineFlag) mode = "L";
414  if (fPointFlag) mode += "P";
415 
417  view3D->PaintPoints3D(GetPoints(), mode.Data());
418  }
419  if (opt && !strstr(opt, "x3d")) {
420  if (fPointFlag) {
424  }
425  if (fLineFlag) {
429  }
430 
431  } else {
432  if (fLineFlag) {
434  } else {
436  }
437 // Paint3d(opt);
438  }
439 }
440 
441 ////////////////////////////////////////////////////////////////////////////////
442 ///*-*-*-*-*-*-*-*-*Draw this 3-D polyline with new coordinates*-*-*-*-*-*-*-*-*-*
443 ///*-* ===========================================
444 
446 {
447  if (n < 2) return;
448 
449  TAttLine::Modify(); //Change line attributes only if necessary
450 
451 //*-*- Loop on each individual line
452  for (Int_t i=1;i<n;i++) {
453  Float_t xyz[6];
454  fPoints->GetXYZ(&xyz[0],i-1,2);
455  gPad->PaintLine3D(xyz, &xyz[3]);
456  }
457 }
458 
459 ////////////////////////////////////////////////////////////////////////////////
460 ///*-*-*-*-*-*-*-*-*Paint polymarker in CurrentPad World coordinates*-*-*-*-*-*-*-*
461 ///*-* ================================================
462 
464 {
465  if (n <= 0) return;
466 
467  TView *view = gPad->GetView(); //Get current 3-D view
468  if(!view) return; //Check if `view` is valid
469 
470  //Create temporary storage
471  TPoint *pxy = new TPoint[n];
472  Float_t *x = new Float_t[n];
473  Float_t *y = new Float_t[n];
474  Float_t xndc[3], ptr[3];
475 
476 //*-*- convert points from world to pixel coordinates
477  Int_t nin = 0;
478  for (Int_t i = 0; i < n; i++) {
479  fPoints->GetXYZ(ptr,i);
480  view->WCtoNDC(ptr, xndc);
481  if (xndc[0] < gPad->GetX1() || xndc[0] > gPad->GetX2()) continue;
482  if (xndc[1] < gPad->GetY1() || xndc[1] > gPad->GetY2()) continue;
483  x[nin] = xndc[0];
484  y[nin] = xndc[1];
485  pxy[nin].fX = gPad->XtoPixel(x[nin]);
486  pxy[nin].fY = gPad->YtoPixel(y[nin]);
487  nin++;
488  }
489 
490  TAttMarker::Modify(); //Change marker attributes only if necessary
491 
492 //*-*- invoke the graphics subsystem
493  if (!gPad->IsBatch()) gVirtualX->DrawPolyMarker(nin, pxy);
494 
495 
496  if (gVirtualPS) {
497  gVirtualPS->DrawPolyMarker(nin, x, y);
498  }
499  delete [] x;
500  delete [] y;
501 
502  delete [] pxy;
503 }
504 
505 ////////////////////////////////////////////////////////////////////////////////
506 ///to be documented
507 
509 {
510  if (!fPoints) return;
511 
512  Create();
513 
514  struct XYZ { Float_t fValues[3]; } *points;
515  points = (XYZ *)(fPoints->GetP());
516  Int_t size = fPoints->GetN()-1;
517 
518  for (Int_t i=0;i<size;i++)
519  PaintNode((Float_t *)(points+i+1),(Float_t *)(points+i),opt);
520  fHasDrawn = kTRUE;
521 }
522 
523 ////////////////////////////////////////////////////////////////////////////////
524 ///to be documented
525 
527 {
528 #ifndef WIN32
529  Int_t size = 0;
530  if (fPoints) size = fPoints->Size();
531  if (!size) return;
532 
533  X3DBuffer *buff = new X3DBuffer;
534  if (!buff) return;
535 
536  fSizeX3D->numPoints = buff->numPoints = size;
537  fSizeX3D->numSegs = buff->numSegs = size-1;
538  fSizeX3D->numPolys = buff->numPolys = 0; //NOTE: Because of different structure, our
539 
540  buff->polys = 0; // TPolyLine3D can't use polygons
541  TPoints3D x3dPoints(size);
542  buff->points = fPoints->GetXYZ(x3dPoints.GetP(),0,size);
543 
544 // Int_t c = (((fAttributes?fAttributes->GetColorAttribute():0) % 8) - 1) * 4; // Basic colors: 0, 1, ... 8
545  Int_t c = ((GetColorAttribute() % 8) - 1) * 4; // Basic colors: 0, 1, ... 8
546  if (c < 0) c = 0;
547 
548  //*-* Allocate memory for segments *-*
549  buff->segs = new Int_t[buff->numSegs*3];
550  if (buff->segs) {
551  for (Int_t i = 0; i < buff->numSegs; i++) {
552  buff->segs[3*i ] = c;
553  buff->segs[3*i+1] = i;
554  buff->segs[3*i+2] = i+1;
555  }
556  }
557 
558 
559  if (buff && buff->points && buff->segs) //If everything seems to be OK ...
560  FillX3DBuffer(buff);
561  else { // ... something very bad was happened
562  gSize3D.numPoints -= buff->numPoints;
563  gSize3D.numSegs -= buff->numSegs;
564  gSize3D.numPolys -= buff->numPolys;
565  }
566 
567  if (buff->segs) delete [] buff->segs;
568  if (buff->polys) delete [] buff->polys;
569  if (buff) delete buff;
570 #endif
571 }
572 
573 ////////////////////////////////////////////////////////////////////////////////
574 ///to be documented
575 
577 {
578 #ifndef WIN32
579  Int_t size = 0;
580  if (fPoints) size = fPoints->Size();
581  if (!size) return;
582  Int_t mode;
583  Int_t i, j, k, n;
584 
585  X3DBuffer *buff = new X3DBuffer;
586  if(!buff) return;
587 
588  if (size > 10000) mode = 1; // One line marker '-'
589  else if (size > 3000) mode = 2; // Two lines marker '+'
590  else mode = 3; // Three lines marker '*'
591 
592  fSizeX3D->numSegs = buff->numSegs = size*mode;
593  fSizeX3D->numPoints = buff->numPoints = buff->numSegs*2;
594  fSizeX3D->numPolys = buff->numPolys = 0; //NOTE: Because of different structure, our
595 
596  buff->polys = 0; // TPolyMarker3D can't use polygons
597 
598 
599  //*-* Allocate memory for points *-*
600  Float_t delta = 0.002;
601 
602  buff->points = new Float_t[buff->numPoints*3];
603  if (buff->points) {
604  for (i = 0; i < size; i++) {
605  for (j = 0; j < mode; j++) {
606  for (k = 0; k < 2; k++) {
607  delta *= -1;
608  for (n = 0; n < 3; n++) {
609  Float_t xyz[3];
610  fPoints->GetXYZ(xyz,i);
611  buff->points[mode*6*i+6*j+3*k+n] =
612  xyz[n] * (1 + (j == n ? delta : 0));
613  }
614  }
615  }
616  }
617  }
618 
619  Int_t c = ((GetColorAttribute() % 8) - 1) * 4; // Basic colors: 0, 1, ... 8
620  if (c < 0) c = 0;
621 
622  //*-* Allocate memory for segments *-*
623  buff->segs = new Int_t[buff->numSegs*3];
624  if (buff->segs) {
625  for (i = 0; i < buff->numSegs; i++) {
626  buff->segs[3*i ] = c;
627  buff->segs[3*i+1] = 2*i;
628  buff->segs[3*i+2] = 2*i+1;
629  }
630  }
631 
632  if (buff->points && buff->segs) //If everything seems to be OK ...
633  FillX3DBuffer(buff);
634  else { // ... something very bad was happened
635  gSize3D.numPoints -= buff->numPoints;
636  gSize3D.numSegs -= buff->numSegs;
637  gSize3D.numPolys -= buff->numPolys;
638  }
639 
640  if (buff->points) delete [] buff->points;
641  if (buff->segs) delete [] buff->segs;
642  if (buff->polys) delete [] buff->polys;
643  if (buff) delete buff;
644 #endif
645 }
646 
647 ////////////////////////////////////////////////////////////////////////////////
648 ///to be documented
649 
651 {
652  Float_t p = 0;
653  if (v1 && v2 && ndim > 0)
654  for (Int_t i=0; i<ndim; i++) p+= v1[i]*v2[i];
655  return p;
656 }
657 
658 ////////////////////////////////////////////////////////////////////////////////
659 ///to be documented
660 
662 {
663  Double_t p = 0;
664  if (v1 && v2 && ndim > 0)
665  for (Int_t i=0;i<ndim;i++) p+= v1[i]*v2[i];
666  return p;
667 }
668 
669 ////////////////////////////////////////////////////////////////////////////////
670 ///************************************************************************
671 ///* *
672 ///* call gyrot(dirc,angp,trans,ntrans) vp 880722 *
673 ///* revised vp 921009 *
674 ///* revised (f->c++) vf 981006 *
675 ///* routine for filling rotation transformation matrix *
676 ///* from axis and rotation angle around *
677 ///* *
678 ///* arguments: *
679 ///* dirc direct cosinuses (may be not normalised) *
680 ///* cosang, sinang - cos and sin of the rotation angle *
681 ///* tranz rotation & shift matrix 3*3 (input/output) *
682 ///* --------------------------------------------------------------- *
683 ///* This code is provided by Victor Perevoztchikov *
684 ///************************************************************************
685 
686 Double_t *TPolyLineShape::Gyrot(Double_t *dirc, Double_t cosang, Double_t sinang, Double_t trans[3][3])
687 {
688  Double_t ax[3];
689 
690  memcpy(ax,dirc,3*sizeof(Double_t));
691  TMath::Normalize(ax);
692 
693  Double_t ca = cosang;
694  Double_t sa = sinang;
695  Double_t ca1;
696 
697  if (ca < 0.5)
698  ca1 = 1. - ca ;
699  else
700  ca1 = (sa*sa)/(1.+ca) ;
701 
702  Int_t j1 = 0;
703  Int_t j2 = 0;
704  for(j1 = 0; j1 < 3; j1++) {
705  for(j2 = 0; j2 < 3; j2++)
706  trans[j1][j2] = ca1*ax[j1]*ax[j2];
707  trans[j1][j1] += ca;
708  }
709 
710  trans[0][1] = trans[0][1] - sa*ax[2];
711  trans[1][0] = trans[1][0] + sa*ax[2];
712  trans[0][2] = trans[0][2] + sa*ax[1];
713  trans[2][0] = trans[2][0] - sa*ax[1];
714  trans[1][2] = trans[1][2] - sa*ax[0];
715  trans[2][1] = trans[2][1] + sa*ax[0];
716 
717  return (Double_t *)trans;
718 
719 }
720 
721 ////////////////////////////////////////////////////////////////////////////////
722 ///to be documented
723 
725 {
726  Color_t currentColor = GetColorAttribute();
727  if (color != currentColor) {
728  SetLineColor(color);
729  SetMarkerColor(color);
730  }
731  return currentColor;
732 }
733 
734 ////////////////////////////////////////////////////////////////////////////////
735 ///to be documented
736 
738 {
739  Size_t currentSize = GetSizeAttribute();
740  if (size != currentSize) {
741  SetLineWidth(Width_t(size));
742  SetMarkerSize(size);
743  }
744  return currentSize;
745 }
746 
747 ////////////////////////////////////////////////////////////////////////////////
748 /// SetStyleAttribute(Style_t style) - set new style for this line
749 /// Returns:
750 /// previous value of the line style
751 ///
752 
754 {
755  Style_t s = 0;
756  s = GetStyleAttribute();
757  SetLineStyle(style);
758  SetMarkerStyle(style);
759  return s;
760 }
761 
762 ////////////////////////////////////////////////////////////////////////////////
763 ///to be documented
764 
766 {
768  fShape = shape;
769 }
770 
771 ////////////////////////////////////////////////////////////////////////////////
772 ///to be documented
773 
775 {
776  return fPoints ? fPoints->Size():0;
777 }
778 
779 ////////////////////////////////////////////////////////////////////////////////
780 ///*-*-*-*-*-*-*Return total X3D size of this shape with its attributes*-*-*-*-*-*
781 ///*-* =======================================================
782 
784 {
786  if (fLineFlag )
787  line->CreateX3DSize(kFALSE);
788  else
789  line->CreateX3DSize(kTRUE);
790  if (fSizeX3D) {
791  gSize3D.numPoints += fSizeX3D->numPoints;
792  gSize3D.numSegs += fSizeX3D->numSegs;
793  gSize3D.numPolys += fSizeX3D->numPolys;
794  }
795  else Error("Sizeof3D()","buffer size has not been defined yet");
796 }
virtual const char * GetName() const
Returns name of object.
Definition: TNamed.h:51
virtual void SetLineWidth(Width_t lwidth)
Set the line width.
Definition: TAttLine.h:49
virtual Float_t * GetXYZ(Float_t *xyz, Int_t idx, Int_t num=1) const
GetXYZ(Float_t *xyz,Int_t idx,Int_t num=1) fills the buffer supplied by the calling code with the poi...
EShapeTypes
double dist(Rotation3D const &r1, Rotation3D const &r2)
Definition: 3DDistances.cxx:48
virtual Int_t DistancetoPrimitive(Int_t px, Int_t py)=0
Computes distance from point (px,py) to the object.
virtual Int_t Size() const
to be documented
Float_t Normalize(Float_t v[3])
Normalize a vector v in place.
Definition: TMath.cxx:498
short Style_t
Definition: RtypesCore.h:76
virtual void SetShape(TShape *shape)
to be documented
virtual void PaintPoints3D(const TPoints3DABC *points, Option_t *opt="")
TLine * line
virtual void WCtoNDC(const Float_t *pw, Float_t *pn)=0
float Float_t
Definition: RtypesCore.h:53
float Size_t
Definition: RtypesCore.h:83
return c
const char Option_t
Definition: RtypesCore.h:62
Abstract class to define Arrays of 3D points.
Definition: TPoints3DABC.h:27
virtual void DrawPolyMarker(Int_t n, Float_t *x, Float_t *y)=0
virtual Size_t SetSizeAttribute(Size_t size)
to be documented
See TView3D.
Definition: TView.h:29
struct _x3d_data_ X3DBuffer
SCoord_t fX
Definition: TPoint.h:37
virtual void PaintNode(Float_t *start, Float_t *end, Option_t *option)
Double_t *start - coordinate of the start point of the current segment Double_t *end - coordinate of ...
int numPolys
Definition: X3DBuffer.h:20
virtual Size_t GetSizeAttribute() const
to be documented
virtual void SetConnection(TShape *connection)
SCoord_t fY
Definition: TPoint.h:38
virtual Size3D * CreateX3DSize(Bool_t marker=kFALSE)
to be documented
Basic string class.
Definition: TString.h:137
virtual Int_t PointDistancetoPrimitive(Int_t px, Int_t py)
*-*-*-*-*-*-*Compute distance from point px,py to a 3-D points *-*-*-*-*-*-* *-* ====================...
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
virtual void ExecuteEvent(Int_t event, Int_t px, Int_t py)
forward the ExecuteEvent call to the decorated object
virtual void Paint(Option_t *opt)
to be documented
const Bool_t kFALSE
Definition: Rtypes.h:92
virtual void Create()
the X3D buffer sizes
virtual void Sizeof3D() const
-*-*-*-*-*-*Return total X3D size of this shape with its attributes-*-*-*-*-* *-* ===================...
virtual Float_t GetWidthFactor() const
virtual void Modify()
Change current line attributes if necessary.
Definition: TAttLine.cxx:232
TPolyLineShape()
to be documented
virtual void SetWidthFactor(Float_t fact=1.0)
virtual Color_t GetColorAttribute() const
to be documented
virtual char * GetObjectInfo(Int_t px, Int_t py) const
Returns string containing info about the object at position (px,py).
Definition: TObject.cxx:445
int numSegs
Definition: X3DBuffer.h:19
virtual Width_t GetLineWidth() const
Return the line width.
Definition: TAttLine.h:41
virtual const char * GetTitle() const
forward the GetObjectInfo call to the decorated object
virtual void AppendPad(Option_t *option="")
Append graphics object to current pad.
Definition: TObject.cxx:165
virtual void PaintX3DLine(Option_t *opt="")
to be documented
virtual Int_t DistancetoPrimitive(Int_t px, Int_t py)
-*-*-*-*-*-*-*Compute distance from point px,py to a 3-D polyline-*-*-*-*-*-* *-* ===================...
virtual Style_t SetStyleAttribute(Style_t style)
SetStyleAttribute(Style_t style) - set new style for this line Returns: previous value of the line st...
#define SafeDelete(p)
Definition: RConfig.h:507
Double_t x[n]
Definition: legend1.C:17
int * polys
Definition: X3DBuffer.h:23
virtual void Add(TDataSet *dataset)
Definition: TVolume.h:103
A Sphere.
Definition: TSPHE.h:30
virtual void SetVisibility(ENodeSEEN vis=TVolume::kBothVisible)
Set visibility for this volume and its sons.
Definition: TVolume.cxx:744
virtual void Paint3d(Option_t *opt)
to be documented
virtual ~TPolyLineShape()
to be documented
virtual Style_t GetStyleAttribute() const
to be documented
virtual void SetMarkerColor(Color_t mcolor=1)
Set the marker color.
Definition: TAttMarker.h:43
virtual void PaintX3DMarker(Option_t *opt="")
to be documented
float * points
Definition: X3DBuffer.h:21
void FillX3DBuffer(X3DBuffer *buff)
Definition: X3DBuffer.c:140
virtual char * GetObjectInfo(Int_t px, Int_t py) const
forward the GetObjectInfo call to the decorated object
short Marker_t
Definition: RtypesCore.h:77
int numPoints
Definition: X3DBuffer.h:27
virtual Int_t GetN() const
GetN() returns the number of allocated cells if any.
TShape * fConnection
short Color_t
Definition: RtypesCore.h:79
int * segs
Definition: X3DBuffer.h:22
struct _x3d_sizeof_ Size3D
Definition: TPoint.h:33
point * points
Definition: X3DBuffer.c:20
virtual Float_t * GetP() const
GetP() returns the pointer to the float point array of points if available The number of the availabl...
Definition: TPoints3D.h:78
virtual void SetLineColor(Color_t lcolor)
Set the line color.
Definition: TAttLine.h:46
virtual void Modify()
Change current marker attributes if necessary.
Definition: TAttMarker.cxx:204
This is the base class for all geometry shapes.
Definition: TShape.h:47
Manages a detector rotation matrix.
Definition: TRotMatrix.h:30
#define gSize3D
Definition: X3DBuffer.h:42
virtual void PaintNodePosition(Option_t *option="", TVolumePosition *postion=0)
Definition: TVolume.cxx:582
static Double_t * Gyrot(Double_t *dirc, Double_t cosang, Double_t sinang, Double_t trans[3][3])
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
Definition: TObject.cxx:925
virtual void SetMarkerStyle(Style_t mstyle=1)
Set the marker style.
Definition: TAttMarker.h:45
T * Cross(const T v1[3], const T v2[3], T out[3])
Definition: TMath.h:1007
virtual TPoints3DABC * GetPoints() const
virtual Color_t SetColorAttribute(Color_t color)
to be documented
virtual void SetMarkerSize(Size_t msize=1)
Set the marker size.
Definition: TAttMarker.h:46
#define gVirtualX
Definition: TVirtualX.h:362
short Width_t
Definition: RtypesCore.h:78
virtual Color_t GetLineColor() const
Return the line color.
Definition: TAttLine.h:39
A box with faces perpendicular to the axes.
Definition: TBRIK.h:28
const Int_t kDimension
static const double x1[5]
#define ClassImp(name)
Definition: Rtypes.h:279
virtual void ExecuteEvent(Int_t event, Int_t px, Int_t py)
Execute action corresponding to an event at (px,py).
Definition: TObject.cxx:370
TPoints3DABC * fPoints
double Double_t
Definition: RtypesCore.h:55
EShapeTypes fShapeType
Size3D * fSizeX3D
TCanvas * style()
Definition: style.C:1
Double_t y[n]
Definition: legend1.C:17
virtual void SetLineAttr(Color_t color, Int_t width, Option_t *opt="")
virtual void SetLineStyle(Style_t lstyle)
Set the line style.
Definition: TAttLine.h:48
virtual void PaintPolyMarker(Int_t n, Float_t *p=0, Marker_t m=0, Option_t *opt="")
-*-*-*-*-*-*-*-*Paint polymarker in CurrentPad World coordinates-*-*-*-*-*-*-* *-* ==================...
virtual const char * GetTitle() const
Returns title of object.
Definition: TObject.cxx:460
virtual Float_t * GetP() const
GetP() returns the pointer to the float point array of points if available The number of the availabl...
static Float_t Product(Float_t *v1, Float_t *v2, Int_t ndim=3)
to be documented
R__EXTERN TVirtualPS * gVirtualPS
Definition: TVirtualPS.h:91
#define gPad
Definition: TVirtualPad.h:289
Double_t Sqrt(Double_t x)
Definition: TMath.h:464
virtual Int_t Size() const =0
int numPolys
Definition: X3DBuffer.h:29
virtual const char * GetName() const
Returns name of object.
Definition: TObject.cxx:416
const Bool_t kTRUE
Definition: Rtypes.h:91
int numPoints
Definition: X3DBuffer.h:18
const Int_t n
Definition: legend1.C:16
virtual void Draw(Option_t *opt="")
to be documented
virtual void PaintPoints(Int_t n, Float_t *p=0, Option_t *opt="")
-*-*-*-*-*-*-*-*Draw this 3-D polyline with new coordinates-*-*-*-*-*-*-*-*-* *-* ===================...
virtual const char * GetName() const
forward the GetName call to the decorated object
virtual const char * GetTitle() const
Returns title of object.
Definition: TNamed.h:52
const char * Data() const
Definition: TString.h:349