Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
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 <cctype>
13#include <cassert>
14#include <iostream>
15
16#include "TMath.h"
17#include "TList.h"
18#include "TAxis3D.h"
19#include "TClass.h"
20#include "TPad.h"
21#include "TGaxis.h"
22#include "TView.h"
23#include "TVirtualX.h"
24#include "TBrowser.h"
25#include "TStyle.h"
26#include "strlcpy.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";
104
105////////////////////////////////////////////////////////////////////////////////
106/// Normal constructor.
107
108TAxis3D::TAxis3D() : TNamed(TAxis3D::fgRulerName,"ruler")
109{
110 fSelected = nullptr;
113 InitSet();
114}
115
116////////////////////////////////////////////////////////////////////////////////
117/// Normal constructor.
118
119TAxis3D::TAxis3D(Option_t *) : TNamed(TAxis3D::fgRulerName,"ruler")
120{
121 fSelected = nullptr;
122 InitSet();
125}
126
127////////////////////////////////////////////////////////////////////////////////
128/// Copy constructor.
129
130TAxis3D::TAxis3D(const TAxis3D &axis) : TNamed(axis)
131{
132 axis.TAxis3D::Copy(*this);
133}
134
135////////////////////////////////////////////////////////////////////////////////
136/// Copy axis3d
137
138void TAxis3D::Copy(TObject &obj) const
139{
140 TNamed::Copy(obj);
141 for (Int_t i = 0; i < 3; i++)
142 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++) {
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
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->FeedbackMode(kFALSE); // set drawing mode back to normal (copy) mode
231 TView *view = gPad->GetView();
232 if (!view) break; // no 3D view yet
233
234 Double_t min[3],max[3],viewCenter[3],viewCenterNDC[3];
235
236 view->GetRange(min,max);
237 for (i =0; i<3;i++) viewCenter[i] = (max[i]+min[i])/2;
239 // Define the center
240 Double_t center[3],pointNDC[3],size[3],oldSize[3];
241 ((TPad *)gPad)->AbsPixeltoXY(px,py,x1,y1);
242 pointNDC[0] = (x0+x1)/2; pointNDC[1] = (y0+y1)/2;
243 pointNDC[2] = viewCenterNDC[2];
244 view->NDCtoWC(pointNDC, center);
245
246 for (i =0; i<3;i++) oldSize[i] = size[i]= (max[i]-min[i])/2;
247
248 // If there was a small motion, move the center only, do not change a scale
249 if (TMath::Abs(px-px0)+TMath::Abs(py - py0) > 4 ) {
250 Double_t newEdge[3];
251 for (i =0; i<3;i++) size[i] = -1;
252
253 pointNDC[0] = x0; pointNDC[1] = y0;
254
255 view->NDCtoWC(pointNDC, newEdge);
256 for (i =0; i<3;i++) {
257 Double_t newSize = TMath::Abs(newEdge[i]-center[i]);
258 if ( newSize/oldSize[i] > 0.002)
259 size[i] = TMath::Max(size[i], newSize);
260 else
261 size[i] = oldSize[i];
262 }
263
264 pointNDC[0] = x1; pointNDC[1] = y1;
265
266 view->NDCtoWC(pointNDC, newEdge);
267 for (i =0; i<3;i++) {
268 Double_t newSize = TMath::Abs(newEdge[i]-center[i]);
269 if ( newSize/oldSize[i] > 0.002)
270 size[i] = TMath::Max(size[i], newSize);
271 else
272 size[i] = oldSize[i];
273 }
274#if 0
275 if (fZooms == kMAXZOOMS) fZoom = 0;
276 fZooms++;
277 memcpy(fZoomMin[fZooms],min,3*sizeof(Float_t));
278 memcpy(fZoomMax[fZooms],max,3*sizeof(Float_t));
279#endif
280 }
281 for (i =0; i<3;i++) {
282 max[i] = center[i] + size[i];
283 min[i] = center[i] - size[i];
284 }
285 view->SetRange(min,max);
286
288 gPad->Modified(kTRUE);
289 gPad->Update();
290 break;
291 }
292 default: break;
293 }
294}
295
296////////////////////////////////////////////////////////////////////////////////
297/// Dummy method
298/// returns the const char * to "axis3d"
299
301{
302 return (char*)"axis3d";
303}
304
305////////////////////////////////////////////////////////////////////////////////
306/// Paint axis over 3D view on the TPad
307
309{
310 TGaxis axis;
311 PaintAxis(&axis, 90);
312}
313
314////////////////////////////////////////////////////////////////////////////////
315/// Draw the axis for TView object.
316///
317/// The original idea belongs:
318///
319/// void THistPainter::PaintLegoAxis(TGaxis *axis, Double_t ang)
320
322{
323 static Double_t epsil = 0.001;
324
327 Double_t r[24] /* was [3][8] */;
328 Int_t ndiv, i;
329 Double_t x1[3], x2[3], y1[3], y2[3], z1[3], z2[3], av[24] /* was [3][8] */;
330 char chopax[10];
331 Int_t ix1, ix2, iy1, iy2, iz1, iz2;
332 Double_t rad;
333
334 TView *view = gPad->GetView();
335 if (!view) {
336 Error("PaintAxis", "no TView in current pad");
337 return;
338 }
339
340 rad = TMath::ATan(1.) * 4. / 180.;
341 cosa = TMath::Cos(ang*rad);
342 sina = TMath::Sin(ang*rad);
343
344 view->AxisVertex(ang, av, ix1, ix2, iy1, iy2, iz1, iz2);
345 for (i = 1; i <= 8; ++i) {
346 r[i*3 - 3] = av[i*3 - 3] + av[i*3 - 2]*cosa;
347 r[i*3 - 2] = av[i*3 - 2]*sina;
348 r[i*3 - 1] = av[i*3 - 1];
349 }
350
351 view->WCtoNDC(&r[ix1*3 - 3], x1);
352 view->WCtoNDC(&r[ix2*3 - 3], x2);
353 view->WCtoNDC(&r[iy1*3 - 3], y1);
354 view->WCtoNDC(&r[iy2*3 - 3], y2);
355 view->WCtoNDC(&r[iz1*3 - 3], z1);
356 view->WCtoNDC(&r[iz2*3 - 3], z2);
357
358 view->SetAxisNDC(x1, x2, y1, y2, z1, z2);
359
360 Double_t *rmin = view->GetRmin();
361 Double_t *rmax = view->GetRmax();
362
363 axis->SetLineWidth(1);
364
365 for (i=0;i<3;i++) {
366
367 // X axis drawing
368 Double_t ax[2], ay[2];
370 memset(chopax,0,sizeof(chopax));
371 switch (i) {
372 case 0 :
373 ax[0] = x1[0]; ax[1] = x2[0];
374 ay[0] = x1[1]; ay[1] = x2[1];
375 logAx = gPad->GetLogx();
376 break;
377 case 1 :
378 if (TMath::Abs(y1[0] - y2[0]) < epsil) y2[0] = y1[0];
379 ax[0] = y1[0]; ax[1] = y2[0];
380 ay[0] = y1[1]; ay[1] = y2[1];
381 logAx = gPad->GetLogy();
382 break;
383 case 2 :
384 ax[0] = z1[0]; ax[1] = z2[0];
385 ay[0] = z1[1]; ay[1] = z2[1];
386 strlcpy(chopax, "SDH+=",10);
387 logAx = gPad->GetLogz();
388 break;
389 default:
390 assert(0);
391 continue;
392 };
393
394 // If the axis is too short - skip it
395 if ( ( TMath::Abs(ax[0] - ax[1]) + TMath::Abs(ay[0] - ay[1])) < epsil ) continue;
396
397 if (i != 2 ) {
398 if (ax[0] > ax[1]) strlcpy(chopax, "SDHV=+",10);
399 else strlcpy(chopax, "SDHV=-",10);
400 }
401
402 if (i==1 && (TMath::Abs(z1[0] - z2[0]) + TMath::Abs(z1[1] - z2[1])) < epsil)
403 strlcpy(chopax, "SDH+=",10);
404
405 // Initialize the axis options
406 if (logAx) {
407 strlcat(chopax,"G",10);
408 bmin = TMath::Power(10, rmin[i]);
409 bmax = TMath::Power(10, rmax[i]);
410 } else {
411 bmin = rmin[i];
412 bmax = rmax[i];
413 }
414
415 axis->SetLineColor( fAxis[i].GetAxisColor());
416 axis->SetTextFont( fAxis[i].GetTitleFont());
417 axis->SetTextColor( fAxis[i].GetTitleColor());
418 axis->SetTickSize( fAxis[i].GetTickLength());
419 axis->SetLabelColor( fAxis[i].GetLabelColor());
420 axis->SetLabelFont( fAxis[i].GetLabelFont());
422 axis->SetLabelSize( fAxis[i].GetLabelSize());
423 axis->SetTitle( fAxis[i].GetTitle());
425 axis->SetTitleSize( fAxis[i].GetTitleSize());
426 enum { kCenterTitle = BIT(12) }; // to be removed with the last version of ROOT
427 axis->SetBit(kCenterTitle, fAxis[i].TestBit(kCenterTitle));
428
429 //*-*- Initialize the number of divisions. If the
430 //*-*- number of divisions is negative, option 'N' is required.
431 ndiv = fAxis[i].GetNdivisions();
432 if (ndiv < 0) {
433 ndiv = -ndiv;
434 chopax[6] = 'N';
435 }
436
437 // Option time display is required ?
438 if (fAxis[i].GetTimeDisplay()) {
439 strlcat(chopax,"t",10);
440 if (strlen(fAxis[i].GetTimeFormatOnly()) == 0) {
441 axis->SetTimeFormat(fAxis[i].ChooseTimeFormat(bmax-bmin));
442 } else {
443 axis->SetTimeFormat(fAxis[i].GetTimeFormat());
444 }
445 }
446 axis->SetOption(chopax);
447 axis->PaintAxis(ax[0], ay[0], ax[1], ay[1], bmin, bmax, ndiv, chopax);
448 }
449}
450
451////////////////////////////////////////////////////////////////////////////////
452/// Convert "screen pixel" coordinates to some center of 3D WC coordinate
453/// if view and gPad present
454
456{
457 Double_t *thisPoint = nullptr;
458 if (!view && gPad) view = gPad->GetView();
459 if (view) {
460 Double_t x[3] = {px,py,0.5}; // ((TPad *)thisPad)->AbsPixeltoXY(px,py,x[0],x[1]);
461 Double_t min[3], max[3];
462 view->GetRange(min,max);
463 Int_t i;
464 for (i =0; i<3;i++) min[i] = (max[i]+min[i])/2;
465 view->WCtoNDC(min,max);
466 min[0] = x[0]; min[1] = x[1];
467 min[2] = max[2];
468 view->NDCtoWC(min, x);
469 for (i=0;i<3;i++) point3D[i] = x[i];
471 }
472 return thisPoint;
473}
474
475////////////////////////////////////////////////////////////////////////////////
476/// Save primitive as a C++ statement(s) on output stream out
477
478void TAxis3D::SavePrimitive(std::ostream &out, Option_t * /*= ""*/)
479{
480 fAxis[0].SaveAttributes(out,GetName(),"->GetXaxis()");
481 fAxis[1].SaveAttributes(out,GetName(),"->GetYaxis()");
482 fAxis[2].SaveAttributes(out,GetName(),"->GetZaxis()");
483}
484
485////////////////////////////////////////////////////////////////////////////////
486/// Replace current attributes by current style.
487
489{
490 if (gStyle->IsReading()) {
491 fAxis[0].ResetAttAxis("X");
492 fAxis[1].ResetAttAxis("Y");
493 fAxis[2].ResetAttAxis("Z");
494
495 fAxis[0].SetTitle("x");
499 } else {
508 gStyle->SetTitleSize (fAxis[0].GetTitleSize(), "x");
509 gStyle->SetTitleColor (fAxis[0].GetTitleColor(), "x");
510 gStyle->SetTitleFont (fAxis[0].GetTitleFont(), "x");
511
520 gStyle->SetTitleSize (fAxis[1].GetTitleSize(), "y");
521 gStyle->SetTitleColor (fAxis[1].GetTitleColor(), "y");
522 gStyle->SetTitleFont (fAxis[1].GetTitleFont(), "y");
523
532 gStyle->SetTitleSize (fAxis[2].GetTitleSize(), "z");
533 gStyle->SetTitleColor (fAxis[2].GetTitleColor(), "z");
534 gStyle->SetTitleFont (fAxis[2].GetTitleFont(), "z");
535 }
536}
537
538////////////////////////////////////////////////////////////////////////////////
539/// Return the axis index by its name
540
542{
543 char achoice = toupper(axis[0]);
544 if (achoice == 'X') return 0;
545 if (achoice == 'Y') return 1;
546 if (achoice == 'Z') return 2;
547 return -1;
548}
549
550////////////////////////////////////////////////////////////////////////////////
551/// Get number of divisions.
552
554{
555 Int_t ax = AxisChoice(axis);
556 if (ax < 0) return 0;
557 return fAxis[ax].GetNdivisions();
558}
559
560////////////////////////////////////////////////////////////////////////////////
561/// Get axis color.
562
564{
565 Int_t ax = AxisChoice(axis);
566 if (ax < 0) return 0;
567 return fAxis[ax].GetAxisColor();
568}
569
570////////////////////////////////////////////////////////////////////////////////
571/// Get label color.
572
574{
575 Int_t ax = AxisChoice(axis);
576 if (ax < 0) return 0;
577 return fAxis[ax].GetLabelColor();
578}
579
580////////////////////////////////////////////////////////////////////////////////
581/// Get label font.
582
584{
585 Int_t ax = AxisChoice(axis);
586 if (ax < 0) return 0;
587 return fAxis[ax].GetLabelFont();
588}
589
590////////////////////////////////////////////////////////////////////////////////
591/// Get label offset.
592
594{
595 Int_t ax = AxisChoice(axis);
596 if (ax < 0) return 0;
597 return fAxis[ax].GetLabelOffset();
598}
599
600////////////////////////////////////////////////////////////////////////////////
601/// Get label size.
602
604{
605 Int_t ax = AxisChoice(axis);
606 if (ax < 0) return 0;
607 return fAxis[ax].GetLabelSize();
608}
609
610////////////////////////////////////////////////////////////////////////////////
611/// Get tick mark length.
612
614{
615 Int_t ax = AxisChoice(axis);
616 if (ax < 0) return 0;
617 return fAxis[ax].GetTickLength();
618}
619
620////////////////////////////////////////////////////////////////////////////////
621/// Get title offset.
622
624{
625 Int_t ax = AxisChoice(axis);
626 if (ax < 0) return 0;
627 return fAxis[ax].GetTitleOffset();
628}
629
630////////////////////////////////////////////////////////////////////////////////
631
632#define AXISCHOICE \
633 Int_t i = AxisChoice(axis); \
634 Int_t nax = 1; \
635 if (i == -1) { i = 0; nax = 3;}\
636 for (Int_t ax=i;ax<nax+i;ax++)
637
638////////////////////////////////////////////////////////////////////////////////
639/// Set number of divisions.
640
645
646////////////////////////////////////////////////////////////////////////////////
647/// Set axis color.
648
650{
652}
653
654////////////////////////////////////////////////////////////////////////////////
655/// Set axis range.
656
658{
659 Int_t ax = AxisChoice(axis);
660 if (ax < 0) return;
661 TAxis *theAxis = &fAxis[ax];
662 Int_t bin1 = theAxis->FindBin(xmin);
663 Int_t bin2 = theAxis->FindBin(xmax);
664 theAxis->SetRange(bin1, bin2);
665}
666
667////////////////////////////////////////////////////////////////////////////////
668/// Set label color.
669
671{
672 AXISCHOICE { fAxis[ax].SetLabelColor(color); }
673}
674
675////////////////////////////////////////////////////////////////////////////////
676/// Set label font.
677
679{
680 AXISCHOICE { fAxis[ax].SetLabelFont(font); }
681}
682
683////////////////////////////////////////////////////////////////////////////////
684/// Set label offset.
685
690
691////////////////////////////////////////////////////////////////////////////////
692/// Set label size.
693
698
699////////////////////////////////////////////////////////////////////////////////
700/// Set tick mark length.
701
706
707////////////////////////////////////////////////////////////////////////////////
708/// Set title offset.
709
714#undef AXISCHOICE
715
716////////////////////////////////////////////////////////////////////////////////
717/// Returns the "pad" Axis3D object pointer if any.
718
720{
721 TObject *obj = nullptr;
723 if (!thisPad) thisPad = gPad;
724 if (thisPad) {
725 // Find axis in the current thisPad
726 obj = thisPad->FindObject(TAxis3D::fgRulerName);
727 if (!(obj && obj->InheritsFrom(Class()->GetName()))) obj = nullptr;
728 }
729 return (TAxis3D *)obj;
730}
731
732////////////////////////////////////////////////////////////////////////////////
733/// Turn ON / OFF the "Ruler", TAxis3D object attached
734/// to the current pad
735
737{
738 TAxis3D *ax = nullptr;
740 if (!thisPad) thisPad = gPad;
741 if (thisPad && thisPad->GetView() ) {
743 if (a) delete a;
744 else {
745 ax = new TAxis3D;
746 ax->SetBit(kCanDelete);
747 ax->Draw();
748 }
749 thisPad->Modified();
750 thisPad->Update();
751 }
752 return ax;
753}
754
755////////////////////////////////////////////////////////////////////////////////
756/// Turn ON / OFF the "Ruler" and "zoom mode" of the TAxis3D object attached
757/// to the current pad (if pad = 0; gPad is used "by default")
758///
759/// User is given a chance to either:
760/// 1. move the center of the 3D scene at the cursor position
761/// 2. zoom view with mouse "drugging" the bounder rectangle with "left" mouse
762/// 3. Change the axis attributes via TContextMenu with "right mouse button click"
763
765{
766 TAxis3D *ax = nullptr;
768 if (!thisPad) thisPad = gPad;
769 if (thisPad && thisPad->GetView()) {
770 // Find axis in the current thisPad
771 TList *l = thisPad->GetListOfPrimitives();
773 if (o && o->InheritsFrom(Class()->GetName())) { // Find axis
774 if (o != l->Last()) { // make sure the TAxis3D is the last object of the Pad.
775 l->Remove(o);
776 l->AddLast(o);
777 }
778 ax = (TAxis3D *)o;
779 } else { // There is no
780 ax = new TAxis3D;
781 ax->SetBit(kCanDelete);
782 ax->Draw();
783 }
784 ax->SwitchZoom();
785 }
786 return ax;
787}
@ kButton1Motion
Definition Buttons.h:20
@ kButton1Up
Definition Buttons.h:19
@ kButton1Down
Definition Buttons.h:17
@ kCross
Definition GuiTypes.h:375
#define b(i)
Definition RSha256.hxx:100
#define a(i)
Definition RSha256.hxx:99
cudaEvent_t event
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
short Style_t
Style number (short)
Definition RtypesCore.h:97
short Color_t
Color number (short)
Definition RtypesCore.h:100
char Char_t
Character 1 byte (char)
Definition RtypesCore.h:52
float Float_t
Float 4 bytes (float)
Definition RtypesCore.h:72
constexpr Bool_t kFALSE
Definition RtypesCore.h:109
constexpr Bool_t kTRUE
Definition RtypesCore.h:108
const char Option_t
Option string (const char)
Definition RtypesCore.h:81
#define BIT(n)
Definition Rtypes.h:90
@ kRed
Definition Rtypes.h:66
@ kGreen
Definition Rtypes.h:66
@ kBlue
Definition Rtypes.h:66
#define AXISCHOICE
Definition TAxis3D.cxx:632
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h offset
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t r
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h length
Option_t Option_t TPoint TPoint const char x2
Option_t Option_t TPoint TPoint const char x1
Option_t Option_t TPoint TPoint const char y2
Option_t Option_t TPoint TPoint const char y1
float xmin
float xmax
R__EXTERN TStyle * gStyle
Definition TStyle.h:442
#define gPad
#define gVirtualX
Definition TVirtualX.h:379
virtual Color_t GetLabelColor() const
Definition TAttAxis.h:39
virtual Int_t GetNdivisions() const
Definition TAttAxis.h:37
virtual Color_t GetAxisColor() const
Definition TAttAxis.h:38
virtual void SetTitleOffset(Float_t offset=1)
Set distance between the axis and the axis title.
Definition TAttAxis.cxx:279
virtual Float_t GetLabelOffset() const
Definition TAttAxis.h:41
virtual void SetAxisColor(Color_t color=1, Float_t alpha=1.)
Set color of the line axis and tick marks.
Definition TAttAxis.cxx:141
virtual void SetLabelSize(Float_t size=0.04)
Set size of axis labels.
Definition TAttAxis.cxx:184
virtual Style_t GetLabelFont() const
Definition TAttAxis.h:40
virtual void SetLabelOffset(Float_t offset=0.005)
Set distance between the axis and the labels.
Definition TAttAxis.cxx:172
virtual void SetLabelFont(Style_t font=62)
Set labels' font.
Definition TAttAxis.cxx:161
virtual Float_t GetLabelSize() const
Definition TAttAxis.h:42
virtual Float_t GetTickLength() const
Definition TAttAxis.h:46
virtual void ResetAttAxis(Option_t *option="")
Reset axis attributes.
Definition TAttAxis.cxx:78
virtual Float_t GetTitleOffset() const
Definition TAttAxis.h:44
virtual void SetTickLength(Float_t length=0.03)
Set tick mark length.
Definition TAttAxis.cxx:265
virtual void SetNdivisions(Int_t n=510, Bool_t optim=kTRUE)
Set the number of divisions for this axis.
Definition TAttAxis.cxx:214
virtual void SetLabelColor(Color_t color=1, Float_t alpha=1.)
Set color of labels.
Definition TAttAxis.cxx:151
virtual void SetLineWidth(Width_t lwidth)
Set the line width.
Definition TAttLine.h:47
virtual void SetLineColor(Color_t lcolor)
Set the line color.
Definition TAttLine.h:44
virtual void SetTextColor(Color_t tcolor=1)
Set the text color.
Definition TAttText.h:50
virtual void SetTextFont(Font_t tfont=62)
Set the text font.
Definition TAttText.h:52
The 3D axis painter class.
Definition TAxis3D.h:31
static TAxis3D * ToggleRulers(TVirtualPad *pad=nullptr)
Turn ON / OFF the "Ruler", TAxis3D object attached to the current pad.
Definition TAxis3D.cxx:736
virtual Float_t GetLabelSize(Option_t *axis="X") const
Get label size.
Definition TAxis3D.cxx:603
Bool_t SwitchZoom()
Definition TAxis3D.h:113
virtual void SetNdivisions(Int_t n=510, Option_t *axis="*")
Set number of divisions.
Definition TAxis3D.cxx:641
void UseCurrentStyle() override
Replace current attributes by current style.
Definition TAxis3D.cxx:488
void Paint(Option_t *option="") override
Paint axis over 3D view on the TPad.
Definition TAxis3D.cxx:308
void PaintAxis(TGaxis *axis, Float_t ang)
Draw the axis for TView object.
Definition TAxis3D.cxx:321
virtual void SetLabelOffset(Float_t offset=0.005, Option_t *axis="*")
Set label offset.
Definition TAxis3D.cxx:686
void Browse(TBrowser *b) override
Add all 3 axes to the TBrowser.
Definition TAxis3D.cxx:163
virtual void SetLabelFont(Style_t font=62, Option_t *axis="*")
Set label font.
Definition TAxis3D.cxx:678
TAxis fAxis[3]
Definition TAxis3D.h:38
virtual Style_t GetLabelFont(Option_t *axis="X") const
Get label font.
Definition TAxis3D.cxx:583
void SavePrimitive(std::ostream &out, Option_t *option="") override
Save primitive as a C++ statement(s) on output stream out.
Definition TAxis3D.cxx:478
void ExecuteEvent(Int_t event, Int_t px, Int_t py) override
Execute action corresponding to one event.
Definition TAxis3D.cxx:189
Int_t DistancetoPrimitive(Int_t px, Int_t py) override
Compute distance from point px,py to a line.
Definition TAxis3D.cxx:171
virtual Float_t GetLabelOffset(Option_t *axis="X") const
Get label offset.
Definition TAxis3D.cxx:593
virtual void SetAxisRange(Double_t xmin, Double_t xmax, Option_t *axis="*")
Set axis range.
Definition TAxis3D.cxx:657
virtual Float_t GetTickLength(Option_t *axis="X") const
Get tick mark length.
Definition TAxis3D.cxx:613
virtual void SetLabelSize(Float_t size=0.02, Option_t *axis="*")
Set label size.
Definition TAxis3D.cxx:694
Int_t AxisChoice(Option_t *axis) const
Return the axis index by its name.
Definition TAxis3D.cxx:541
static TClass * Class()
static TAxis3D * GetPadAxis(TVirtualPad *pad=nullptr)
Returns the "pad" Axis3D object pointer if any.
Definition TAxis3D.cxx:719
virtual Color_t GetAxisColor(Option_t *axis="X") const
Get axis color.
Definition TAxis3D.cxx:563
virtual void SetAxisColor(Color_t color=1, Option_t *axis="*")
Set axis color.
Definition TAxis3D.cxx:649
char * GetObjectInfo(Int_t px, Int_t py) const override
Dummy method returns the const char * to "axis3d".
Definition TAxis3D.cxx:300
virtual Color_t GetLabelColor(Option_t *axis="X") const
Get label color.
Definition TAxis3D.cxx:573
Bool_t fZoomMode
Definition TAxis3D.h:42
virtual Float_t GetTitleOffset(Option_t *axis="X") const
Get title offset.
Definition TAxis3D.cxx:623
static TAxis3D * ToggleZoom(TVirtualPad *pad=nullptr)
Turn ON / OFF the "Ruler" and "zoom mode" of the TAxis3D object attached to the current pad (if pad =...
Definition TAxis3D.cxx:764
void InitSet()
Initialization.
Definition TAxis3D.cxx:148
virtual Int_t GetNdivisions(Option_t *axis="X") const
Get number of divisions.
Definition TAxis3D.cxx:553
void Copy(TObject &hnew) const override
Copy axis3d.
Definition TAxis3D.cxx:138
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:702
virtual void SetLabelColor(Color_t color=1, Option_t *axis="*")
Set label color.
Definition TAxis3D.cxx:670
Bool_t fStickyZoom
Definition TAxis3D.h:43
TAxis3D()
Normal constructor.
Definition TAxis3D.cxx:108
static Double_t * PixeltoXYZ(Double_t px, Double_t py, Double_t *point3D, TView *view=nullptr)
Convert "screen pixel" coordinates to some center of 3D WC coordinate if view and gPad present.
Definition TAxis3D.cxx:455
virtual void SetTitleOffset(Float_t offset=1, Option_t *axis="*")
Set title offset.
Definition TAxis3D.cxx:710
TAxis * fSelected
! The selected axis to play with
Definition TAxis3D.h:41
Class to manage histogram axis.
Definition TAxis.h:32
const char * GetTitle() const override
Returns title of object.
Definition TAxis.h:137
Int_t DistancetoPrimitive(Int_t px, Int_t py) override
Compute distance from point px,py to an axis.
Definition TAxis.cxx:260
void ExecuteEvent(Int_t event, Int_t px, Int_t py) override
Execute action corresponding to one event.
Definition TAxis.cxx:276
virtual void Set(Int_t nbins, Double_t xmin, Double_t xmax)
Initialize axis with fix bins.
Definition TAxis.cxx:790
void SaveAttributes(std::ostream &out, const char *name, const char *subname) override
Save axis attributes as C++ statement(s) on output stream out.
Definition TAxis.cxx:715
Using a TBrowser one can browse all ROOT objects.
Definition TBrowser.h:37
The axis painter class.
Definition TGaxis.h:26
void SetTimeFormat(const char *tformat)
Change the format used for time plotting.
Definition TGaxis.cxx:2937
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:1006
void SetTitleOffset(Float_t titleoffset=1)
Definition TGaxis.h:130
void SetLabelFont(Int_t labelfont)
Definition TGaxis.h:107
void SetTitleSize(Float_t titlesize)
Definition TGaxis.h:131
virtual void SetTitle(const char *title="")
Change the title of the axis.
Definition TGaxis.cxx:2910
void SetLabelOffset(Float_t labeloffset)
Definition TGaxis.h:108
void SetLabelColor(Int_t labelcolor)
Definition TGaxis.h:106
void SetTickSize(Float_t ticksize)
Definition TGaxis.h:124
void SetLabelSize(Float_t labelsize)
Definition TGaxis.h:109
void SetOption(Option_t *option="")
To set axis options.
Definition TGaxis.cxx:2902
A doubly linked list.
Definition TList.h:38
The TNamed class is the base class for all named ROOT classes.
Definition TNamed.h:29
void Copy(TObject &named) const override
Copy this to obj.
Definition TNamed.cxx:93
virtual void SetTitle(const char *title="")
Set the title of the TNamed.
Definition TNamed.cxx:173
const char * GetName() const override
Returns name of object.
Definition TNamed.h:49
const char * GetTitle() const override
Returns title of object.
Definition TNamed.h:50
virtual void SetName(const char *name)
Set the name of the TNamed.
Definition TNamed.cxx:149
Mother of all ROOT objects.
Definition TObject.h:42
R__ALWAYS_INLINE Bool_t TestBit(UInt_t f) const
Definition TObject.h:204
virtual TObject * FindObject(const char *name) const
Must be redefined in derived classes.
Definition TObject.cxx:424
void SetBit(UInt_t f, Bool_t set)
Set or unset the user status bits as specified in f.
Definition TObject.cxx:886
virtual Bool_t InheritsFrom(const char *classname) const
Returns kTRUE if object inherits from class "classname".
Definition TObject.cxx:548
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
Definition TObject.cxx:1096
@ kCanDelete
if object in a list can be deleted
Definition TObject.h:71
The most important graphics class in the ROOT system.
Definition TPad.h:32
void SetAxisColor(Color_t color=1, Option_t *axis="X")
Set color to draw the axis line and tick marks.
Definition TStyle.cxx:1324
Bool_t IsReading() const
Definition TStyle.h:300
void SetTitleFont(Style_t font=62, Option_t *axis="X")
Definition TStyle.cxx:1776
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:1799
void SetTitleColor(Color_t color=1, Option_t *axis="X")
Definition TStyle.cxx:1755
void SetLabelFont(Style_t font=62, Option_t *axis="X")
Set font number used to draw axis labels.
Definition TStyle.cxx:1414
void SetLabelOffset(Float_t offset=0.005, Option_t *axis="X")
Set offset between axis and axis labels.
Definition TStyle.cxx:1430
void SetTitleSize(Float_t size=0.02, Option_t *axis="X")
Definition TStyle.cxx:1818
void SetTickLength(Float_t length=0.03, Option_t *axis="X")
Set the tick marks length for an axis.
Definition TStyle.cxx:1736
void SetNdivisions(Int_t n=510, Option_t *axis="X")
Set the number of divisions to draw an axis.
Definition TStyle.cxx:1310
void SetLabelColor(Color_t color=1, Option_t *axis="X")
Set axis labels color.
Definition TStyle.cxx:1394
void SetLabelSize(Float_t size=0.04, Option_t *axis="X")
Set size of axis labels.
Definition TStyle.cxx:1445
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
Double_t x[n]
Definition legend1.C:17
const Int_t n
Definition legend1.C:16
Short_t Max(Short_t a, Short_t b)
Returns the largest of a and b.
Definition TMathBase.h:249
Double_t ATan(Double_t)
Returns the principal value of the arc tangent of x, expressed in radians.
Definition TMath.h:653
LongDouble_t Power(LongDouble_t x, LongDouble_t y)
Returns x raised to the power y.
Definition TMath.h:734
Double_t Cos(Double_t)
Returns the cosine of an angle of x radians.
Definition TMath.h:607
Double_t Sin(Double_t)
Returns the sine of an angle of x radians.
Definition TMath.h:601
Short_t Abs(Short_t d)
Returns the absolute value of parameter Short_t d.
Definition TMathBase.h:122
TLine l
Definition textangle.C:4