Logo ROOT  
Reference Guide
TAxis3D.cxx
Go to the documentation of this file.
1// @(#)root/g3d:$Id$
2// Author: Valery Fine(fine@mail.cern.ch) 07/01/2000
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 <ctype.h>
13#include <assert.h>
14
15#include "Riostream.h"
16#include "TMath.h"
17#include "TList.h"
18#include "TClass.h"
19#include "TAxis3D.h"
20#include "TCanvas.h"
21#include "TVirtualPad.h"
22#include "TGaxis.h"
23#include "TView.h"
24#include "TVirtualX.h"
25#include "TBrowser.h"
26#include "TStyle.h"
27
28/** \class TAxis3D
29\ingroup g3d
30
31The 3D axis painter class
32
33This class provide up to 3 axes to any 3D ROOT plot and "ZOOM" service.
34ExecuteEvent() method does provide zooming and moving a projection
353D object within TPad client area. With Zoom mode on the user can access
36TAxis3D context menu and set /change the attributes of axes all together
37or separately.
38
39To add the 3D rulers to any 3D view one has to create
40an instance of this class and Draw it.
41
42~~~ {.cpp}
43 TAxis3D rulers;
44 rulers.Draw();
45~~~
46
47One can use a static method to create ruler and attach it to the current gPad
48
49~~~ {.cpp}
50 TAxis3D::ToggleRulers(); // Brings the 3D axes up
51 TAxis3D::ToggleRulers(); // next calls remove the rulers from the TPad etc
52~~~
53
54To activate Zoomer one may call
55
56~~~ {.cpp}
57 TAxis3D::ToggleZoom();
58~~~
59
60each time one needs move or zoom the image. Then the user can:
61
62 - move:
63\image html g3d_axis3d_01.png
64 - zoom:
65\image html g3d_axis3d_02.png
66
67its 3D view with <left-mouse button> press / move.
68The "Zoom" deactivates itself just the user release the <left-mouse button>
69
70To change attributes of the rulers attached to the current Pad, one may
71query its pointer first:
72
73~~~ {.cpp}
74TAxis3D *axis = TAxis3D::GetPadAxis(); // Ask axis pointer
75if (axis) {
76 TAxis3D::ToggleRulers() // To pop axes down
77 axis->SetLabelColor(kBlue); // Paint the axes labels with blue color
78 axis->SetAxisColor(kRed); // Paint the axes itself with blue color
79 TAxis3D::ToggleRulers() // To pop axes up
80}
81~~~
82
83The attributes of the created axes are affected by the current style
84(see TStyle class ) and Set... methods of this class
85
86For example:
87~~~ {.cpp}
88 gStyle->SetAxisColor(kYellow,"X");
89 gStyle->SetAxisColor(kYellow,"Y");
90 gStyle->SetAxisColor(kYellow,"Z");
91
92 gStyle->SetLabelColor(kYellow,"X");
93 gStyle->SetLabelColor(kYellow,"Y");
94 gStyle->SetLabelColor(kYellow,"Z");
95
96 TAxis3D::ToggleRulers();
97 TAxis3D::ToggleRulers();
98~~~
99
100will draw all axes and labels with yellow color.
101*/
102
103const Char_t *TAxis3D::fgRulerName = "axis3druler";
105
106////////////////////////////////////////////////////////////////////////////////
107/// Normal constructor.
108
109TAxis3D::TAxis3D() : TNamed(TAxis3D::fgRulerName,"ruler")
110{
111 fSelected = 0;
114 InitSet();
115}
116
117////////////////////////////////////////////////////////////////////////////////
118/// Normal constructor.
119
120TAxis3D::TAxis3D(Option_t *) : TNamed(TAxis3D::fgRulerName,"ruler")
121{
122 fSelected = 0;
123 InitSet();
126}
127
128////////////////////////////////////////////////////////////////////////////////
129/// Copy constructor.
130
131TAxis3D::TAxis3D(const TAxis3D &axis) : TNamed(axis)
132{
133 ((TAxis3D&)axis).Copy(*this);
134}
135
136////////////////////////////////////////////////////////////////////////////////
137/// Copy axis3d
138
139void TAxis3D::Copy(TObject &obj) const
140{
141 TNamed::Copy(obj);
142 for (Int_t i=0;i<2;i++) fAxis[i].Copy(((TAxis3D&)obj).fAxis[i]);
143}
144
145////////////////////////////////////////////////////////////////////////////////
146/// Initialization.
147
149{
150 fAxis[0].SetName("xaxis");
151 fAxis[1].SetName("yaxis");
152 fAxis[2].SetName("zaxis");
153
154 fAxis[0].Set(1,0.,1.);
155 fAxis[1].Set(1,0.,1.);
156 fAxis[2].Set(1,0.,1.);
158}
159
160////////////////////////////////////////////////////////////////////////////////
161/// Add all 3 axes to the TBrowser
162
164{
165 for (Int_t i=0;i<3;i++) b->Add(&fAxis[i],fAxis[i].GetTitle());
166}
167
168////////////////////////////////////////////////////////////////////////////////
169/// Compute distance from point px,py to a line.
170
172{
173 Int_t dist = 9;
174 for (int i=0;i<3;i++) {
175 Int_t axDist = fAxis[i].DistancetoPrimitive(px,py);
176 if (dist > axDist) { dist = axDist; fSelected = &fAxis[i]; }
177 }
178 if (fZoomMode)
179 return 0;
180 else
181 return dist;
182}
183
184////////////////////////////////////////////////////////////////////////////////
185/// Execute action corresponding to one event.
186///
187/// This member function is called when an axis is clicked with the locator
188
190{
191 if (!gPad) return;
192
193 if (fSelected) fSelected->ExecuteEvent(event,px,py);
194
195 // Execute action corresponding to the mouse event
196
197 static Double_t x0, y0, x1, y1;
198
199 static Int_t pxold, pyold;
200 static Int_t px0, py0;
201 static Int_t linedrawn;
202
203 if (!fZoomMode) return;
204
205 // something to zoom ?
206
207 gPad->SetCursor(kCross);
208
209 switch (event) {
210
211 case kButton1Down:
212 gVirtualX->SetLineColor(-1);
213 gPad->TAttLine::Modify(); //Change line attributes only if necessary
214 ((TPad *)gPad)->AbsPixeltoXY(px,py,x0,y0);
215 px0 = px; py0 = py;
216 pxold = px; pyold = py;
217 linedrawn = 0;
218 break;
219
220 case kButton1Motion:
221 if (linedrawn) gVirtualX->DrawBox(px0, py0, pxold, pyold, TVirtualX::kHollow);
222 pxold = px;
223 pyold = py;
224 linedrawn = 1;
225 gVirtualX->DrawBox(px0, py0, pxold, pyold, TVirtualX::kHollow);
226 break;
227
228 case kButton1Up: {
229 Int_t i;
230 gPad->SetDoubleBuffer(1);
231 gVirtualX->SetDrawMode(TVirtualX::kCopy); // set drawing mode back to normal (copy) mode
232 TView *view = gPad->GetView();
233 if (!view) break; // no 3D view yet
234
235 Double_t min[3],max[3],viewCenter[3],viewCenterNDC[3];
236
237 view->GetRange(min,max);
238 for (i =0; i<3;i++) viewCenter[i] = (max[i]+min[i])/2;
239 view->WCtoNDC(viewCenter,viewCenterNDC);
240 // Define the center
241 Double_t center[3],pointNDC[3],size[3],oldSize[3];
242 ((TPad *)gPad)->AbsPixeltoXY(px,py,x1,y1);
243 pointNDC[0] = (x0+x1)/2; pointNDC[1] = (y0+y1)/2;
244 pointNDC[2] = viewCenterNDC[2];
245 view->NDCtoWC(pointNDC, center);
246
247 for (i =0; i<3;i++) oldSize[i] = size[i]= (max[i]-min[i])/2;
248
249 // If there was a small motion, move the center only, do not change a scale
250 if (TMath::Abs(px-px0)+TMath::Abs(py - py0) > 4 ) {
251 Double_t newEdge[3];
252 for (i =0; i<3;i++) size[i] = -1;
253
254 pointNDC[0] = x0; pointNDC[1] = y0;
255
256 view->NDCtoWC(pointNDC, newEdge);
257 for (i =0; i<3;i++) {
258 Double_t newSize = TMath::Abs(newEdge[i]-center[i]);
259 if ( newSize/oldSize[i] > 0.002)
260 size[i] = TMath::Max(size[i], newSize);
261 else
262 size[i] = oldSize[i];
263 }
264
265 pointNDC[0] = x1; pointNDC[1] = y1;
266
267 view->NDCtoWC(pointNDC, newEdge);
268 for (i =0; i<3;i++) {
269 Double_t newSize = TMath::Abs(newEdge[i]-center[i]);
270 if ( newSize/oldSize[i] > 0.002)
271 size[i] = TMath::Max(size[i], newSize);
272 else
273 size[i] = oldSize[i];
274 }
275#if 0
276 if (fZooms == kMAXZOOMS) fZoom = 0;
277 fZooms++;
278 memcpy(fZoomMin[fZooms],min,3*sizeof(Float_t));
279 memcpy(fZoomMax[fZooms],max,3*sizeof(Float_t));
280#endif
281 }
282 for (i =0; i<3;i++) {
283 max[i] = center[i] + size[i];
284 min[i] = center[i] - size[i];
285 }
286 view->SetRange(min,max);
287
289 gPad->Modified(kTRUE);
290 gPad->Update();
291 break;
292 }
293 default: break;
294 }
295}
296
297////////////////////////////////////////////////////////////////////////////////
298/// Dummy method
299/// returns the const char * to "axis3d"
300
302{
303 return (char*)"axis3d";
304}
305
306////////////////////////////////////////////////////////////////////////////////
307/// Paint axis over 3D view on the TPad
308
310{
311 TGaxis axis;
312 PaintAxis(&axis, 90);
313}
314
315////////////////////////////////////////////////////////////////////////////////
316/// Draw the axis for TView object.
317///
318/// The original idea belongs:
319///
320/// void THistPainter::PaintLegoAxis(TGaxis *axis, Double_t ang)
321
323{
324 static Double_t epsil = 0.001;
325
326 Double_t cosa, sina;
327 Double_t bmin, bmax;
328 Double_t r[24] /* was [3][8] */;
329 Int_t ndiv, i;
330 Double_t x1[3], x2[3], y1[3], y2[3], z1[3], z2[3], av[24] /* was [3][8] */;
331 char chopax[10];
332 Int_t ix1, ix2, iy1, iy2, iz1, iz2;
334
335 TView *view = gPad->GetView();
336 if (!view) {
337 Error("PaintAxis", "no TView in current pad");
338 return;
339 }
340
341 rad = TMath::ATan(1.) * 4. / 180.;
342 cosa = TMath::Cos(ang*rad);
343 sina = TMath::Sin(ang*rad);
344
345 view->AxisVertex(ang, av, ix1, ix2, iy1, iy2, iz1, iz2);
346 for (i = 1; i <= 8; ++i) {
347 r[i*3 - 3] = av[i*3 - 3] + av[i*3 - 2]*cosa;
348 r[i*3 - 2] = av[i*3 - 2]*sina;
349 r[i*3 - 1] = av[i*3 - 1];
350 }
351
352 view->WCtoNDC(&r[ix1*3 - 3], x1);
353 view->WCtoNDC(&r[ix2*3 - 3], x2);
354 view->WCtoNDC(&r[iy1*3 - 3], y1);
355 view->WCtoNDC(&r[iy2*3 - 3], y2);
356 view->WCtoNDC(&r[iz1*3 - 3], z1);
357 view->WCtoNDC(&r[iz2*3 - 3], z2);
358
359 view->SetAxisNDC(x1, x2, y1, y2, z1, z2);
360
361 Double_t *rmin = view->GetRmin();
362 Double_t *rmax = view->GetRmax();
363
364 axis->SetLineWidth(1);
365
366 for (i=0;i<3;i++) {
367
368 // X axis drawing
369 Double_t ax[2], ay[2];
370 Bool_t logAx = kFALSE;
371 memset(chopax,0,sizeof(chopax));
372 switch (i) {
373 case 0 :
374 ax[0] = x1[0]; ax[1] = x2[0];
375 ay[0] = x1[1]; ay[1] = x2[1];
376 logAx = gPad->GetLogx();
377 break;
378 case 1 :
379 if (TMath::Abs(y1[0] - y2[0]) < epsil) y2[0] = y1[0];
380 ax[0] = y1[0]; ax[1] = y2[0];
381 ay[0] = y1[1]; ay[1] = y2[1];
382 logAx = gPad->GetLogy();
383 break;
384 case 2 :
385 ax[0] = z1[0]; ax[1] = z2[0];
386 ay[0] = z1[1]; ay[1] = z2[1];
387 strlcpy(chopax, "SDH+=",10);
388 logAx = gPad->GetLogz();
389 break;
390 default:
391 assert(0);
392 continue;
393 };
394
395 // If the axis is too short - skip it
396 if ( ( TMath::Abs(ax[0] - ax[1]) + TMath::Abs(ay[0] - ay[1])) < epsil ) continue;
397
398 if (i != 2 ) {
399 if (ax[0] > ax[1]) strlcpy(chopax, "SDHV=+",10);
400 else strlcpy(chopax, "SDHV=-",10);
401 }
402
403 if (i==1 && (TMath::Abs(z1[0] - z2[0]) + TMath::Abs(z1[1] - z2[1])) < epsil)
404 strlcpy(chopax, "SDH+=",10);
405
406 // Initialize the axis options
407 if (logAx) {
408 strlcat(chopax,"G",10);
409 bmin = TMath::Power(10, rmin[i]);
410 bmax = TMath::Power(10, rmax[i]);
411 } else {
412 bmin = rmin[i];
413 bmax = rmax[i];
414 }
415
416 axis->SetLineColor( fAxis[i].GetAxisColor());
417 axis->SetTextFont( fAxis[i].GetTitleFont());
418 axis->SetTextColor( fAxis[i].GetTitleColor());
419 axis->SetTickSize( fAxis[i].GetTickLength());
420 axis->SetLabelColor( fAxis[i].GetLabelColor());
421 axis->SetLabelFont( fAxis[i].GetLabelFont());
423 axis->SetLabelSize( fAxis[i].GetLabelSize());
424 axis->SetTitle( fAxis[i].GetTitle());
426 axis->SetTitleSize( fAxis[i].GetTitleSize());
427 enum { kCenterTitle = BIT(12) }; // to be removed with the last version of ROOT
428 axis->SetBit(kCenterTitle, fAxis[i].TestBit(kCenterTitle));
429
430 //*-*- Initialize the number of divisions. If the
431 //*-*- number of divisions is negative, option 'N' is required.
432 ndiv = fAxis[i].GetNdivisions();
433 if (ndiv < 0) {
434 ndiv = -ndiv;
435 chopax[6] = 'N';
436 }
437
438 // Option time display is required ?
439 if (fAxis[i].GetTimeDisplay()) {
440 strlcat(chopax,"t",10);
441 if (strlen(fAxis[i].GetTimeFormatOnly()) == 0) {
442 axis->SetTimeFormat(fAxis[i].ChooseTimeFormat(bmax-bmin));
443 } else {
444 axis->SetTimeFormat(fAxis[i].GetTimeFormat());
445 }
446 }
447 axis->SetOption(chopax);
448 axis->PaintAxis(ax[0], ay[0], ax[1], ay[1], bmin, bmax, ndiv, chopax);
449 }
450}
451
452////////////////////////////////////////////////////////////////////////////////
453/// Convert "screen pixel" coordinates to some center of 3D WC coordinate
454/// if view and gPad present
455
457{
458 Double_t *thisPoint = 0;
459 if (!view && gPad) view = gPad->GetView();
460 if (view) {
461 Double_t x[3] = {px,py,0.5}; // ((TPad *)thisPad)->AbsPixeltoXY(px,py,x[0],x[1]);
462 Double_t min[3], max[3];
463 view->GetRange(min,max);
464 Int_t i;
465 for (i =0; i<3;i++) min[i] = (max[i]+min[i])/2;
466 view->WCtoNDC(min,max);
467 min[0] = x[0]; min[1] = x[1];
468 min[2] = max[2];
469 view->NDCtoWC(min, x);
470 for (i=0;i<3;i++) point3D[i] = x[i];
471 thisPoint = point3D;
472 }
473 return thisPoint;
474}
475
476////////////////////////////////////////////////////////////////////////////////
477/// Save primitive as a C++ statement(s) on output stream out
478
479void TAxis3D::SavePrimitive(std::ostream &out, Option_t * /*= ""*/)
480{
481 fAxis[0].SaveAttributes(out,GetName(),"->GetXaxis()");
482 fAxis[1].SaveAttributes(out,GetName(),"->GetYaxis()");
483 fAxis[2].SaveAttributes(out,GetName(),"->GetZaxis()");
484}
485
486////////////////////////////////////////////////////////////////////////////////
487/// Replace current attributes by current style.
488
490{
491 if (gStyle->IsReading()) {
492 fAxis[0].ResetAttAxis("X");
493 fAxis[1].ResetAttAxis("Y");
494 fAxis[2].ResetAttAxis("Z");
495
496 fAxis[0].SetTitle("x");
500 } else {
509 gStyle->SetTitleSize (fAxis[0].GetTitleSize(), "x");
510 gStyle->SetTitleColor (fAxis[0].GetTitleColor(), "x");
511 gStyle->SetTitleFont (fAxis[0].GetTitleFont(), "x");
512
521 gStyle->SetTitleSize (fAxis[1].GetTitleSize(), "y");
522 gStyle->SetTitleColor (fAxis[1].GetTitleColor(), "y");
523 gStyle->SetTitleFont (fAxis[1].GetTitleFont(), "y");
524
533 gStyle->SetTitleSize (fAxis[2].GetTitleSize(), "z");
534 gStyle->SetTitleColor (fAxis[2].GetTitleColor(), "z");
535 gStyle->SetTitleFont (fAxis[2].GetTitleFont(), "z");
536 }
537}
538
539////////////////////////////////////////////////////////////////////////////////
540/// Return the axis index by its name
541
543{
544 char achoice = toupper(axis[0]);
545 if (achoice == 'X') return 0;
546 if (achoice == 'Y') return 1;
547 if (achoice == 'Z') return 2;
548 return -1;
549}
550
551////////////////////////////////////////////////////////////////////////////////
552/// Get number of divisions.
553
555{
556 Int_t ax = AxisChoice(axis);
557 if (ax < 0) return 0;
558 return fAxis[ax].GetNdivisions();
559}
560
561////////////////////////////////////////////////////////////////////////////////
562/// Get axis color.
563
565{
566 Int_t ax = AxisChoice(axis);
567 if (ax < 0) return 0;
568 return fAxis[ax].GetAxisColor();
569}
570
571////////////////////////////////////////////////////////////////////////////////
572/// Get label color.
573
575{
576 Int_t ax = AxisChoice(axis);
577 if (ax < 0) return 0;
578 return fAxis[ax].GetLabelColor();
579}
580
581////////////////////////////////////////////////////////////////////////////////
582/// Get label font.
583
585{
586 Int_t ax = AxisChoice(axis);
587 if (ax < 0) return 0;
588 return fAxis[ax].GetLabelFont();
589}
590
591////////////////////////////////////////////////////////////////////////////////
592/// Get label offset.
593
595{
596 Int_t ax = AxisChoice(axis);
597 if (ax < 0) return 0;
598 return fAxis[ax].GetLabelOffset();
599}
600
601////////////////////////////////////////////////////////////////////////////////
602/// Get label size.
603
605{
606 Int_t ax = AxisChoice(axis);
607 if (ax < 0) return 0;
608 return fAxis[ax].GetLabelSize();
609}
610
611////////////////////////////////////////////////////////////////////////////////
612/// Get tick mark length.
613
615{
616 Int_t ax = AxisChoice(axis);
617 if (ax < 0) return 0;
618 return fAxis[ax].GetTickLength();
619}
620
621////////////////////////////////////////////////////////////////////////////////
622/// Get title offset.
623
625{
626 Int_t ax = AxisChoice(axis);
627 if (ax < 0) return 0;
628 return fAxis[ax].GetTitleOffset();
629}
630
631////////////////////////////////////////////////////////////////////////////////
632
633#define AXISCHOICE \
634 Int_t i = AxisChoice(axis); \
635 Int_t nax = 1; \
636 if (i == -1) { i = 0; nax = 3;}\
637 for (Int_t ax=i;ax<nax+i;ax++)
638
639////////////////////////////////////////////////////////////////////////////////
640/// Set number of divisions.
641
643{
645}
646
647////////////////////////////////////////////////////////////////////////////////
648/// Set axis color.
649
651{
652 AXISCHOICE {fAxis[ax].SetAxisColor(color);}
653}
654
655////////////////////////////////////////////////////////////////////////////////
656/// Set axis range.
657
659{
660 Int_t ax = AxisChoice(axis);
661 if (ax < 0) return;
662 TAxis *theAxis = &fAxis[ax];
663 Int_t bin1 = theAxis->FindBin(xmin);
664 Int_t bin2 = theAxis->FindBin(xmax);
665 theAxis->SetRange(bin1, bin2);
666}
667
668////////////////////////////////////////////////////////////////////////////////
669/// Set label color.
670
672{
673 AXISCHOICE { fAxis[ax].SetLabelColor(color); }
674}
675
676////////////////////////////////////////////////////////////////////////////////
677/// Set label font.
678
680{
681 AXISCHOICE { fAxis[ax].SetLabelFont(font); }
682}
683
684////////////////////////////////////////////////////////////////////////////////
685/// Set label offset.
686
688{
689 AXISCHOICE { fAxis[ax].SetLabelOffset(offset); }
690}
691
692////////////////////////////////////////////////////////////////////////////////
693/// Set label size.
694
696{
697 AXISCHOICE { fAxis[ax].SetLabelSize(size); }
698}
699
700////////////////////////////////////////////////////////////////////////////////
701/// Set tick mark length.
702
704{
705 AXISCHOICE { fAxis[ax].SetTickLength(length); }
706}
707
708////////////////////////////////////////////////////////////////////////////////
709/// Set title offset.
710
712{
713 AXISCHOICE { fAxis[ax].SetTitleOffset(offset); }
714}
715#undef AXISCHOICE
716
717////////////////////////////////////////////////////////////////////////////////
718/// Returns the "pad" Axis3D object pointer if any.
719
721{
722 TObject *obj = 0;
723 TVirtualPad *thisPad=pad;
724 if (!thisPad) thisPad = gPad;
725 if (thisPad) {
726 // Find axis in the current thisPad
727 obj = thisPad->FindObject(TAxis3D::fgRulerName);
728 if (!(obj && obj->InheritsFrom(Class()->GetName()))) obj = 0;
729 }
730 return (TAxis3D *)obj;
731}
732
733////////////////////////////////////////////////////////////////////////////////
734/// Turn ON / OFF the "Ruler", TAxis3D object attached
735/// to the current pad
736
738{
739 TAxis3D *ax = 0;
740 TVirtualPad *thisPad=pad;
741 if (!thisPad) thisPad = gPad;
742 if (thisPad && thisPad->GetView() ) {
743 TAxis3D *a = GetPadAxis(pad);
744 if (a) delete a;
745 else {
746 ax = new TAxis3D;
747 ax->SetBit(kCanDelete);
748 ax->Draw();
749 }
750 thisPad->Modified();
751 thisPad->Update();
752 }
753 return ax;
754}
755
756////////////////////////////////////////////////////////////////////////////////
757/// Turn ON / OFF the "Ruler" and "zoom mode" of the TAxis3D object attached
758/// to the current pad (if pad = 0; gPad is used "by default")
759///
760/// User is given a chance to either:
761/// 1. move the center of the 3D scene at the cursor position
762/// 2. zoom view with mouse "drugging" the bounder rectangle with "left" mouse
763/// 3. Change the axis attributes via TContextMenu with "right mouse button click"
764
766{
767 TAxis3D *ax = 0;
768 TVirtualPad *thisPad=pad;
769 if (!thisPad) thisPad = gPad;
770 if (thisPad && thisPad->GetView()) {
771 // Find axis in the current thisPad
772 TList *l = thisPad->GetListOfPrimitives();
773 TObject *o = l->FindObject(TAxis3D::fgRulerName);
774 if (o && o->InheritsFrom(Class()->GetName())) { // Find axis
775 if (o != l->Last()) { // make sure the TAxis3D is the last object of the Pad.
776 l->Remove(o);
777 l->AddLast(o);
778 }
779 ax = (TAxis3D *)o;
780 } else { // There is no
781 ax = new TAxis3D;
782 ax->SetBit(kCanDelete);
783 ax->Draw();
784 }
785 ax->SwitchZoom();
786 }
787 return ax;
788}
@ kButton1Motion
Definition: Buttons.h:20
@ kButton1Up
Definition: Buttons.h:19
@ kButton1Down
Definition: Buttons.h:17
void Class()
Definition: Class.C:29
@ kCross
Definition: GuiTypes.h:373
ROOT::R::TRInterface & r
Definition: Object.C:4
#define b(i)
Definition: RSha256.hxx:100
static const double x2[5]
static const double x1[5]
char Char_t
Definition: RtypesCore.h:31
const Bool_t kFALSE
Definition: RtypesCore.h:90
double Double_t
Definition: RtypesCore.h:57
short Color_t
Definition: RtypesCore.h:81
short Style_t
Definition: RtypesCore.h:78
float Float_t
Definition: RtypesCore.h:55
const Bool_t kTRUE
Definition: RtypesCore.h:89
const char Option_t
Definition: RtypesCore.h:64
#define BIT(n)
Definition: Rtypes.h:83
#define ClassImp(name)
Definition: Rtypes.h:361
@ kRed
Definition: Rtypes.h:64
@ kGreen
Definition: Rtypes.h:64
@ kBlue
Definition: Rtypes.h:64
#define AXISCHOICE
Definition: TAxis3D.cxx:633
float xmin
Definition: THbookFile.cxx:93
float xmax
Definition: THbookFile.cxx:93
R__EXTERN TStyle * gStyle
Definition: TStyle.h:410
#define gPad
Definition: TVirtualPad.h:287
#define gVirtualX
Definition: TVirtualX.h:338
virtual Color_t GetLabelColor() const
Definition: TAttAxis.h:38
virtual Int_t GetNdivisions() const
Definition: TAttAxis.h:36
virtual Color_t GetAxisColor() const
Definition: TAttAxis.h:37
virtual void SetTitleOffset(Float_t offset=1)
Set distance between the axis and the axis title.
Definition: TAttAxis.cxx:294
virtual Float_t GetLabelOffset() const
Definition: TAttAxis.h:40
virtual void SetAxisColor(Color_t color=1, Float_t alpha=1.)
Set color of the line axis and tick marks.
Definition: TAttAxis.cxx:163
virtual void SetLabelSize(Float_t size=0.04)
Set size of axis labels.
Definition: TAttAxis.cxx:204
virtual Style_t GetLabelFont() const
Definition: TAttAxis.h:39
virtual void SetLabelOffset(Float_t offset=0.005)
Set distance between the axis and the labels.
Definition: TAttAxis.cxx:193
virtual void SetLabelFont(Style_t font=62)
Set labels' font.
Definition: TAttAxis.cxx:183
virtual Float_t GetLabelSize() const
Definition: TAttAxis.h:41
virtual Float_t GetTickLength() const
Definition: TAttAxis.h:45
virtual void ResetAttAxis(Option_t *option="")
Reset axis attributes.
Definition: TAttAxis.cxx:79
virtual Float_t GetTitleOffset() const
Definition: TAttAxis.h:43
virtual void SetTickLength(Float_t length=0.03)
Set tick mark length.
Definition: TAttAxis.cxx:280
virtual void SetNdivisions(Int_t n=510, Bool_t optim=kTRUE)
Set the number of divisions for this axis.
Definition: TAttAxis.cxx:229
virtual void SetLabelColor(Color_t color=1, Float_t alpha=1.)
Set color of labels.
Definition: TAttAxis.cxx:173
virtual void SetLineWidth(Width_t lwidth)
Set the line width.
Definition: TAttLine.h:43
virtual void SetLineColor(Color_t lcolor)
Set the line color.
Definition: TAttLine.h:40
virtual void SetTextColor(Color_t tcolor=1)
Set the text color.
Definition: TAttText.h:43
virtual void SetTextFont(Font_t tfont=62)
Set the text font.
Definition: TAttText.h:45
The 3D axis painter class.
Definition: TAxis3D.h:31
virtual Float_t GetLabelSize(Option_t *axis="X") const
Get label size.
Definition: TAxis3D.cxx:604
Bool_t SwitchZoom()
Definition: TAxis3D.h:113
virtual void SetNdivisions(Int_t n=510, Option_t *axis="*")
Set number of divisions.
Definition: TAxis3D.cxx:642
virtual void ExecuteEvent(Int_t event, Int_t px, Int_t py)
Execute action corresponding to one event.
Definition: TAxis3D.cxx:189
virtual void Paint(Option_t *option="")
Paint axis over 3D view on the TPad.
Definition: TAxis3D.cxx:309
static TAxis3D * ToggleZoom(TVirtualPad *pad=0)
Turn ON / OFF the "Ruler" and "zoom mode" of the TAxis3D object attached to the current pad (if pad =...
Definition: TAxis3D.cxx:765
virtual Int_t DistancetoPrimitive(Int_t px, Int_t py)
Compute distance from point px,py to a line.
Definition: TAxis3D.cxx:171
void PaintAxis(TGaxis *axis, Float_t ang)
Draw the axis for TView object.
Definition: TAxis3D.cxx:322
virtual void SetLabelOffset(Float_t offset=0.005, Option_t *axis="*")
Set label offset.
Definition: TAxis3D.cxx:687
virtual void SetLabelFont(Style_t font=62, Option_t *axis="*")
Set label font.
Definition: TAxis3D.cxx:679
static Double_t * PixeltoXYZ(Double_t px, Double_t py, Double_t *point3D, TView *view=0)
Convert "screen pixel" coordinates to some center of 3D WC coordinate if view and gPad present.
Definition: TAxis3D.cxx:456
TAxis fAxis[3]
Definition: TAxis3D.h:38
virtual Style_t GetLabelFont(Option_t *axis="X") const
Get label font.
Definition: TAxis3D.cxx:584
static TAxis3D * GetPadAxis(TVirtualPad *pad=0)
Returns the "pad" Axis3D object pointer if any.
Definition: TAxis3D.cxx:720
virtual Float_t GetLabelOffset(Option_t *axis="X") const
Get label offset.
Definition: TAxis3D.cxx:594
virtual void SetAxisRange(Double_t xmin, Double_t xmax, Option_t *axis="*")
Set axis range.
Definition: TAxis3D.cxx:658
virtual Float_t GetTickLength(Option_t *axis="X") const
Get tick mark length.
Definition: TAxis3D.cxx:614
virtual void SetLabelSize(Float_t size=0.02, Option_t *axis="*")
Set label size.
Definition: TAxis3D.cxx:695
Int_t AxisChoice(Option_t *axis) const
Return the axis index by its name.
Definition: TAxis3D.cxx:542
virtual void SavePrimitive(std::ostream &out, Option_t *option="")
Save primitive as a C++ statement(s) on output stream out.
Definition: TAxis3D.cxx:479
virtual Color_t GetAxisColor(Option_t *axis="X") const
Get axis color.
Definition: TAxis3D.cxx:564
virtual void SetAxisColor(Color_t color=1, Option_t *axis="*")
Set axis color.
Definition: TAxis3D.cxx:650
virtual Color_t GetLabelColor(Option_t *axis="X") const
Get label color.
Definition: TAxis3D.cxx:574
virtual void Browse(TBrowser *b)
Add all 3 axes to the TBrowser.
Definition: TAxis3D.cxx:163
Bool_t fZoomMode
The selected axis to play with.
Definition: TAxis3D.h:42
virtual Float_t GetTitleOffset(Option_t *axis="X") const
Get title offset.
Definition: TAxis3D.cxx:624
void InitSet()
Initialization.
Definition: TAxis3D.cxx:148
void UseCurrentStyle()
Replace current attributes by current style.
Definition: TAxis3D.cxx:489
virtual Int_t GetNdivisions(Option_t *axis="X") const
Get number of divisions.
Definition: TAxis3D.cxx:554
static const char * fgRulerName
Definition: TAxis3D.h:40
virtual void SetTickLength(Float_t length=0.02, Option_t *axis="*")
Set tick mark length.
Definition: TAxis3D.cxx:703
static TAxis3D * ToggleRulers(TVirtualPad *pad=0)
Turn ON / OFF the "Ruler", TAxis3D object attached to the current pad.
Definition: TAxis3D.cxx:737
virtual void Copy(TObject &hnew) const
Copy axis3d.
Definition: TAxis3D.cxx:139
virtual char * GetObjectInfo(Int_t px, Int_t py) const
Dummy method returns the const char * to "axis3d".
Definition: TAxis3D.cxx:301
virtual void SetLabelColor(Color_t color=1, Option_t *axis="*")
Set label color.
Definition: TAxis3D.cxx:671
Bool_t fStickyZoom
Definition: TAxis3D.h:43
TAxis3D()
Normal constructor.
Definition: TAxis3D.cxx:109
virtual void SetTitleOffset(Float_t offset=1, Option_t *axis="*")
Set title offset.
Definition: TAxis3D.cxx:711
TAxis * fSelected
Definition: TAxis3D.h:41
Class to manage histogram axis.
Definition: TAxis.h:30
virtual void SaveAttributes(std::ostream &out, const char *name, const char *subname)
Save axis attributes as C++ statement(s) on output stream out.
Definition: TAxis.cxx:658
virtual void ExecuteEvent(Int_t event, Int_t px, Int_t py)
Execute action corresponding to one event.
Definition: TAxis.cxx:278
virtual Int_t FindBin(Double_t x)
Find bin number corresponding to abscissa x.
Definition: TAxis.cxx:290
virtual void Set(Int_t nbins, Double_t xmin, Double_t xmax)
Initialize axis with fix bins.
Definition: TAxis.cxx:728
virtual Int_t DistancetoPrimitive(Int_t px, Int_t py)
Compute distance from point px,py to an axis.
Definition: TAxis.cxx:262
const char * GetTitle() const
Returns title of object.
Definition: TAxis.h:129
virtual void SetRange(Int_t first=0, Int_t last=0)
Set the viewing range for the axis from bin first to last.
Definition: TAxis.cxx:914
Using a TBrowser one can browse all ROOT objects.
Definition: TBrowser.h:37
The axis painter class.
Definition: TGaxis.h:24
void SetTimeFormat(const char *tformat)
Change the format used for time plotting.
Definition: TGaxis.cxx:2721
virtual void PaintAxis(Double_t xmin, Double_t ymin, Double_t xmax, Double_t ymax, Double_t &wmin, Double_t &wmax, Int_t &ndiv, Option_t *chopt="", Double_t gridlength=0, Bool_t drawGridOnly=kFALSE)
Control function to draw an axis.
Definition: TGaxis.cxx:954
void SetTitleOffset(Float_t titleoffset=1)
Definition: TGaxis.h:125
void SetLabelFont(Int_t labelfont)
Definition: TGaxis.h:106
void SetTitleSize(Float_t titlesize)
Definition: TGaxis.h:126
virtual void SetTitle(const char *title="")
Change the title of the axis.
Definition: TGaxis.cxx:2694
void SetLabelOffset(Float_t labeloffset)
Definition: TGaxis.h:107
void SetLabelColor(Int_t labelcolor)
Definition: TGaxis.h:105
void SetTickSize(Float_t ticksize)
Definition: TGaxis.h:119
void SetLabelSize(Float_t labelsize)
Definition: TGaxis.h:108
void SetOption(Option_t *option="")
To set axis options.
Definition: TGaxis.cxx:2686
A doubly linked list.
Definition: TList.h:44
The TNamed class is the base class for all named ROOT classes.
Definition: TNamed.h:29
virtual void Copy(TObject &named) const
Copy this to obj.
Definition: TNamed.cxx:94
virtual void SetTitle(const char *title="")
Set the title of the TNamed.
Definition: TNamed.cxx:164
virtual void SetName(const char *name)
Set the name of the TNamed.
Definition: TNamed.cxx:140
virtual const char * GetTitle() const
Returns title of object.
Definition: TNamed.h:48
virtual const char * GetName() const
Returns name of object.
Definition: TNamed.h:47
Mother of all ROOT objects.
Definition: TObject.h:37
R__ALWAYS_INLINE Bool_t TestBit(UInt_t f) const
Definition: TObject.h:187
virtual TObject * FindObject(const char *name) const
Must be redefined in derived classes.
Definition: TObject.cxx:321
void SetBit(UInt_t f, Bool_t set)
Set or unset the user status bits as specified in f.
Definition: TObject.cxx:694
virtual Bool_t InheritsFrom(const char *classname) const
Returns kTRUE if object inherits from class "classname".
Definition: TObject.cxx:443
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
Definition: TObject.cxx:891
virtual void Draw(Option_t *option="")
Default Draw method for all objects.
Definition: TObject.cxx:195
@ kCanDelete
if object in a list can be deleted
Definition: TObject.h:58
The most important graphics class in the ROOT system.
Definition: TPad.h:29
void SetAxisColor(Color_t color=1, Option_t *axis="X")
Set color to draw the axis line and tick marks.
Definition: TStyle.cxx:1272
Bool_t IsReading() const
Definition: TStyle.h:280
void SetTitleFont(Style_t font=62, Option_t *axis="X")
Definition: TStyle.cxx:1726
void SetTitleOffset(Float_t offset=1, Option_t *axis="X")
Specify a parameter offset to control the distance between the axis and the axis title.
Definition: TStyle.cxx:1749
void SetTitleColor(Color_t color=1, Option_t *axis="X")
Definition: TStyle.cxx:1705
void SetLabelFont(Style_t font=62, Option_t *axis="X")
Set font number used to draw axis labels.
Definition: TStyle.cxx:1362
void SetLabelOffset(Float_t offset=0.005, Option_t *axis="X")
Set offset between axis and axis labels.
Definition: TStyle.cxx:1378
void SetTitleSize(Float_t size=0.02, Option_t *axis="X")
Definition: TStyle.cxx:1768
void SetTickLength(Float_t length=0.03, Option_t *axis="X")
Set the tick marks length for an axis.
Definition: TStyle.cxx:1686
void SetNdivisions(Int_t n=510, Option_t *axis="X")
Set the number of divisions to draw an axis.
Definition: TStyle.cxx:1258
void SetLabelColor(Color_t color=1, Option_t *axis="X")
Set axis labels color.
Definition: TStyle.cxx:1342
void SetLabelSize(Float_t size=0.04, Option_t *axis="X")
Set size of axis labels.
Definition: TStyle.cxx:1393
See TView3D.
Definition: TView.h:25
virtual Double_t * GetRmax()=0
virtual void SetAxisNDC(const Double_t *x1, const Double_t *x2, const Double_t *y1, const Double_t *y2, const Double_t *z1, const Double_t *z2)=0
virtual Double_t * GetRmin()=0
virtual void WCtoNDC(const Float_t *pw, Float_t *pn)=0
virtual void NDCtoWC(const Float_t *pn, Float_t *pw)=0
virtual void GetRange(Float_t *min, Float_t *max)=0
virtual void SetRange(const Double_t *min, const Double_t *max)=0
virtual void AxisVertex(Double_t ang, Double_t *av, Int_t &ix1, Int_t &ix2, Int_t &iy1, Int_t &iy2, Int_t &iz1, Int_t &iz2)=0
TVirtualPad is an abstract base class for the Pad and Canvas classes.
Definition: TVirtualPad.h:51
virtual void Modified(Bool_t flag=1)=0
virtual TList * GetListOfPrimitives() const =0
virtual void Update()=0
virtual TView * GetView() const =0
Double_t x[n]
Definition: legend1.C:17
const Int_t n
Definition: legend1.C:16
double dist(Rotation3D const &r1, Rotation3D const &r2)
Definition: 3DDistances.cxx:48
static constexpr double rad
Short_t Max(Short_t a, Short_t b)
Definition: TMathBase.h:212
Double_t ATan(Double_t)
Definition: TMath.h:665
LongDouble_t Power(LongDouble_t x, LongDouble_t y)
Definition: TMath.h:725
Double_t Cos(Double_t)
Definition: TMath.h:631
Double_t Sin(Double_t)
Definition: TMath.h:627
Short_t Abs(Short_t d)
Definition: TMathBase.h:120
auto * l
Definition: textangle.C:4
auto * a
Definition: textangle.C:12