175 for (
int i=0;i<3;i++) {
200 static Int_t pxold, pyold;
201 static Int_t px0, py0;
202 static Int_t linedrawn;
214 gPad->TAttLine::Modify();
215 ((
TPad *)
gPad)->AbsPixeltoXY(px,py,x0,y0);
217 pxold = px; pyold = py;
231 gPad->SetDoubleBuffer(1);
236 Double_t min[3],max[3],viewCenter[3],viewCenterNDC[3];
239 for (i =0; i<3;i++) viewCenter[i] = (max[i]+min[i])/2;
240 view->
WCtoNDC(viewCenter,viewCenterNDC);
242 Double_t center[3],pointNDC[3],size[3],oldSize[3];
243 ((
TPad *)
gPad)->AbsPixeltoXY(px,py,x1,y1);
244 pointNDC[0] = (x0+
x1)/2; pointNDC[1] = (y0+y1)/2;
245 pointNDC[2] = viewCenterNDC[2];
246 view->
NDCtoWC(pointNDC, center);
248 for (i =0; i<3;i++) oldSize[i] = size[i]= (max[i]-min[i])/2;
253 for (i =0; i<3;i++) size[i] = -1;
255 pointNDC[0] = x0; pointNDC[1] = y0;
257 view->
NDCtoWC(pointNDC, newEdge);
258 for (i =0; i<3;i++) {
260 if ( newSize/oldSize[i] > 0.002)
263 size[i] = oldSize[i];
266 pointNDC[0] =
x1; pointNDC[1] = y1;
268 view->
NDCtoWC(pointNDC, newEdge);
269 for (i =0; i<3;i++) {
271 if ( newSize/oldSize[i] > 0.002)
274 size[i] = oldSize[i];
277 if (fZooms == kMAXZOOMS) fZoom = 0;
279 memcpy(fZoomMin[fZooms],min,3*
sizeof(
Float_t));
280 memcpy(fZoomMax[fZooms],max,3*
sizeof(
Float_t));
283 for (i =0; i<3;i++) {
284 max[i] = center[i] + size[i];
285 min[i] = center[i] - size[i];
304 return (
char*)
"axis3d";
331 Double_t x1[3],
x2[3], y1[3], y2[3], z1[3], z2[3], av[24] ;
333 Int_t ix1, ix2, iy1, iy2, iz1, iz2;
338 Error(
"PaintAxis",
"no TView in current pad");
346 view->
AxisVertex(ang, av, ix1, ix2, iy1, iy2, iz1, iz2);
347 for (i = 1; i <= 8; ++i) {
348 r[i*3 - 3] = av[i*3 - 3] + av[i*3 - 2]*cosa;
349 r[i*3 - 2] = av[i*3 - 2]*sina;
350 r[i*3 - 1] = av[i*3 - 1];
353 view->
WCtoNDC(&r[ix1*3 - 3], x1);
354 view->
WCtoNDC(&r[ix2*3 - 3], x2);
355 view->
WCtoNDC(&r[iy1*3 - 3], y1);
356 view->
WCtoNDC(&r[iy2*3 - 3], y2);
357 view->
WCtoNDC(&r[iz1*3 - 3], z1);
358 view->
WCtoNDC(&r[iz2*3 - 3], z2);
372 memset(chopax,0,
sizeof(chopax));
375 ax[0] = x1[0]; ax[1] = x2[0];
376 ay[0] = x1[1]; ay[1] = x2[1];
377 logAx =
gPad->GetLogx();
380 if (
TMath::Abs(y1[0] - y2[0]) < epsil) y2[0] = y1[0];
381 ax[0] = y1[0]; ax[1] = y2[0];
382 ay[0] = y1[1]; ay[1] = y2[1];
383 logAx =
gPad->GetLogy();
386 ax[0] = z1[0]; ax[1] = z2[0];
387 ay[0] = z1[1]; ay[1] = z2[1];
388 strlcpy(chopax,
"SDH+=",10);
389 logAx =
gPad->GetLogz();
400 if (ax[0] > ax[1]) strlcpy(chopax,
"SDHV=+",10);
401 else strlcpy(chopax,
"SDHV=-",10);
405 strlcpy(chopax,
"SDH+=",10);
409 strlcat(chopax,
"G",10);
428 enum { kCenterTitle =
BIT(12) };
440 if (
fAxis[i].GetTimeDisplay()) {
441 strlcat(chopax,
"t",10);
442 if (strlen(
fAxis[i].GetTimeFormatOnly()) == 0) {
449 axis->
PaintAxis(ax[0], ay[0], ax[1], ay[1], bmin, bmax, ndiv, chopax);
460 if (!view &&
gPad) view =
gPad->GetView();
466 for (i =0; i<3;i++) min[i] = (max[i]+min[i])/2;
468 min[0] = x[0]; min[1] = x[1];
471 for (i=0;i<3;i++) point3D[i] = x[i];
545 char achoice = toupper(axis[0]);
546 if (achoice ==
'X')
return 0;
547 if (achoice ==
'Y')
return 1;
548 if (achoice ==
'Z')
return 2;
558 if (ax < 0)
return 0;
568 if (ax < 0)
return 0;
578 if (ax < 0)
return 0;
588 if (ax < 0)
return 0;
598 if (ax < 0)
return 0;
608 if (ax < 0)
return 0;
618 if (ax < 0)
return 0;
628 if (ax < 0)
return 0;
635 Int_t i = AxisChoice(axis); \ 637 if (i == -1) { i = 0; nax = 3;}\ 638 for (Int_t ax=i;ax<nax+i;ax++) 725 if (!thisPad) thisPad =
gPad;
742 if (!thisPad) thisPad =
gPad;
743 if (thisPad && thisPad->
GetView() ) {
770 if (!thisPad) thisPad =
gPad;
771 if (thisPad && thisPad->
GetView()) {
776 if (o != l->
Last()) {
virtual Int_t DistancetoPrimitive(Int_t px, Int_t py)
Compute distance from point px,py to an axis.
void Add(TObject *obj, const char *name=0, Int_t check=-1)
Add object with name to browser.
virtual void SetTitleOffset(Float_t offset=1)
Set distance between the axis and the axis title Offset is a correction factor with respect to the "s...
virtual const char * GetName() const
Returns name of object.
Int_t AxisChoice(Option_t *axis) const
Return the axis index by its name.
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...
virtual void SetLineWidth(Width_t lwidth)
Set the line width.
virtual Float_t GetTickLength() const
double dist(Rotation3D const &r1, Rotation3D const &r2)
virtual void SaveAttributes(std::ostream &out, const char *name, const char *subname)
Save axis attributes as C++ statement(s) on output stream out.
TAxis3D()
Normal constructor.
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 =...
static TAxis3D * ToggleRulers(TVirtualPad *pad=0)
Turn ON / OFF the "Ruler", TAxis3D object attached to the current pad.
void PaintAxis(TGaxis *axis, Float_t ang)
Draw the axis for TView object.
virtual void WCtoNDC(const Float_t *pw, Float_t *pn)=0
virtual Float_t GetLabelOffset() const
void SetLabelFont(Style_t font=62, Option_t *axis="X")
Set font number used to draw axis labels.
virtual Double_t * GetRmax()=0
virtual Float_t GetLabelSize(Option_t *axis="X") const
Get label size.
virtual Style_t GetLabelFont(Option_t *axis="X") const
Get label font.
virtual void ResetAttAxis(Option_t *option="")
Reset axis attributes.
void SetAxisColor(Color_t color=1, Option_t *axis="X")
Set color to draw the axis line and tick marks.
R__EXTERN TStyle * gStyle
virtual void SetName(const char *name)
Set the name of the TNamed.
virtual Color_t GetAxisColor() const
virtual void SetNdivisions(Int_t n=510, Option_t *axis="*")
Set number of divisions.
virtual void SetLabelColor(Color_t color=1, Float_t alpha=1.)
Set color of labels.
virtual Float_t GetTickLength(Option_t *axis="X") const
Get tick mark length.
virtual Float_t GetLabelOffset(Option_t *axis="X") const
Get label offset.
virtual void SetLabelColor(Color_t color=1, Option_t *axis="*")
Set label color.
virtual void SetNdivisions(Int_t n=510, Bool_t optim=kTRUE)
Set the number of divisions for this axis.
virtual TObject * Last() const
Return the last object in the list. Returns 0 when list is empty.
virtual void ExecuteEvent(Int_t event, Int_t px, Int_t py)
Execute action corresponding to one event.
virtual void SetRange(const Double_t *min, const Double_t *max)=0
R__ALWAYS_INLINE Bool_t TestBit(UInt_t f) const
virtual void SetTitle(const char *title="")
Change the title of the axis.
void SetTitleFont(Style_t font=62, Option_t *axis="X")
static const char * fgRulerName
virtual void Draw(Option_t *option="")
Default Draw method for all objects.
virtual void SetLabelSize(Float_t size=0.02, Option_t *axis="*")
Set label size.
virtual Float_t GetLabelSize() const
void InitSet()
Initialization.
The 3D axis painter class.
static constexpr double rad
virtual void SetTitleOffset(Float_t offset=1, Option_t *axis="*")
Set title offset.
virtual void NDCtoWC(const Float_t *pn, Float_t *pw)=0
virtual void SetLabelOffset(Float_t offset=0.005)
Set distance between the axis and the labels The distance is expressed in per cent of the pad width...
Bool_t fZoomMode
The selected axis to play with.
virtual void AddLast(TObject *obj)
Add object at the end of the list.
LongDouble_t Power(LongDouble_t x, LongDouble_t y)
void SetBit(UInt_t f, Bool_t set)
Set or unset the user status bits as specified in f.
virtual TObject * FindObject(const char *name) const
Delete a TObjLink object.
if object in a list can be deleted
void SetNdivisions(Int_t n=510, Option_t *axis="X")
Set the number of divisions to draw an axis.
virtual void SetLabelFont(Style_t font=62)
Set labels' font.
virtual void SetLabelFont(Style_t font=62, Option_t *axis="*")
Set label font.
void SetTitleSize(Float_t size=0.02, Option_t *axis="X")
void SetTitleSize(Float_t titlesize)
virtual void SetTextFont(Font_t tfont=62)
Set the text font.
static const double x2[5]
void SetLabelColor(Color_t color=1, Option_t *axis="X")
Set axis labels color.
The TNamed class is the base class for all named ROOT classes.
virtual void SetAxisColor(Color_t color=1, Option_t *axis="*")
Set axis color.
virtual Color_t GetAxisColor(Option_t *axis="X") const
Get axis color.
void SetOption(Option_t *option="")
To set axis options.
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
void SetTimeFormat(const char *tformat)
Change the format used for time plotting.
void UseCurrentStyle()
Replace current attributes by current style.
virtual void Copy(TObject &hnew) const
Copy axis3d.
TVirtualPad is an abstract base class for the Pad and Canvas classes.
virtual Color_t GetLabelColor(Option_t *axis="X") const
Get label color.
virtual Color_t GetLabelColor() const
void SetLabelSize(Float_t labelsize)
virtual TView * GetView() const =0
virtual Int_t GetNdivisions() const
void SetTitleColor(Color_t color=1, Option_t *axis="X")
virtual void ExecuteEvent(Int_t event, Int_t px, Int_t py)
Execute action corresponding to one event.
virtual void Browse(TBrowser *b)
Add all 3 axes to the TBrowser.
virtual void SetLineColor(Color_t lcolor)
Set the line color.
Using a TBrowser one can browse all ROOT objects.
virtual void SetRange(Int_t first=0, Int_t last=0)
Set the viewing range for the axis from bin first to last.
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.
virtual TObject * FindObject(const char *name) const
Must be redefined in derived classes.
virtual Float_t GetTitleOffset(Option_t *axis="X") const
Get title offset.
const char * GetTitle() const
Returns title of object.
Class to manage histogram axis.
virtual TObject * Remove(TObject *obj)
Remove object from the list.
virtual Bool_t InheritsFrom(const char *classname) const
Returns kTRUE if object inherits from class "classname".
virtual Float_t GetTitleOffset() const
The most important graphics class in the ROOT system.
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
void SetTickLength(Float_t length=0.03, Option_t *axis="X")
Set the tick marks length for an axis.
virtual char * GetObjectInfo(Int_t px, Int_t py) const
Dummy method returns the const char * to "axis3d".
virtual TList * GetListOfPrimitives() const =0
virtual void SetAxisColor(Color_t color=1, Float_t alpha=1.)
Set color of the line axis and tick marks.
virtual void SetAxisRange(Double_t xmin, Double_t xmax, Option_t *axis="*")
Set axis range.
virtual void SetLabelSize(Float_t size=0.04)
Set size of axis labels The size is expressed in per cent of the pad width.
virtual Double_t * GetRmin()=0
virtual Int_t FindBin(Double_t x)
Find bin number corresponding to abscissa x.
void SetLabelOffset(Float_t offset=0.005, Option_t *axis="X")
Set offset between axis and axis labels.
virtual void Modified(Bool_t flag=1)=0
virtual Int_t DistancetoPrimitive(Int_t px, Int_t py)
Compute distance from point px,py to a line.
void SetLabelOffset(Float_t labeloffset)
static const double x1[5]
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.
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
void SetLabelFont(Int_t labelfont)
virtual void SetTickLength(Float_t length=0.02, Option_t *axis="*")
Set tick mark length.
virtual Int_t GetNdivisions(Option_t *axis="X") const
Get number of divisions.
virtual void SetLabelOffset(Float_t offset=0.005, Option_t *axis="*")
Set label offset.
Mother of all ROOT objects.
void SetLabelSize(Float_t size=0.04, Option_t *axis="X")
Set size of axis labels.
static TAxis3D * GetPadAxis(TVirtualPad *pad=0)
Returns the "pad" Axis3D object pointer if any.
virtual void Copy(TObject &named) const
Copy this to obj.
virtual void SavePrimitive(std::ostream &out, Option_t *option="")
Save primitive as a C++ statement(s) on output stream out.
Short_t Max(Short_t a, Short_t b)
virtual void GetRange(Float_t *min, Float_t *max)=0
you should not use this method at all Int_t Int_t Double_t Double_t Double_t Int_t Double_t Double_t Double_t Double_t b
void SetTickSize(Float_t ticksize)
void SetLabelColor(Int_t labelcolor)
virtual void SetTickLength(Float_t length=0.03)
Set tick mark length The length is expressed in per cent of the pad width.
virtual void SetTextColor(Color_t tcolor=1)
Set the text color.
virtual void Set(Int_t nbins, Double_t xmin, Double_t xmax)
Initialize axis with fix bins.
void SetTitleOffset(Float_t titleoffset=1)
virtual void SetTitle(const char *title="")
Set the title of the TNamed.
virtual void Paint(Option_t *option="")
Paint axis over 3D view on the TPad.
virtual Style_t GetLabelFont() const
virtual const char * GetTitle() const
Returns title of object.