ROOT  6.06/08
Reference Guide
TSpectrum2Painter.cxx
Go to the documentation of this file.
1 // @(#)root/spectrumpainter:$Id: TSpectrum2Painter.cxx,v 1.00
2 // Author: Miroslav Morhac 29/09/06
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 
13 //______________________________________________________________________________
14 //
15 // Two-dimensional graphics function
16 //
17 // TSpectrum2Painter is a set of graphical functions developed by Miroslav
18 // Morhac to paint 2D-histograms in three dimensions. This package is accessed
19 // via THistPainter in a transparent way. For the ROOT user it is enough to use
20 // the "SPEC" option to draw a 2D-Histogram. This option offers many
21 // functionalities detailed in the header of the PaintSpectrum function.
22 //
23 // Reference:
24 // Morhac M., Kliman J., Matousek V., Turzo I.: Sophisticated visualization
25 // algorithms for analysis of multidimensional experimental nuclear data. Acta
26 // Pysica Slovaca Vol. 54/ 4 (2004), pp. 385-400.
27 
28 #include <climits>
29 
30 #include "TROOT.h"
31 #include "TClass.h"
32 #include "TClass.h"
33 #include "TColor.h"
34 #include "TMath.h"
35 #include "TLine.h"
36 #include "TEllipse.h"
37 #include "TPad.h"
38 #include "TBox.h"
39 #include "TF1.h"
40 #include "TH2.h"
41 #include "TGaxis.h"
42 #include "THLimitsFinder.h"
43 #include "TSpectrum2Painter.h"
44 
46 
47 
48 ////////////////////////////////////////////////////////////////////////////////
49 /// TSpectrum2Painter normal constructor
50 
52  : TNamed ("Spectrum Painter2","Miroslav Morhac Painter")
53 {
54  int i, j;
55  double val;
56  gPad->Range(0, 0, 1 ,1);
57  fXmin = 0;
58  fXmax = h2->GetNbinsX() - 1;
59  fYmin = 0;
60  fYmax = h2->GetNbinsY() - 1;
61  fZmin = 0, fZmax = 0;
62  fMaximumXScreenResolution = bs;
63 
64  for (i = 0;i <= fXmax; i++) {
65  for (j = 0;j <= fYmax; j++) {
66  val = h2->GetBinContent(i + 1,j + 1);
67  if (val > fZmax) fZmax = val;
68  }
69  }
70 
71  fBx1 = gPad->XtoPixel(0.1); //axis positions
72  fBx2 = gPad->XtoPixel(0.99);
73  fBy1 = gPad->YtoPixel(0.99);
74  fBy2 = gPad->YtoPixel(0.05);
75 
76  fModeGroup = kModeGroupLightHeight;
77 
78  fDisplayMode = kDisplayModeSurface;
79 
80  fZscale = kZScaleLinear; // Scale linear, log.
81 
82  fNodesx = fXmax-fXmin+1; // Number of nodes in x dimension of grid
83  fNodesy = fYmax-fYmin+1; // Number of nodes in y dimension of grid
84 
85  fContWidth = 50; // Width between contours,
86  // applies only for contours display mode.
87  fAlpha = 20; // Angles of display,alfa+beta must be less or equal to 90,
88  // alpha- angle between base line of Canvas and left lower
89  // edge of picture picture base plane
90  fBeta = 60; // Angle between base line of Canvas and right lower edge
91  // of picture base plane
92  fViewAngle = 0; // Rotation angle of the view,
93  // it can be 0, 90, 180, 270 degrees.
94 
95  fLevels = 256; // Number of color levels for rainbowed display modes,
96  // It does not apply for simple display modes
97  // algorithm group
98  fRainbow1Step = 1; // Determines the first component step for
99  // neighbouring color levels, applies only for
100  // rainbowed display modes, it does not apply for
101  // simple display modes algorithm group.
102  fRainbow2Step = 1; // Determines the second component step for
103  // neighbouring color levels, applies only for
104  // rainbowed display modes, it does not apply for
105  // simple display modes algorithm group.
106  fRainbow3Step = 1; // Determines the third component step for
107  // neighbouring color levels, applies only for
108  // rainbowed display modes, it does not apply for
109  // simple display modes algorithm group.
110 
111  fColorAlg = kColorAlgRgbSmooth; // Applies only for rainbowed display modes
112  // (rgb smooth alorithm, rgb modulo color
113  // component, cmy smooth algorithm, cmy
114  // modulo color component, cie smooth
115  // algorithm, cie modulo color component,
116  // yiq smooth algorithm, yiq modulo color
117  // component, hsv smooth algorithm, hsv
118  // modulo color component, it does not
119  // apply for simple display modes
120  // algorithm group.
121 
122  fLHweight = 0.5; // Weight between shading according to fictive light
123  // source and according to channels counts, applies only
124  // for kModeGroupLightHeight modes group.
125 
126  fXlight = 1000; // X position of fictive light source, applies only for
127  // rainbowed display modes with shading according to light.
128  fYlight = 1000; // Y position of fictive light source, applies only for
129  // rainbowed display modes with shading according to light.
130  fZlight = 1000; // Z position of fictive light source, applies only for
131  // rainbowed display modes with shading according to light.
132 
133  fShadow = kShadowsNotPainted; // Determines whether shadow will be drawn
134  // (no shadow, shadow), for rainbowed
135  // display modes with shading according to
136  // light.
137 
138  fShading = kShaded; // Determines whether the picture will shaded,
139  // smoothed (no shading, shading), for rainbowed
140  // display modes only.
141 
142  fBezier = kNoBezierInterpol; // Determines Bezier interpolation (applies
143  // only for simple display modes group for
144  // grid, x_lines, y_lines display modes).
145 
146  fPenColor = kBlack; // Color of spectrum.
147  fPenWidth = 1; // Width of line.
148  fPenDash = kPenStyleSolid; // Style of pen.
149 
150  fChanmarkEnDis = kChannelMarksNotDrawn; // Decides whether the channel
151  // marks are shown.
152  fChanmarkColor = kBlue; // Color of channel marks.
153  fChanmarkWidth = 8; // Width of channel marks.
154  fChanmarkHeight = 8; // Height of channel marks.
155  fChanmarkStyle = kChannelMarksStyleDot; // Style of channel marks.
156 
157  fChanlineEnDis = kChannelGridNotDrawn; // Decides whether the channel lines
158  // (grid) are shown.
159  fChanlineColor = kRed; // Color of channel marks.
160  fNewColor = 0;
161  fEnvelope = new Short_t [fMaximumXScreenResolution];
162  fEnvelopeContour = new Short_t [fMaximumXScreenResolution];
163  for (i=0;i<fMaximumXScreenResolution;i++) {
164  fEnvelope[i] = fBy2;
165  fEnvelopeContour[i] = fBy2;
166  }
167  fH2 = h2;
168 }
169 
170 
171 ////////////////////////////////////////////////////////////////////////////////
172 /// TSpectrum2Painter destructor
173 
175 {
176  TColor* col;
177  for (int i=0; i<256; i++) {
178  col = gROOT->GetColor(250+i);
179  if (col) delete col;
180  }
181  if (fEnvelope) delete [] fEnvelope;
182  if (fEnvelopeContour) delete [] fEnvelopeContour;
183 }
184 
185 
186 ////////////////////////////////////////////////////////////////////////////////
187 /// Reads out the value from histogram and calculates screen coordinates
188 ///
189 /// Parameters:
190 /// -it - node in x- direction
191 /// -jt - node in y- direction
192 /// -zmt - control variable
193 
195 {
196  Int_t lxt,lyt,ix,iy;
197  Double_t zf = 0;
198  Double_t p1,p2;
199  p1 = fXmin+fKx*(Double_t)it;
200  p2 = fYmin+fKy*(Double_t)jt;
201  ix = (Int_t)p1;
202  iy = (Int_t)p2;
203  fDxspline = p1;
204  fDyspline = p2;
205  if ((zmt==0)||(zmt==-3)||(zmt==-4)) {
206  zf = fH2->GetBinContent(ix+1,iy+1);
207  } else if (zmt==-2) zf = fZPresetValue;
208  if (zf<fZmin) zf = fZmin;
209  fZeq = zf;
210  switch (fZscale) {
211  case kZScaleLog:
212  if (zf>=1.0) zf = log(zf);
213  else zf = 0;
214  break;
215  case kZScaleSqrt:
216  if (zf>0) zf = sqrt(zf);
217  else zf = 0;
218  break;
219  }
220  lxt = (Int_t)(fTxx*(Double_t)it+fTxy*(Double_t)jt+fVx);
221  lyt = (Int_t)(fTyx*(Double_t)it+fTyy*(Double_t)jt+fTyz*zf+fVy);
222  if (lxt<fBx1) lxt = fBx1;
223  if (lxt>fBx2) lxt = fBx2;
224  if (lyt<fBy1) lyt = fBy1;
225  if (lyt>fBy2) lyt = fBy2;
226  fXt = lxt;
227  fYt = lyt;
228  fZ = zf;
229  return;
230 }
231 
232 
233 ////////////////////////////////////////////////////////////////////////////////
234 /// Calculates and returns color value for the surface triangle
235 /// given by function parameters:
236 /// -dx1,dy1,z1 coordinates of the first point in 3d space
237 /// -dx2,dy2,z2 coordinates of the second point in 3d space
238 /// -dx3,dy3,z3 coordinates of the third point in 3d space
239 
241  Double_t dx1, Double_t dy1, Double_t z1,
242  Double_t dx2, Double_t dy2, Double_t z2,
243  Double_t dx3, Double_t dy3, Double_t z3)
244 {
245  Double_t da,db,dc=0,dd,dl,dm,dn,xtaz,ytaz,ztaz,v=0,v1;
246  Double_t pi=3.1415927;
247  Int_t i;
248  switch (fZscale) {
249  case kZScaleLog:
250  if (z1>900) z1 = 900;
251  z1 = exp(z1);
252  if (z2>900) z2 = 900;
253  z2 = exp(z2);
254  if (z3>900) z3 = 900;
255  z3 = exp(z3);
256  break;
257  case kZScaleSqrt:
258  z1 = z1*z1;
259  z2 = z2*z2;
260  z3 = z3*z3;
261  break;
262  }
263  i = fViewAngle;
264  i = i/90;
265  if ((i==1)||(i==3)) {
266  da = dx1;
267  dx1 = dx2;
268  dx2 = da;
269  da = dy1;
270  dy1 = dy2;
271  dy2 = da;
272  da = z1;
273  z1 = z2;
274  z2 = da;
275  }
276  xtaz = (dx1+dx2+dx3)/3;
277  ytaz = (dy1+dy2+dy3)/3;
278  ztaz = (z1+z2+z3)/3;
280  dn = (Double_t)fZlight-ztaz;
281  dm = (Double_t)fYlight-ytaz;
282  dl = (Double_t)fXlight-xtaz;
283  da = (dy2-dy1)*(z3-z1)-(dy3-dy1)*(z2-z1);
284  db = (z2-z1)*(dx3-dx1)-(z3-z1)*(dx2-dx1);
285  dc = (dx2-dx1)*(dy3-dy1)-(dx3-dx1)*(dy2-dy1);
286  dd = (da*da+db*db+dc*dc)*(dl*dl+dm*dm+dn*dn);
287  dd = sqrt(dd);
288  if (dd!=0) v = (da*dl+db*dm+dc*dn)/dd;
289  else v = 0;
290  if (v<-1) v=-1;
291  if (v>1) v=1;
292  v = asin(v);
293  v = v+pi/2;
294  v = v/pi;
295  } else if (fModeGroup==kModeGroupHeight) {
296  da = fZmax-fZmin;
297  if (ztaz<fZmin) ztaz=fZmin;
298  if (ztaz>=fZmax) ztaz=fZmax-1;
299  db = ztaz-fZmin;
300  if (da!=0) {
301  switch (fZscale) {
302  case kZScaleLinear:
303  dc = db/da;
304  break;
305  case kZScaleLog:
306  if (da>=1) da=log(da);
307  if (db>=1) db=log(db);
308  if (da!=0) dc=db/da;
309  else dc=0;
310  break;
311  case kZScaleSqrt:
312  da = sqrt(da);
313  db = sqrt(db);
314  dc = db/da;
315  break;
316  }
317  } else {
318  dc=0;
319  }
320  i = (Int_t)dc;
321  v = dc-i;
322  } else if (fModeGroup==kModeGroupLightHeight) {
323  dn = (Double_t)fZlight-ztaz;
324  dm = (Double_t)fYlight-ytaz;
325  dl = (Double_t)fXlight-xtaz;
326  da = (dy2-dy1)*(z3-z1)-(dy3-dy1)*(z2-z1);
327  db = (z2-z1)*(dx3-dx1)-(z3-z1)*(dx2-dx1);
328  dc = (dx2-dx1)*(dy3-dy1)-(dx3-dx1)*(dy2-dy1);
329  dd = (da*da+db*db+dc*dc)*(dl*dl+dm*dm+dn*dn);
330  dd = sqrt(dd);
331  if (dd!=0) v = (da*dl+db*dm+dc*dn)/dd;
332  else v = 0;
333  if (v<-1) v=-1;
334  if (v>1) v=1;
335  v = asin(v);
336  v = v+pi/2;
337  v = v/pi;
338  da = fZmax-fZmin;
339  if (ztaz<fZmin) ztaz = fZmin;
340  if (ztaz>=fZmax) ztaz = fZmax-1;
341  db = ztaz-fZmin;
342  if (da!=0) {
343  switch (fZscale) {
344  case kZScaleLinear:
345  dc = db/da;
346  break;
347  case kZScaleLog:
348  if (da>=1) da = log(da);
349  if (db>=1) db = log(db);
350  if (da!=0) dc = db/da;
351  else dc = 0;
352  break;
353  case kZScaleSqrt:
354  da = sqrt(da);
355  db = sqrt(db);
356  dc = db/da;
357  break;
358  }
359  } else {
360  dc = 0;
361  }
362  i = (Int_t)dc;
363  v1 = dc-i;
364  v = fLHweight*v+(1-fLHweight)*v1;
365  }
367  da = 1.0/(Double_t)fLevels;
368  if (v<da) v = da;
369  } else {
370  da = 2.0/(Double_t)fLevels;
371  if (v<da) v = da;
372  }
373  return(v);
374 }
375 
376 
377 ////////////////////////////////////////////////////////////////////////////////
378 /// Determines whether the center of the triangle in 3-d space
379 /// given by function parameters:
380 /// -xtaz,ytaz,ztaz
381 /// is in shadow or not. If yes it return 1 otherwise it returns 0.
382 
384  Double_t ztaz,
385  Double_t shad_noise)
386 {
387  Int_t sx2,sy2,sz1,sz2,skrokx,skroky,xmax,ymax;
388  Double_t sx1,sy1;
389  Double_t pom1,pom2,sdx1=0,sdx2=0,sdy1,sdy2,spriz;
390  switch (fZscale) {
391  case kZScaleLog:
392  if (ztaz>900) ztaz = 900;
393  ztaz = exp(ztaz);
394  if (ztaz>32767) ztaz = 32767;
395  break;
396  case kZScaleSqrt:
397  ztaz = ztaz*ztaz;
398  break;
399  }
400  spriz = 0;
401  sx1 = xtaz;
402  sy1 = ytaz;
403  sz1 = (Int_t)ztaz;
404  sx2 = fXlight;
405  sy2 = fYlight;
406  sz2 = fZlight;
407  xmax = fXmax;
408  ymax = fYmax;
409  if (sx1!=sx2) {
410  if (sx1<sx2) skrokx = 1;
411  else skrokx = -1;
412  if (sy1<sy2) skroky = 1;
413  else skroky = -1;
414  pom1 = sx2-sx1;
415  pom2 = sy2-sy1;
416  if (TMath::Abs(pom1)>0.0000001) sdx1 = pom2/pom1;
417  pom1 = sx1;
418  pom2 = sy1;
419  sdy1 = pom2-sdx1*pom1;
420  pom1 = sx2-sx1;
421  pom2 = sz2-sz1;
422  if (TMath::Abs(pom1)>0.0000001) sdx2 = pom2/pom1;
423  pom1 = sx1;
424  pom2 = sz1;
425  sdy2 = pom2-sdx2*pom1;
426  spriz = 0;
427  pom1 = sx1;
428  pom2 = pom1*sdx1+sdy1;
429  sy1 = pom2;
430  for (;(sx1>(fXmin-skrokx)) && (sx1<(xmax-skrokx)) &&
431  (sy1>(fYmin-skroky)) && (sy1<(ymax-skroky)) &&
432  (spriz==0);sx1+=skrokx) {
433  pom1 = sx1;
434  pom2 = pom1*sdx1+sdy1;
435  sy1 = pom2+skroky;
436  if ((sy1>=fYmin)&&(sy1<=fYmax)) {
437  sz1 = (Int_t)(fH2->GetBinContent((Int_t)sx1+1,(Int_t)sy1+1));
438  pom2 = pom1*sdx2+sdy2;
439  sz2 = (Int_t)(pom2+shad_noise);
440  if (sz1>sz2) spriz = 1;
441  }
442  }
443  } else if (sy1!=sy2) {
444  if (sy1<sy2) skroky = 1;
445  else skroky = -1;
446  pom1 = sy2-sy1;
447  pom2 = sz2-sz1;
448  if (TMath::Abs(pom1)>0.0000001) sdx2 = pom2/pom1;
449  pom1 = sy1;
450  pom2 = sz1;
451  sdy2 = pom2-sdx2*pom1;
452  spriz = 0;
453  for (;(sy1>(fYmin-skroky)) && (sy1<(ymax-skroky)) &&
454  (spriz==0);sy1+=skroky) {
455  sz1 = (Int_t)(fH2->GetBinContent((Int_t)sx1+1,(Int_t)sy1+1));
456  pom1 = sy1;
457  pom2 = pom1*sdx2+sdy2;
458  sz2 = (Int_t)(pom2+shad_noise);
459  if (sz1>sz2) spriz=1;
460  }
461  }
462  return(spriz);
463 }
464 
465 
466 ////////////////////////////////////////////////////////////////////////////////
467 /// This function calculates color for one palette entry
468 /// given by function parameter ui. Other parameters
469 /// -ui1,ui2,ui3
470 /// represent r, g, b color components of the basic pen color.
471 
472 void TSpectrum2Painter::ColorModel(unsigned ui, unsigned ui1, unsigned ui2,
473  unsigned ui3)
474 {
475  unsigned long uinc1=0,uinc2=0,uinc3=0,upom,i;
476  Double_t a,b,c,d,h,v,s,f;
477  Int_t j,iv=ui;
478  Double_t red=0,green=0,blue=0;
479  if (iv<0) iv = 0;
480  else if (iv>255) iv = 255;
481  if (gROOT->GetColor(250+iv)) {
482  fNewColorIndex = 250+iv;
483  return;
484  }
485  if (fColorAlg%2==0) {
486  a = fRainbow1Step;
487  a = ui*a;
488  a = ui1+a;
489  if (a >= UINT_MAX) uinc1 = UINT_MAX;
490  else uinc1 = (unsigned)a;
491  upom = uinc1%256;
492  i = (uinc1-upom)/256;
493  if ((i%2)==0) uinc1 = upom;
494  else uinc1 = 255-upom;
495  b = fRainbow2Step;
496  b = ui*b;
497  b = ui2+b;
498  uinc2 = (Int_t)b;
499  upom = uinc2%256;
500  i = (uinc2-upom)/256;
501  if ((i%2)==0) uinc2 = upom;
502  else uinc2 = 255-upom;
503  c = fRainbow3Step;
504  c = ui*c;
505  c = ui3+c;
506  uinc3 = (Int_t)c;
507  upom = uinc3%256;
508  i = (uinc3-upom)/256;
509  if ((i%2)==0) uinc3 = upom;
510  else uinc3 = 255-upom;
512  uinc1 = 255-uinc1;
513  uinc2 = 255-uinc2;
514  uinc3 = 255-uinc3;
515  } else if (fColorAlg==kColorAlgCieSmooth) {
516  a = uinc1;
517  b = uinc2;
518  c = uinc3;
519  d = a+b+c;
520  if (d!=0) {
521  a = a/d;
522  b = b/d;
523  c = c/d;
524  }
525  red = a*255;
526  green = b*255;
527  blue = c*255;
528  uinc1 = (Int_t)red;
529  uinc2 = (Int_t)green;
530  uinc3 = (Int_t)blue;
531  } else if (fColorAlg==kColorAlgYiqSmooth) {
532  a = uinc1;
533  b = uinc2;
534  c = uinc3;
535  a = a/256;
536  b = b/256;
537  c = c/256;
538  red = a+0.956*b+0.62*c;
539  green = a-0.272*b-0.647*c;
540  blue = a-1.108*b+1.705*c;
541  if (red>=2) red = red-2;
542  else if (red>=1) red = 2-red;
543  if (green<0) green = -green;
544  if (blue>=2) blue = blue-2;
545  else if (blue>=1) blue = 2-blue;
546  else if (blue<-1) blue = 2+blue;
547  else if (blue<0) blue = -blue;
548  red = red*255;
549  green = green*255;
550  blue = blue*255;
551  uinc1 = (Int_t)red;
552  uinc2 = (Int_t)green;
553  uinc3 = (Int_t)blue;
554  } else if (fColorAlg==kColorAlgHvsSmooth) {
555  h = uinc1;
556  v = uinc2;
557  s = uinc3;
558  h = h/256;
559  v = v/256;
560  s = s/256;
561  if (s==0) {
562  red = v;
563  green = v;
564  blue = v;
565  } else {
566  if (h==1.0) h=0;
567  h = 6.0*h;
568  j = (Int_t)h;
569  f = h-j;
570  a = v*(1-s);
571  b = v*(1-s*f);
572  c = v*(1-s*(1-f));
573  switch (j) {
574  case 0:
575  red = v;
576  green = c;
577  blue = a;
578  break;
579  case 1:
580  red = b;
581  green = v;
582  blue = a;
583  break;
584  case 2:
585  red = a;
586  green = v;
587  blue = c;
588  break;
589  case 3:
590  red = a;
591  green = b;
592  blue = v;
593  break;
594  case 4:
595  red = c;
596  green = a;
597  blue = v;
598  break;
599  case 5:
600  red = v;
601  green = a;
602  blue = b;
603  break;
604  }
605  }
606  red = red*255;
607  green = green*255;
608  blue = blue*255;
609  uinc1 = (Int_t)red;
610  uinc2 = (Int_t)green;
611  uinc3 = (Int_t)blue;
612  }
613  ui = uinc1+uinc2*256+uinc3*65536;
614  } else if (fColorAlg%2==1) {
615  a = fRainbow1Step;
616  a = ui*a;
617  a = ui1/2+a;
618  uinc1 = (Int_t)a;
619  uinc1 = uinc1%256;
620  b = fRainbow2Step;
621  b = ui*b;
622  b = ui2/2+b;
623  uinc2 = (Int_t)b;
624  uinc2 = uinc2%256;
625  c = fRainbow3Step;
626  c = ui*c;
627  c = ui3/2+c;
628  uinc3 = (Int_t)c;
629  uinc3 = uinc3%256;
631  uinc1 = 255-uinc1;
632  uinc2 = 255-uinc2;
633  uinc3 = 255-uinc3;
634  } else if (fColorAlg==kColorAlgCieModulo) {
635  a = uinc1;
636  b = uinc2;
637  c = uinc3;
638  d = a+b+c;
639  if (d!=0) {
640  a = a/d;
641  b = b/d;
642  c = c/d;
643  }
644  red = a*255;
645  green = b*255;
646  blue = c*255;
647  uinc1 = (Int_t)red;
648  uinc2 = (Int_t)green;
649  uinc3 = (Int_t)blue;
650  } else if (fColorAlg==kColorAlgYiqModulo) {
651  a = uinc1;
652  b = uinc2;
653  c = uinc3;
654  a = a/256;
655  b = b/256;
656  c = c/256;
657  red = a+0.956*b+0.62*c;
658  green = a-0.272*b-0.647*c;
659  blue = a-1.108*b+1.705*c;
660  if (red>=2) red = red-2;
661  else if (red>=1) red = red-1;
662  if (green<0) green = 1+green;
663  if (blue>=2) blue = blue-2;
664  else if (blue>=1) blue = blue-1;
665  else if (blue<-1) blue = 2+blue;
666  else if (blue<0) blue = 1+blue;
667  red = red*255;
668  green = green*255;
669  blue = blue*255;
670  uinc1 = (Int_t)red;
671  uinc2 = (Int_t)green;
672  uinc3 = (Int_t)blue;
673  } else if (fColorAlg==kColorAlgHvsModulo) {
674  h = uinc1;
675  v = uinc2;
676  s = uinc3;
677  h = h/256;
678  v = v/256;
679  s = s/256;
680  if (s==0) {
681  red = v;
682  green = v;
683  blue = v;
684  } else {
685  if (h==1.0) h = 0;
686  h = 6.0*h;
687  j = (Int_t)h;
688  f = h-j;
689  a = v*(1-s);
690  b = v*(1-s*f);
691  c = v*(1-s*(1-f));
692  switch (j) {
693  case 0:
694  red = v;
695  green = c;
696  blue = a;
697  break;
698  case 1:
699  red = b;
700  green = v;
701  blue = a;
702  break;
703  case 2:
704  red = a;
705  green = v;
706  blue = c;
707  break;
708  case 3:
709  red = a;
710  green = b;
711  blue = v;
712  break;
713  case 4:
714  red = c;
715  green = a;
716  blue = v;
717  break;
718  case 5:
719  red = v;
720  green = a;
721  blue = b;
722  break;
723  }
724  }
725  red = red*255;
726  green = green*255;
727  blue = blue*255;
728  uinc1 = (Int_t)red;
729  uinc2 = (Int_t)green;
730  uinc3 = (Int_t)blue;
731  }
732  ui = uinc1+uinc2*256+uinc3*65536;
733  }
734  red = uinc1;
735  green = uinc2;
736  blue = uinc3;
737  red = red/255.0;
738  green = green/255.0;
739  blue = blue/255.0;
740  fNewColor = new TColor(250+iv,red,green,blue);
741  fNewColorIndex = 250+iv;
742  return;
743 }
744 
745 
746 ////////////////////////////////////////////////////////////////////////////////
747 /// This function is called from BezierBlend function.
748 
750 {
751  Int_t j,a;
752  a = 1;
753  for (j=i+1;j<=3;j++) a = a*j;
754  for (j=1;j<=3-i;j++) a = a/j;
755  return a;
756 }
757 
758 
759 ////////////////////////////////////////////////////////////////////////////////
760 /// This function calculates Bezier approximation.
761 
763 {
764  Int_t j;
765  Double_t v;
766  v = BezC(i);
767  for (j=1;j<=i;j++) v = v*bezf;
768  for (j=1;j<=3-i;j++) v = v*(1-bezf);
769  return v;
770 }
771 
772 
773 ////////////////////////////////////////////////////////////////////////////////
774 /// Calculates screen coordinates of the smoothed point.
775 /// Parameter bezf changes within the interval 0 to 1 in 0.1 steps.
776 
778 {
779  Int_t i;
780  Double_t b;
781  fGbezx = 0;
782  fGbezy = 0;
783  for (i=0;i<4;i++) {
784  b = BezierBlend(i,bezf);
785  fGbezx += fBzX[i]*b;
786  fGbezy += fBzY[i]*b;
787  }
788  return;
789 }
790 
791 
792 ////////////////////////////////////////////////////////////////////////////////
793 /// Ensures hidden surface removal.
794 
796 {
797  Int_t x,y,krok,xold=0,yold=0,prvy,yprv=0;
798  Double_t fx,fy,fx1,fy1;
799  if (y1<fBy1) y1 = fBy1;
800  if (y2<fBy1) y2 = fBy1;
801  if (x1==x2) {
802  if ((y1>=fEnvelope[x1]) && (y2>=fEnvelope[x1])) {
803  if (x1>0) {
804  if (y1<=fEnvelope[x1-1]||y2<=fEnvelope[x1-1]) {
805  if (y1>fEnvelope[x1-1]) y1 = fEnvelope[x1-1];
806  if (y2>fEnvelope[x1-1]) y2 = fEnvelope[x1-1];
807  fLine = 2;
808  fXs = x1;
809  fYs = y1;
810  fXe = x2;
811  fYe = y2;
812  return;
813  }
814  }
815  if (x1<fBx2) {
816  if (y1<=fEnvelope[x1+1]||y2<=fEnvelope[x1+1]) {
817  if (y1>fEnvelope[x1+1]) y1 = fEnvelope[x1+1];
818  if (y2>fEnvelope[x1+1]) y2 = fEnvelope[x1+1];
819  fLine = 2;
820  fXs = x1;
821  fYs = y1;
822  fXe = x2;
823  fYe = y2;
824  return;
825  }
826  }
827  fLine=0;
828  return;
829  }
830  if ((y1<fEnvelope[x1]) && (y2<fEnvelope[x1])) {
831  fLine = 2;
832  fXs = x1;
833  fYs = y1;
834  fXe = x2;
835  fYe = y2;
836  if (y1<y2) fEnvelope[x1] = y1;
837  else fEnvelope[x1] = y2;
838  return;
839  }
840  if (y1<y2) {
841  fLine = 2;
842  fXs = x1;
843  fYs = y1;
844  fXe = x1;
845  fYe = fEnvelope[x1];
846  fEnvelope[x1] = y1;
847  return;
848  } else {
849  fLine = 2;
850  fXs = x1;
851  fYs = y2;
852  fXe = x1;
853  fYe = fEnvelope[x1];
854  fEnvelope[x1] = y2;
855  return;
856  }
857  }
858  krok = (x1<x2)? 1:-1;
859  fLine = 0;
860  prvy = 0;
861  x = x1;
862  y = y1;
863 l1:
864  if (y<=fEnvelope[x]) {
865  xold = x;
866  yold = y;
867  if (fLine==0) {
868  fLine = 1;
869  if (prvy==1) {
870  if (yprv<=fEnvelope[x]) fYs = yprv;
871  else fYs = fEnvelope[x];
872  fXs = x;
873  } else {
874  fXs = x;
875  fYs = y;
876  }
877  }
878  if (x!=x2) fEnvelope[x] = y;
879  } else {
880  prvy = 1;
881  yprv = y;
882  if (fLine==1) {
883  fLine = 2;
884  fXe = xold;
885  fYe = yold;
886  }
887  }
888  if (x1==x2) {
889  if (y1!=y2) y += (y1<y2)? +1:-1;
890  if (y!=y2) goto l1;
891  } else {
892  x += krok;
893  fy1 = y2-y1;
894  fx1 = x2-x1;
895  fx = x-x1;
896  fy = fy1*fx/fx1;
897  y = (Int_t)(y1+fy);
898  if (((x<=x2)&&(x1<x2)) || ((x>=x2)&&(x1>x2))) goto l1;
899  }
900  return;
901 }
902 
903 
904 ////////////////////////////////////////////////////////////////////////////////
905 /// Ensures hidden surfuce removal for Bars, BarsX and BarsY
906 /// display modes.
907 
909 {
910  Int_t x,y,krok,xold=0,yold=0,prvy,xprv,yprv=0;
911  Double_t fx,fy,fx1,fy1;
912  if (x1==x2) {
913  if ((y1>=fEnvelope[x1]) && (y2>=fEnvelope[x1])) {
914  fLine = 0;
915  return;
916  }
917  if ((y1<fEnvelope[x1]) && (y2<fEnvelope[x1])) {
918  fLine = 2;
919  fXs = x1;
920  fYs = y1;
921  fXe = x2;
922  fYe = y2;
923  if (y1<y2) fEnvelope[x1] = y1;
924  else fEnvelope[x1] = y2;
925  return;
926  }
927  if (y1<y2) {
928  fLine = 2;
929  fXs = x1;
930  fYs = y1;
931  fXe = x1;
932  fYe = fEnvelope[x1];
933  fEnvelope[x1] = y1;
934  return;
935  } else {
936  fLine = 2;
937  fXs = x1;
938  fYs = y2;
939  fXe = x1;
940  fYe = fEnvelope[x1];
941  fEnvelope[x1] = y2;
942  return;
943  }
944  }
945  krok = (x1<x2)? 1:-1;
946  fLine = 0;
947  prvy = 0;
948  x = x1;
949  y = y1;
950 l1:
951  if (y<=fEnvelope[x]) {
952  xold = x;
953  yold = y;
954  if (fLine==0) {
955  fLine = 1;
956  if (prvy==1) {
957  xprv = x;
958  fXs = xprv;
959  fYs = yprv;
960  } else {
961  fXs = x;
962  fYs = y;
963  }
964  }
965  if (x!=x2) fEnvelope[x] = y;
966  } else {
967  prvy = 1;
968  xprv = x;
969  yprv = y;
970  if (fLine==1) {
971  fLine = 2;
972  fXe = xold;
973  fYe = yold;
974  }
975  }
976  if (x1==x2) {
977  if (y1!=y2) y+=(y1<y2)? +1:-1;
978  if (y!=y2) goto l1;
979  } else {
980  x += krok;
981  fy1 = y2-y1;
982  fx1 = x2-x1;
983  fx = x-x1;
984  fy = fy1*fx/fx1;
985  y = (Int_t)(y1+fy);
986  if (((x<=x2)&&(x1<x2)) || ((x>=x2)&&(x1>x2))) goto l1;
987  }
988  return;
989 }
990 
991 
992 ////////////////////////////////////////////////////////////////////////////////
993 /// Draws channel mark at the screen coordinates x, y. Width of
994 /// the mark is w, height is h and the type of the mark is determined by the
995 /// parameter type.
996 
998 {
999  TLine *line=new TLine();
1000  TEllipse *ellipse=new TEllipse();
1002  line->SetLineWidth(1);
1004  ellipse->SetLineColor(fChanmarkColor);
1005  ellipse->SetLineWidth(1);
1006  ellipse->SetLineStyle(kPenStyleSolid);
1007  switch (type) {
1008  case kChannelMarksStyleDot:
1009  ellipse->SetX1(gPad->PixeltoX(x));
1010  ellipse->SetY1(gPad->PixeltoY(y)+1);
1011  ellipse->SetR1(gPad->PixeltoX(w/2));
1012  ellipse->SetR2(gPad->PixeltoY(h/2));
1013  ellipse->SetPhimin(0);
1014  ellipse->SetPhimax(360);
1015  ellipse->SetTheta(0);
1016  ellipse->Paint("");
1017  break;
1019  line->PaintLine(gPad->PixeltoX(x-w/2),gPad->PixeltoY(y)+1,
1020  gPad->PixeltoX(x+w/2),gPad->PixeltoY(y)+1);
1021  line->PaintLine(gPad->PixeltoX(x) ,gPad->PixeltoY(y-h/2)+1,
1022  gPad->PixeltoX(x) ,gPad->PixeltoY(y+h/2+1)+1);
1023  break;
1025  line->PaintLine(gPad->PixeltoX(x-w/2) ,gPad->PixeltoY(y)+1,
1026  gPad->PixeltoX(x+w/2+1),gPad->PixeltoY(y)+1);
1027  line->PaintLine(gPad->PixeltoX(x) ,gPad->PixeltoY(y-h/2)+1,
1028  gPad->PixeltoX(x) ,gPad->PixeltoY(y+h/2+1)+1);
1029  line->PaintLine(gPad->PixeltoX(x-w/2) ,gPad->PixeltoY(y-h/2)+1,
1030  gPad->PixeltoX(x+w/2+1),gPad->PixeltoY(y+h/2+1)+1);
1031  line->PaintLine(gPad->PixeltoX(x-w/2) ,gPad->PixeltoY(y+h/2)+1,
1032  gPad->PixeltoX(x+w/2+1),gPad->PixeltoY(y-h/2-1)+1);
1033  break;
1035  line->PaintLine(gPad->PixeltoX(x-w/2),gPad->PixeltoY(y-h/2)+1,
1036  gPad->PixeltoX(x-w/2),gPad->PixeltoY(y+h/2)+1);
1037  line->PaintLine(gPad->PixeltoX(x-w/2),gPad->PixeltoY(y+h/2)+1,
1038  gPad->PixeltoX(x+w/2),gPad->PixeltoY(y+h/2)+1);
1039  line->PaintLine(gPad->PixeltoX(x+w/2),gPad->PixeltoY(y+h/2)+1,
1040  gPad->PixeltoX(x+w/2),gPad->PixeltoY(y-h/2)+1);
1041  line->PaintLine(gPad->PixeltoX(x+w/2),gPad->PixeltoY(y-h/2)+1,
1042  gPad->PixeltoX(x-w/2),gPad->PixeltoY(y-h/2)+1);
1043  break;
1044  case kChannelMarksStyleX:
1045  line->PaintLine(gPad->PixeltoX(x-w/2) ,gPad->PixeltoY(y-h/2)+1,
1046  gPad->PixeltoX(x+w/2+1),gPad->PixeltoY(y+h/2+1)+1);
1047  line->PaintLine(gPad->PixeltoX(x-w/2) ,gPad->PixeltoY(y+h/2)+1,
1048  gPad->PixeltoX(x+w/2+1),gPad->PixeltoY(y-h/2-1)+1);
1049  break;
1051  line->PaintLine(gPad->PixeltoX(x) ,gPad->PixeltoY(y-h/2)+1,
1052  gPad->PixeltoX(x-w/2),gPad->PixeltoY(y)+1);
1053  line->PaintLine(gPad->PixeltoX(x-w/2),gPad->PixeltoY(y)+1,
1054  gPad->PixeltoX(x) ,gPad->PixeltoY(y+h/2)+1);
1055  line->PaintLine(gPad->PixeltoX(x) ,gPad->PixeltoY(y+h/2)+1,
1056  gPad->PixeltoX(x+w/2),gPad->PixeltoY(y)+1);
1057  line->PaintLine(gPad->PixeltoX(x+w/2),gPad->PixeltoY(y)+1,
1058  gPad->PixeltoX(x) ,gPad->PixeltoY(y-h/2)+1);
1059  break;
1061  line->PaintLine(gPad->PixeltoX(x) ,gPad->PixeltoY(y-h/2)+1,
1062  gPad->PixeltoX(x-w/2),gPad->PixeltoY(y+h/2)+1);
1063  line->PaintLine(gPad->PixeltoX(x-w/2),gPad->PixeltoY(y+h/2)+1,
1064  gPad->PixeltoX(x+w/2),gPad->PixeltoY(y+h/2)+1);
1065  line->PaintLine(gPad->PixeltoX(x+w/2),gPad->PixeltoY(y+h/2)+1,
1066  gPad->PixeltoX(x) ,gPad->PixeltoY(y-h/2)+1);
1067  break;
1068  }
1069  delete line;
1070  delete ellipse;
1071  return;
1072 }
1073 
1074 
1075 ////////////////////////////////////////////////////////////////////////////////
1076 /// Calculates screen coordinates of the line given by two
1077 /// nodes for contours display mode. The line is given by two points
1078 /// xr, yr, xs, ys. Finally it draws the line.
1079 
1081  Double_t ys, TLine *line)
1082 {
1083  Int_t krok,xi,yi,xj,yj,a,b,as,bs,pr,ae,be;
1084  Double_t fx,fy,fx1,fy1;
1085  xi = (Int_t)(fTxx*(xr-fXmin)/fKx+fTxy*(yr-fYmin)/fKy+fVx);
1086  xj = (Int_t)(fTxx*(xs-fXmin)/fKx+fTxy*(ys-fYmin)/fKy+fVx);
1087  yi = (Int_t)(fTyx*(xr-fXmin)/fKx+fTyy*(yr-fYmin)/fKy+fTyz*fZ+fVy);
1088  yj = (Int_t)(fTyx*(xs-fXmin)/fKx+fTyy*(ys-fYmin)/fKy+fTyz*fZ+fVy);
1089  as = xi;
1090  bs = yi;
1091  ae = xj;
1092  be = yj;
1093  a = xi;
1094  b = yi;
1095  pr = 0;
1096  krok = (xi<xj)? 1:-1;
1097 l1:
1098  if (b<=fEnvelope[a]) {
1099  fEnvelopeContour[a] = b;
1100  if (pr==0) {
1101  pr = 1;
1102  as = a;
1103  bs = b;
1104  }
1105  } else {
1106  if (pr==1) {
1107  pr = 2;
1108  ae = a;
1109  be = b;
1110  }
1111  }
1112  if (xi==xj) {
1113  if (yi!=yj) b += (yi<yj)? +1:-1;
1114  if (b!=yj) goto l1;
1115  } else {
1116  a += krok;
1117  fy1 = yj-yi;
1118  fx1 = xj-xi;
1119  fx = a-xi;
1120  fy = fy1*fx/fx1;
1121  b = (Int_t)(yi+fy);
1122  if (a!=xj) goto l1;
1123  }
1124  if (pr!=0) {
1125  if (pr==1) {
1126  ae = xj;
1127  be = yj;
1128  }
1129  line->PaintLine(gPad->PixeltoX(as),gPad->PixeltoY(bs)+1,
1130  gPad->PixeltoX(ae),gPad->PixeltoY(be)+1);
1131  }
1132  return;
1133 }
1134 
1135 
1136 ////////////////////////////////////////////////////////////////////////////////
1137 /// Copies envelope vector, which ensures hidden surface removal for the
1138 /// contours display mode.
1139 
1141  Double_t ys)
1142 {
1143  Int_t xi,xj,a;
1144  xi = (Int_t)(fTxx*(xr-fXmin)/fKx+fTxy*(yr-fYmin)/fKy+fVx);
1145  xj = (Int_t)(fTxx*(xs-fXmin)/fKx+fTxy*(ys-fYmin)/fKy+fVx);
1146  if (xi<xj) {
1147  for (a=xi;a<=xj;a++) {
1148  if (fEnvelopeContour[a]<fEnvelope[a])
1150  fEnvelopeContour[a] = fBy2;
1151  }
1152  } else if (xj<xi) {
1153  for (a=xj;a<=xi;a++) {
1154  if (fEnvelopeContour[a]<fEnvelope[a])
1156  fEnvelopeContour[a] = fBy2;
1157  }
1158  }
1159  return;
1160 }
1161 
1162 
1163 ////////////////////////////////////////////////////////////////////////////////
1164 /// Paints histogram according to preset parameters.
1165 
1167 {
1168 /* -->
1169 <h1>Visualization</h1>
1170 <h2><i>Goal: to present 2-dimensional spectra in suitable visual form</i></h2>
1171 This package has several display mode groups and display modes, which can be
1172 employed for the presentation of 2-dimensional histograms
1173 <h2><i>Display modes groups:</i></h2>
1174 <ul>
1175 <p><li><b>kModeGroupSimple</b> - it covers simple display modes using one
1176  color only
1177 <p><li><b>kModeGroupLight</b> - in this group the shading is carried out
1178  according to the position of the fictive
1179  light source
1180 <p><li><b>kModeGroupHeight</b> - in this group the shading is carried out
1181  according to the channel contents
1182 <p><li><b>kModeGroupLightHeight</b> - combination of two previous shading
1183  algorithms. One can control the weight
1184  between both algorithms.
1185 </ul>
1186 <h2><i>Display modes:</i></h2>
1187 <ul>
1188 <p><li><b>kDisplayModePoints, </b>
1189 <p><li><b>kDisplayModeGrid, </b>
1190 <p><li><b>kDisplayModeContours,</b>
1191 <p><li><b>kDisplayModeBars,</b>
1192 <p><li><b>kDisplayModeLinesX,</b>
1193 <p><li><b>kDisplayModeLinesY,</b>
1194 <p><li><b>kDisplayModeBarsX,</b>
1195 <p><li><b>kDisplayModeBarsY,</b>
1196 <p><li><b>kDisplayModeNeedles,</b>
1197 <p><li><b>kDisplayModeSurface,</b>
1198 <p><li><b>kDisplayModeTriangles.</b>
1199 </ul>
1200 one can combine the above given modes groups and display modes. The meaningful
1201 combinations (denoted by x) are given in the next table.
1202 <p>
1203 <center>
1204 <table border=1 cellspacing=0 cellpadding=0>
1205 <tr><th></th><th>Simple</th><th>Light</th><th>Height</th><th>Light-Height</th>
1206 </tr>
1207 <tr><th>Points </th><th>X</th><th>X</th><th>X</th><th>X</th></tr>
1208 <tr><th>Grid </th><th>X</th><th>X</th><th>X</th><th>X</th></tr>
1209 <tr><th>Contours </th><th>X</th><th>-</th><th>X</th><th>-</th></tr>
1210 <tr><th>Bars </th><th>X</th><th>-</th><th>X</th><th>-</th></tr>
1211 <tr><th>LinesX </th><th>X</th><th>X</th><th>X</th><th>X</th></tr>
1212 <tr><th>LinesY </th><th>X</th><th>X</th><th>X</th><th>X</th></tr>
1213 <tr><th>BarsX </th><th>X</th><th>-</th><th>X</th><th>-</th></tr>
1214 <tr><th>BarsY </th><th>X</th><th>-</th><th>X</th><th>-</th></tr>
1215 <tr><th>Needles </th><th>X</th><th>-</th><th>-</th><th>-</th></tr>
1216 <tr><th>Surface </th><th>-</th><th>X</th><th>X</th><th>X</th></tr>
1217 <tr><th>Triangles</th><th>X</th><th>X</th><th>X</th><th>X</th></tr>
1218 </table></center>
1219 <h2><i>Function:</i></h2>
1220 <h2>void TSpectrum2Painter::SetDisplayMode (Int_t modeGroup, Int_t displayMode)</h2>
1221 <p>
1222 This function controls the display mode group and display mode of the
1223 histogram drawing. To illustrate the possible effects of the various display
1224 modes we introduce a set of examples. Default values:
1225 <ul>
1226 <p><li> <b>modeGroup = kModeGroupLightHeight </b>
1227 <p><li> <b>displayMode = kDisplayModeSurface </b>
1228 </ul>
1229 <p><center><img src="gif/spectrumpainter001.jpg"></center>
1230 <p>Simple modes group, display mode = points, 256 x 256 channels.
1231 <p><center><img src="gif/spectrumpainter002.jpg"></center>
1232 <p>Simple modes group, display mode = grid, 64 x 64 channels.
1233 <p><center><img src="gif/spectrumpainter003.jpg"></center>
1234 <p>Simple modes group, display mode = contours, 64 x 64 channels.
1235 <p><center><img src="gif/spectrumpainter004.jpg"></center>
1236 <p>Simple modes group, display mode = bars, 64 x 64 channels.
1237 <p><center><img src="gif/spectrumpainter005.jpg"></center>
1238 <p>Simple modes group, display mode = linesX, 64 x 64 channels.
1239 <p><center><img src="gif/spectrumpainter006.jpg"></center>
1240 <p>Simple modes group, display mode = linesY, 64 x 64 channels.
1241 <p><center><img src="gif/spectrumpainter007.jpg"></center>
1242 <p>Simple modes group, display mode = barsX, 64 x 64 channels.
1243 <p><center><img src="gif/spectrumpainter008.jpg"></center>
1244 <p>Simple modes group, display mode = barsY, 64 x 64 channels.
1245 <p><center><img src="gif/spectrumpainter009.jpg"></center>
1246 <p>Simple modes group, display mode = needles, 64 x 64 channels.
1247 <p><center><img src="gif/spectrumpainter010.jpg"></center>
1248 <p>Simple modes group, display mode = triangles, 64 x 64 channels.
1249 <p><center><img src="gif/spectrumpainter011.jpg"></center>
1250 <p>Light modes group, display mode = points, 256 x 256 channels.
1251 <p><center><img src="gif/spectrumpainter012.jpg"></center>
1252 <p>Light modes group, display mode = grid, 256 x 256 channels.
1253 <p><center><img src="gif/spectrumpainter013.jpg"></center>
1254 <p>Light modes group, display mode = surface, 64 x 64 channels.
1255 <p><center><img src="gif/spectrumpainter014.jpg"></center>
1256 <p>Light modes group, display mode = triangles, 64 x 64 channels.
1257 <p><center><img src="gif/spectrumpainter015.jpg"></center>
1258 <p>Height modes group, display mode = points, 256 x 256 channels.
1259 <p><center><img src="gif/spectrumpainter016.jpg"></center>
1260 <p>Height modes group, display mode = grid, 256 x 256 channels.
1261 <p><center><img src="gif/spectrumpainter017.jpg"></center>
1262 <p>Height modes group, display mode = contours, 64 x 64 channels.
1263 <p><center><img src="gif/spectrumpainter018.jpg"></center>
1264 <p>Height modes group, display mode = bars, 64 x 64 channels.
1265 <p><center><img src="gif/spectrumpainter019.jpg"></center>
1266 <p>Height modes group, display mode = surface, 64 x 64 channels.
1267 <p><center><img src="gif/spectrumpainter020.jpg"></center>
1268 <p>Height modes group, display mode = triangles, 64 x 64 channels.
1269 <p><center><img src="gif/spectrumpainter021.jpg"></center>
1270 <p>
1271 Light - height modes group, display mode = surface, 64 x 64 channels. The weight
1272 between both shading algorithms is set to 0.5. One can observe the influence of
1273 both shadings.
1274 <h2><i>Function:</i></h2>
1275 <h2>TSpectrum2Painter::SetPenAttr(Int_t color,Int_t style,Int_t width)</h2>
1276 <p>
1277 Using this function one can change pen color, pen style and pen width.
1278 Possible pen styles are:
1279 <ul>
1280 <p><li><b> kPenStyleSolid,</b>
1281 <p><li><b> kPenStyleDash,</b>
1282 <p><li><b> kPenStyleDot,</b>
1283 <p><li><b> kPenStyleDashDot.</b>
1284 </ul>
1285 <p>Default values:
1286 <ul>
1287 <p><li><b> color = kBlack</b>
1288 <p><li><b> style = kPenStyleSolid</b>
1289 <p><li><b> width = 1</b>
1290 </ul>
1291 <p><center><img src="gif/spectrumpainter022.jpg"></center>
1292 <p>Simple modes group, display mode = linesX, 64 x 64 channels. Pen width = 3.
1293 <h2><i>Function:</i></h2>
1294 <h2>TSpectrum2Painter::SetNodes(Int_t nodesx,Int_t nodesy)</h2>
1295 <p>Sometimes the displayed region is rather large. When displaying all channels
1296 pictures become very dense and complicated. It is very difficult to understand
1297 overall shape of the data. Therefore in the package we have implemented the
1298 possibility to change the density of displayed channels. Only channels
1299 coinciding with given nodes are displayed. In the next figure we introduce the
1300 example of the above presented spectrum with number of nodes set to 64x64.
1301 <p>Default values:
1302 <ul>
1303 <p><li><b> nodesx = Xmax-Xmin+1</b>
1304 <p><li><b> nodesy = Ymax-Ymin+1</b>
1305 </ul>
1306 <p><center><img src="gif/spectrumpainter023.jpg"></center>
1307 <p>Simple modes group, display mode = grid, 256 x 256 channels.
1308 Number of nodes is 64x64.
1309 <h2><i>Function:</i></h2>
1310 <h2>void TSpectrum2Painter::SetAngles (Int_t alpha,Int_t beta, Int_t view)</h2>
1311 <p>One can change the angles of the position of 3-d space and to rotate the
1312 space. Alpha parameter defines the angle between bottom horizontal screen line
1313 and the displayed space on the right side of the picture and beta on the left
1314 side, respectively. One can rotate the 3-d space around vertical axis going
1315 through the center of it employing the view parameter.
1316 Allowed values are 0, 90, 180 and 270 degrees respectively.
1317 <p>Default values:
1318 <ul>
1319 <p><li><b> alpha = 20</b>
1320 <p><li><b> beta = 60</b>
1321 <p><li><b> view = 0</b>
1322 </ul>
1323 <p><center><img src="gif/spectrumpainter024.jpg"></center>
1324 <p>Light modes group, display mode = surface, 256 x 256 channels. Angles are
1325 set as follows: alpha=40, beta=30, view=0.
1326 <p><center><img src="gif/spectrumpainter025.jpg"></center>
1327 <p>Light modes group, display mode = surface, 256 x 256 channels. Angles are
1328 set as follows: alpha=30, beta=30, view=90.
1329 <h2><i>Function:</i></h2>
1330 <h2>TSpectrum2Painter::SetZScale(Int_t scale)</h2>
1331 <p>One can change the scale of z-axis. Possible values are:
1332 <ul>
1333 <p><li><b> kZScaleLinear</b>
1334 <p><li><b> kZScaleLog</b>
1335 <p><li><b> kZScaleSqrt</b>
1336 </ul>
1337 <p>Default value is:
1338 <ul>
1339 <p><li><b> scale = kZScaleLinear</b>
1340 </ul>
1341 <p><center><img src="gif/spectrumpainter026.jpg"></center>
1342 <p>Height modes group, display mode = surface, 64 x 64 channels, log scale.
1343 <h2><i>Function:</i></h2>
1344 <h2>TSpectrum2Painter::SetColorIncrements(Double_t r,Double_t g,Double_t b);</h2>
1345 <p> For sophisticated shading (in <b>kModeGroupLight, kModeGroupHeight</b>
1346 and <b>kModeGroupLightHeight</b> display modes groups) the color palette starts
1347 from the basic pen color (see SetPenAttr function). There is a predefined number
1348 of color levels (256). Color in every level is calculated by adding the
1349 increments of the r, g, b components to the previous level. Using this function
1350 one can change the color increments between two neighboring color levels. The
1351 function does not apply for <b>kModeGroupSimple</b> display modes group.
1352 Default values: <b>r=1, g=1, b=1;</b>
1353 <p><center><img src="gif/spectrumpainter027.jpg"></center>
1354 <p>Light modes group, display mode = surface, 64 x 64 channels, color increments
1355 r=1, g=2, b=3.
1356 <p><center><img src="gif/spectrumpainter028.jpg"></center>
1357 <p>Light modes group, display mode = surface, 64 x 64 channels, color
1358 increments r=4, g=2, b=1.
1359 <h2><i>Function:</i></h2>
1360 <h2>TSpectrum2Painter::SetColorAlgorithm(Int_t colorAlgorithm)</h2>
1361 <p>To define the colors one can employ one of the following color algorithms
1362 (rgb, cmy, cie, yiq, hvs models [1], [2]). When the level of a component
1363 achieves the limit value one can choose either smooth transition (by decreasing
1364 the limit value) or sharp - modulo transition (continuing with 0 value). This
1365 makes possible to realize various visual effects. One can choose from the
1366 following set of the algorithms:
1367 <ul>
1368 <p><li><b> kColorAlgRgbSmooth </b>
1369 <p><li><b> kColorAlgRgbModulo </b>
1370 <p><li><b> kColorAlgCmySmooth </b>
1371 <p><li><b> kColorAlgCmyModulo </b>
1372 <p><li><b> kColorAlgCieSmooth </b>
1373 <p><li><b> kColorAlgCieModulo </b>
1374 <p><li><b> kColorAlgYiqSmooth </b>
1375 <p><li><b> kColorAlgYiqModulo </b>
1376 <p><li><b> kColorAlgHvsSmooth </b>
1377 <p><li><b> kColorAlgHvsModulo </b>
1378 </ul>
1379 <p>The function does not apply for <b>kModeGroupSimple</b> display modes group.
1380 Default value is:
1381 <ul>
1382 <p><li><b> colorAlgorithm = kColorAlgRgbSmooth</b>
1383 </ul>
1384 <p><center><img src="gif/spectrumpainter029.jpg"></center>
1385 <p>Light modes group, display mode = surface, 64 x 64 channels, color algorithm
1386 is cmy smooth.
1387 <p><center><img src="gif/spectrumpainter030.jpg"></center>
1388 <p>Light modes group, display mode = surface, 64 x 64 channels, color algorithm
1389 is hvs smooth.
1390 <p><center><img src="gif/spectrumpainter031.jpg"></center>
1391 <p>Light modes group, display mode = surface, 64 x 64 channels, color algorithm
1392 is yiq smooth.
1393 <p><center><img src="gif/spectrumpainter032.jpg"></center>
1394 <p>Light modes group, display mode = surface, 64 x 64 channels, color algorithm
1395 is rgb modulo.
1396 <p><center><img src="gif/spectrumpainter033.jpg"></center>
1397 <p>Height modes group, display mode = surface, 256 x 256 channels, color
1398 algorithm is rgb modulo, increments r=5, g=5, b=5, angles alpha=0, beta=90,
1399 view=0.
1400 <h2><i>Function:</i></h2>
1401 <h2>TSpectrum2Painter::SetLightPosition(Int_t x, Int_t y, Int_t z)</h2>
1402 <p>In <b>kModeGroupLight</b> and <b>kModeGroupLightHeight</b> display modes
1403 groups the color palette is calculated according to the fictive light source
1404 position in 3-d space. Using this function one can change the position of the
1405 source and thus to achieve various graphical effects. The function does not
1406 apply for <b>kModeGroupSimple</b> and<b> kModeGroupHeight </b>display modes
1407 groups. Default values are: <b>x=1000, y=1000, z=1000.</b>
1408 <p><center><img src="gif/spectrumpainter034.jpg"></center>
1409 <p>Light modes group, display mode = surface, 64 x 64 channels. Position of the
1410 light source was set to x=0, y=1000, z=1000.
1411 <h2><i>Function:</i></h2>
1412 <h2>TSpectrum2Painter::SetShading(Int_t shading,Int_t shadow)</h2>
1413 <p>Surface of the picture is composed of triangles. If desired the edges of the
1414 neighboring triangles can be smoothed (shaded). If desired the display of the
1415 shadow can be painted as well. The function does not apply for
1416 <b>kModeGroupSimple</b> display modes group.
1417 <p>Possible values for shading are:
1418 <ul>
1419 <p><li><b> kNotShaded</b>
1420 <p><li><b> kShaded.</b>
1421 </ul>
1422 <p>Possible values for shadow are:
1423 <ul>
1424 <p><li><b> kShadowsNotPainted</b>
1425 <p><li><b> kShadowsPainted</b>
1426 </ul>
1427 <p>Default values:
1428 <ul>
1429 <p><li><b> shading = kShaded</b>
1430 <p><li><b> shadow = kShadowsNotPainted</b>
1431 </ul>
1432 <p><center><img src="gif/spectrumpainter035.jpg"></center>
1433 <p>Light modes group, display mode = surface, 64 x 64 channels, not shaded.
1434 <p><center><img src="gif/spectrumpainter036.jpg"></center>
1435 <p>Light modes group, display mode = surface, 64 x 64 channels, shaded, with
1436 shadow.
1437 <h2><i>Function:</i></h2>
1438 <h2>TSpectrum2Painter::SetBezier(Int_t bezier)</h2>
1439 <p>For kModeGroupSimple display modes group and for <b>kDisplayModeGrid,
1440 kDisplayModeLinesX</b> >and <b>kDisplayModeLinesY</b> display modes one
1441 can smooth data using Bezier smoothing algorithm. The function does not apply
1442 for other display modes groups and display modes. Possible values are:
1443 <ul>
1444 <p><li><b> kNoBezierInterpol</b>
1445 <p><li><b> kBezierInterpol</b>
1446 </ul>
1447 <p>Default value is:
1448 <ul>
1449 <p><li><b> bezier = kNoBezierInterpol.</b>
1450 </ul>
1451 <p><center><img src="gif/spectrumpainter005.jpg"></center>
1452 <p>Simple modes group, display mode = linesX, 64 x 64 channels with Bezier
1453 smoothing.
1454 <h2><i>Function:</i></h2>
1455 <h2>TSpectrum2Painter::SetContourWidth(Int_t width)</h2>
1456 <p>This function applies only for <b>kDisplayModeContours</b> display mode.
1457 One can change the width between horizontal slices and thus their density.
1458 Default value: <b>width=50.</b>
1459 <p><center><img src="gif/spectrumpainter037.jpg"></center>
1460 <p>Simple modes group, display mode = contours, 64 x 64 channels. Width between
1461 slices was set to 30.
1462 <h2><i>Function:</i></h2>
1463 <h2>TSpectrum2Painter::SetLightHeightWeight(Double_t weight)</h2>
1464 <p>For <b>kModeGroupLightHeight</b> display modes group one can change the
1465 weight between both shading algorithm. The function does not apply for other
1466 display modes groups. Default value is: <b>weight=0.5.</b>
1467 <p><center><img src="gif/spectrumpainter038.jpg"></center>
1468 <p>Light - height modes group, display mode = surface, 64 x 64 channels.
1469 The weight between both shading algorithms is set to 0.7.
1470 <h2><i>Function:</i></h2>
1471 <h2>TSpectrum2Painter::SetChanMarks(Int_t enable,Int_t color,Int_t width,Int_t height,Int_t style)</h2>
1472 In addition to the surface drawn using any above given algorithm one can display
1473 channel marks. One can control the color as well as the width, height
1474 (in pixels) and the style of the marks. The parameter enable can be set to:
1475 <ul>
1476 <p><li> <b>kChannelMarksNotDrawn</b>
1477 <p><li> <b>kChannelMarksDrawn.</b>
1478 </ul>
1479 The possible styles can be chosen from the set:
1480 <ul>
1481 <p><li><b> kChannelMarksStyleDot</b>
1482 <p><li><b> kChannelMarksStyleCross</b>
1483 <p><li><b> kChannelMarksStyleStar</b>
1484 <p><li><b> kChannelMarksStyleRectangle</b>
1485 <p><li><b> kChannelMarksStyleX</b>
1486 <p><li><b> kChannelMarksStyleDiamond</b>
1487 <p><li><b> kChannelMarksStyleTriangle.</b>
1488 </ul>
1489 <p><center><img src="gif/spectrumpainter039.jpg"></center>
1490 <p><b>Light modes group, display mode = surface, 64 x 64 channels,
1491 with marks (red circles).</b></p>
1492 <h2><i>Function:</i></h2>
1493 <h2>TSpectrum2Painter::SetChanGrid(Int_t enable,Int_t color)</h2>
1494 <p>In addition to the surface drawn using any above given algorithm one can
1495 display grid using the color parameter. The parameter enable can be set to:
1496 <ul>
1497 <p><li><b> kChannelGridNotDrawn</b>
1498 <p><li><b> kChannelGridDrawn.</b>
1499 </ul>
1500 <p><center><img src="gif/spectrumpainter040.jpg"></center>
1501 <p>Height modes group, display mode = surface, 64 x 64 channels, with blue grid.
1502 <p><center><img src="gif/spectrumpainter041.jpg"></center>
1503 <p>Height modes group, display mode = surface, 64 x 64 channels, with marks
1504 (red circles) and blue grid.
1505 <h2><i>References:</i></h2>
1506 <p> [1] Morhá&#269; M., Kliman J., Matoušek V., Turzo I.,
1507 Sophisticated visualization algorithms for analysis of multidimensional
1508 experimental nuclear data, Acta Physica Slovaca 54 (2004) 385.
1509 <p> [2] D. Hearn, M. P. Baker: Computer Graphics, Prentice Hall International,
1510 Inc. 1994.
1511 <h2>Script:</h2>
1512 <pre>
1513 // Example to draw source spectrum (class TSpectrum2Painter).
1514 // To execute this example, do
1515 // root &gt; .x VisA.C
1516 #include &quot;TSpectrum2Painter.h&quot;
1517 
1518 void VisA() {
1519    TFile *f = new TFile(&quot;TSpectrum2.root&quot;);
1520    TH2F *graph=(TH2F*) f-&gt;Get(&quot;graph2;1&quot;);
1521    TCanvas *Graph2 = new TCanvas(&quot;Graph2&quot;,&quot;Illustration of 2D graphics&quot;,10,10,1000,700);
1522    graph-&gt;Draw(&quot;SPEC&quot;);
1523 }
1524 </pre>
1525 <!-- */
1526 
1527  Int_t turni,turnj,w1,w2,x,y;
1528  Int_t q1=0,q2=0,qv=0,smer=0,flag=0,i=0,j=0,x1=0,y1=0,x2=0,y2=0,x3=0,y3=0,x4=0,y4=0,uhl=0,xp1=0,yp1=0,xp2=0,yp2=0;
1529  Int_t ix5,iy5,x6,y6,x7,y7,y8,x1d,y1d,x2d=0,y2d=0;
1530  Int_t i1=0,i2=0,i3=0,i4=0,j1=0,j2=0,j3=0,j4=0;
1531  Int_t s1=0,s2=0,s3=0,s4=0,t1=0,t2=0,t3=0,t4=0;
1532  Double_t dx1,dx2,dx3,dx4,dy1,dy2,dy3,dy4,z1,z2,z3,z4,zl,zh;
1533  Double_t xa,xb=0,ya,yb=0,x5=0,y5=0;
1534  Double_t da=0,db=0,dc=0,dd=0,xtaz,ytaz,ztaz,v,shad_noise;
1535  Int_t iv=0,ekv,stvor,sx1,sx2,sx3,sx4,sx5,sy1,sy2,sy3,sy4,sy5;
1536  Double_t pom1,pom2,sdx1,sdy1,sdx2=0,sdy2,sdx3,sdy3,sdy4,spriz;
1537  Int_t sr1=0,sr2=0,sr3=0,sr4=0,sr5=0,sr6=0,sr7=0,sr8=0;
1538  Int_t tr1=0,tr2=0,tr3=0,tr4=0,tr5=0,tr6=0,tr7=0,tr8=0;
1539  Int_t il,iv1=0,iv2=0,iv3=0,iv4=0;
1540  Double_t v1=0,v2=0,v3=0,v4=0,dxr1,dxr2,dyr1,dyr2,zr1,zr2,bezf;
1541  Double_t dcount_reg,z1l,z2l,z3l,z4l,sdx2p,sdy2p,dap,dbp,dcp,ddp;
1542  Int_t sx1p,sy1p,sx3p,uip=0;
1543  Double_t bezx1,bezy1,bezx2,bezy2;
1544  Double_t p000x,p000y,p100x,p100y,p010x,p010y,p110x,p110y;
1545  Double_t p001x,p001y,p101x,p101y,p011x,p011y,p111x,p111y;
1546  Int_t ibezx1=0,ibezy1=0,ibezx2,ibezy2;
1547  unsigned ui1,ui2,ui3;
1548  Double_t fi,alfa,beta,x3max,y3max,mul,movx,movy;
1549  Double_t xmin,xmax,ymin,ymax,zmin,zmax,mx,my,mz;
1550  Double_t mxx,mxy,myx,myy,myz,px,py,kx,ky;
1551  Double_t bxl,bxh,byl,byh,xd,yd,a,b,rotx,roty;
1552  TLine *line = new TLine();
1553  TBox *box = new TBox();
1554  TColor *pen_col;
1555  pen_col = (TColor*)(gROOT->GetListOfColors()->At(fPenColor));
1556  ui1 = (Int_t)(256*pen_col->GetRed());
1557  ui2 = (Int_t)(256*pen_col->GetGreen());
1558  ui3 = (Int_t)(256*pen_col->GetBlue());
1559 
1561  printf("The canvas size exceed the maximum X screen resolution.\n");
1562  printf("Use the option bf() to increase the buffer size (it should be greater than %d).\n",fBx2);
1563  return;
1564  }
1565 
1566  for (i=fBx1;i<fBx2;i++) {
1567  fEnvelope[i] = fBy2;
1568  fEnvelopeContour[i] = fBy2;
1569  }
1570 
1571 // gPad->Range(0, 0, 1 ,1);
1572 
1573  // Set the histogram's parameters.
1574  fBx1 = gPad->XtoPixel(0.1);
1575  fBx2 = gPad->XtoPixel(0.99);
1576  fBy1 = gPad->YtoPixel(0.99);
1577  fBy2 = gPad->YtoPixel(0.05);
1578  fXmin = fH2->GetXaxis()->GetFirst();
1579  fXmax = fH2->GetXaxis()->GetLast();
1580  fYmin = fH2->GetYaxis()->GetFirst();
1581  fYmax = fH2->GetYaxis()->GetLast();
1582  fZmax = fH2->GetMaximum();
1583  fZmin = fH2->GetMinimum();
1584 
1585  // Calculation of display parameters.
1586  xmin = fXmin;
1587  xmax = fXmax;
1588  ymin = fYmin;
1589  ymax = fYmax;
1590  zmin = fZmin;
1591  zmax = fZmax;
1592  xd = (xmax-xmin)/2;
1593  yd = (ymax-ymin)/2;
1594  a = (xmax+xmin)/2;
1595  b = (ymax+ymin)/2;
1596  fi = (fViewAngle*3.1415927)/180;
1597  alfa = (fAlpha*3.1415927)/180;
1598  beta = (fBeta*3.1415927)/180;
1599  rotx = (-1)*a*cos(fi)+b*sin(fi)+xd*TMath::Abs(cos(fi))+yd*TMath::Abs(sin(fi));
1600  roty = (-1)*a*sin(fi)-b*cos(fi)+xd*TMath::Abs(sin(fi))+yd*TMath::Abs(cos(fi));
1601  x3max = (xmax-xmin)*TMath::Abs(cos(fi))+(ymax-ymin)*TMath::Abs(sin(fi));
1602  y3max = (xmax-xmin)*TMath::Abs(sin(fi))+(ymax-ymin)*TMath::Abs(cos(fi));
1603  bxl = fBx1;
1604  bxh = fBx2;
1605  byl = fBy1;
1606  byh = fBy2;
1607  mx = (bxh-bxl)/(x3max*(cos(alfa)+cos(beta)));
1608  my = (bxh-bxl)/(y3max*(cos(alfa)+cos(beta)));
1609  mul = (byh-byl)/(bxh-bxl);
1610  movx = bxl+my*cos(alfa)*y3max;
1611  mxx = mx*cos(beta)*cos(fi)-my*cos(alfa)*sin(fi);
1612  mxy = (-1)*mx*cos(beta)*sin(fi)-my*cos(alfa)*cos(fi);
1613  myx = mul*(mx*sin(beta)*cos(fi)+my*sin(alfa)*sin(fi));
1614  myy = mul*((-1)*mx*sin(beta)*sin(fi)+my*sin(alfa)*cos(fi));
1615  px = rotx*mx*cos(beta)-roty*my*cos(alfa)+movx;
1616  kx = (xmax-xmin)/(fNodesx-1);
1617  ky = (ymax-ymin)/(fNodesy-1);
1618  fKx = kx;
1619  fKy = ky;
1620  fMxx = mxx;
1621  fMxy = mxy;
1622  fMyx = myx;
1623  fMyy = myy;
1624  fTxx = mxx*kx;
1625  fTxy = mxy*ky;
1626  fTyx = myx*kx;
1627  fTyy = myy*ky;
1628  fVx = mxx*xmin+mxy*ymin+px;
1629  if (fZscale==kZScaleLinear) {
1630  mz = (bxh-bxl)*(cos(alfa)+cos(beta)-sin(alfa)-sin(beta));
1631  mz = mz/((zmax-zmin)*(cos(alfa)+cos(beta)));
1632  movy = byl+mul*mz*zmax;
1633  myz = (-1)*mz*mul;
1634  py = mul*(rotx*mx*sin(beta)+roty*my*sin(alfa))+movy;
1635  fTyz = myz;
1636  fVy = myx*xmin+myy*ymin+py;
1637  fNuSli = (zmax-zmin)/(Double_t)fContWidth;
1638  } else if (fZscale==kZScaleLog) {
1639  if (zmin>=1) zmin = log(zmin);
1640  else zmin = 0;
1641  if (zmax>=1) zmax = log(zmax);
1642  else zmax = 0;
1643  if ((zmax-zmin)<0.000001) zmax = zmin+0.000001;
1644  mz = (bxh-bxl)*(cos(alfa)+cos(beta)-sin(alfa)-sin(beta));
1645  mz = mz/((zmax-zmin)*(cos(alfa)+cos(beta)));
1646  movy = byl+mul*mz*zmax;
1647  myz = (-1)*mz*mul;
1648  py = mul*(rotx*mx*sin(beta)+roty*my*sin(alfa))+movy;
1649  fTyz = myz;
1650  fVy = myx*xmin+myy*ymin+py;
1651  fNuSli = (zmax-zmin)/(Double_t)fContWidth;
1652  } else if (fZscale==kZScaleSqrt) {
1653  if (zmin>=1) zmin = sqrt(zmin);
1654  else zmin = 0;
1655  if (zmax>=1) zmax = sqrt(zmax);
1656  else zmax = 0;
1657  if ((zmax-zmin)<0.000001) zmax = zmin+0.000001;
1658  mz = (bxh-bxl)*(cos(alfa)+cos(beta)-sin(alfa)-sin(beta));
1659  mz = mz/((zmax-zmin)*(cos(alfa)+cos(beta)));
1660  movy = byl+mul*mz*zmax;
1661  myz = (-1)*mz*mul;
1662  py = mul*(rotx*mx*sin(beta)+roty*my*sin(alfa))+movy;
1663  fTyz = myz;
1664  fVy = myx*xmin+myy*ymin+py;
1665  fNuSli = (zmax-zmin)/(Double_t)fContWidth;
1666  }
1667 
1668  // End of calculations of display parameters.
1669  dcount_reg=fContWidth;
1670  switch (fZscale) {
1671  case kZScaleLog:
1672  dcount_reg=log(dcount_reg);
1673  break;
1674  case kZScaleSqrt:
1675  dcount_reg=sqrt(dcount_reg);
1676  break;
1677  }
1678  shad_noise = fZmax;
1679  shad_noise /= 100.;
1680  w1 = fNodesx-1;
1681  w2 = fNodesy-1;
1682 
1683  // Drawing axis in backplanes.
1684  Transform(0,0,-1);
1685  p000x = gPad->PixeltoX(fXt);
1686  p000y = gPad->PixeltoY(fYt)+1;
1687  Transform(w1,0,-1);
1688  p100x = gPad->PixeltoX(fXt);
1689  p100y = gPad->PixeltoY(fYt)+1;
1690  Transform(0,w2,-1);
1691  p010x = gPad->PixeltoX(fXt);
1692  p010y = gPad->PixeltoY(fYt)+1;
1693  Transform(w1,w2,-1);
1694  p110x = gPad->PixeltoX(fXt);
1695  p110y = gPad->PixeltoY(fYt)+1;
1696  fZPresetValue = fZmax;
1697  Transform(0,0,-2);
1698  p001x = gPad->PixeltoX(fXt);
1699  p001y = gPad->PixeltoY(fYt)+1;
1700  Transform(w1,0,-2);
1701  p101x = gPad->PixeltoX(fXt);
1702  p101y = gPad->PixeltoY(fYt)+1;
1703  Transform(0,w2,-2);
1704  p011x = gPad->PixeltoX(fXt);
1705  p011y = gPad->PixeltoY(fYt)+1;
1706  Transform(w1,w2,-2);
1707  p111x = gPad->PixeltoX(fXt);
1708  p111y = gPad->PixeltoY(fYt)+1;
1709  Double_t bmin, bmax, binLow, binHigh, binWidth;
1710  Double_t axisLevel, gridDist, gridY1, gridY2;
1711  Int_t ndivx = 0, ndivy, ndivz, nbins;
1712  TGaxis *axis = new TGaxis();
1713  TGaxis *xaxis = new TGaxis();
1714  TGaxis *yaxis = new TGaxis();
1715  TGaxis *zaxis = new TGaxis();
1716  line->SetLineStyle(kPenStyleDot);
1717  if (fViewAngle==0) {
1718  axis->PaintAxis(p000x, p000y, p100x, p100y, bmin, bmax, ndivx, "");
1719  axis->PaintAxis(p000x, p000y, p010x, p010y, bmin, bmax, ndivx, "");
1720  if(fAlpha+fBeta<90)
1721  axis->PaintAxis(p000x, p000y, p001x, p001y, bmin, bmax, ndivx, "");
1722  if(fAlpha+fBeta<90)
1723  axis->PaintAxis(p100x, p100y, p101x, p101y, bmin, bmax, ndivx, "");
1724  axis->PaintAxis(p101x, p101y, p001x, p001y, bmin, bmax, ndivx, "");
1725  axis->PaintAxis(p001x, p001y, p011x, p011y, bmin, bmax, ndivx, "");
1726  if (fZscale==kZScaleLinear) {
1727  bmin = fZmin;
1728  bmax = fZmax;
1729  ndivz = 10;
1730  THLimitsFinder::Optimize(bmin, bmax, ndivz, binLow, binHigh,
1731  nbins, binWidth, " ");
1732  for (i = 0; i < nbins + 1; i++) {
1733  axisLevel = binLow+i*binWidth;
1734  gridDist = (axisLevel-bmin)*(p001y-p000y)/(bmax-bmin);
1735  gridY1 = p000y + gridDist, gridY2 = p100y + gridDist;
1736  line->PaintLine(p000x,gridY1,p100x,gridY2);
1737  gridY2 = p010y + gridDist;
1738  line->PaintLine(p000x,gridY1,p010x,gridY2);
1739  }
1740  }
1741  } else if (fViewAngle==90) {
1742  axis->PaintAxis(p010x, p010y, p000x, p000y, bmin, bmax, ndivx, "");
1743  axis->PaintAxis(p010x, p010y, p110x, p110y, bmin, bmax, ndivx, "");
1744  if(fAlpha+fBeta<90)
1745  axis->PaintAxis(p010x, p010y, p011x, p011y, bmin, bmax, ndivx, "");
1746  if(fAlpha+fBeta<90)
1747  axis->PaintAxis(p000x, p000y, p001x, p001y, bmin, bmax, ndivx, "");
1748  axis->PaintAxis(p001x, p001y, p011x, p011y, bmin, bmax, ndivx, "");
1749  axis->PaintAxis(p011x, p011y, p111x, p111y, bmin, bmax, ndivx, "");
1750  if (fZscale==kZScaleLinear) {
1751  bmin = fZmin;
1752  bmax = fZmax;
1753  ndivz = 10;
1754  THLimitsFinder::Optimize(bmin, bmax, ndivz, binLow, binHigh,
1755  nbins, binWidth, " ");
1756  for (i = 0; i < nbins + 1; i++) {
1757  axisLevel = binLow+i*binWidth;
1758  gridDist = (axisLevel-bmin)*(p011y-p010y)/(bmax-bmin);
1759  gridY1 = p010y + gridDist, gridY2 = p000y + gridDist;
1760  line->PaintLine(p010x,gridY1,p000x,gridY2);
1761  gridY2 = p110y + gridDist;
1762  line->PaintLine(p010x,gridY1,p110x,gridY2);
1763  }
1764  }
1765  } else if (fViewAngle==180) {
1766  axis->PaintAxis(p110x, p110y, p010x, p010y, bmin, bmax, ndivx, "");
1767  axis->PaintAxis(p110x, p110y, p100x, p100y, bmin, bmax, ndivx, "");
1768  if(fAlpha+fBeta<90)
1769  axis->PaintAxis(p110x, p110y, p111x, p111y, bmin, bmax, ndivx, "");
1770  if(fAlpha+fBeta<90)
1771  axis->PaintAxis(p010x, p010y, p011x, p011y, bmin, bmax, ndivx, "");
1772  axis->PaintAxis(p011x, p011y, p111x, p111y, bmin, bmax, ndivx, "");
1773  axis->PaintAxis(p111x, p111y, p101x, p101y, bmin, bmax, ndivx, "");
1774  if (fZscale==kZScaleLinear) {
1775  bmin = fZmin;
1776  bmax = fZmax;
1777  ndivz = 10;
1778  THLimitsFinder::Optimize(bmin, bmax, ndivz, binLow, binHigh,
1779  nbins, binWidth, " ");
1780  for (i = 0; i < nbins + 1; i++) {
1781  axisLevel = binLow+i*binWidth;
1782  gridDist = (axisLevel-bmin)*(p111y-p110y)/(bmax-bmin);
1783  gridY1 = p110y + gridDist, gridY2 = p010y + gridDist;
1784  line->PaintLine(p110x,gridY1,p010x,gridY2);
1785  gridY2 = p100y + gridDist;
1786  line->PaintLine(p110x,gridY1,p100x,gridY2);
1787  }
1788  }
1789  } else if (fViewAngle==270) {
1790  axis->PaintAxis(p100x, p100y, p110x, p110y, bmin, bmax, ndivx, "");
1791  axis->PaintAxis(p100x, p100y, p000x, p000y, bmin, bmax, ndivx, "");
1792  if(fAlpha+fBeta<90)
1793  axis->PaintAxis(p100x, p100y, p101x, p101y, bmin, bmax, ndivx, "");
1794  if(fAlpha+fBeta<90)
1795  axis->PaintAxis(p110x, p110y, p111x, p111y, bmin, bmax, ndivx, "");
1796  axis->PaintAxis(p111x, p111y, p101x, p101y, bmin, bmax, ndivx, "");
1797  axis->PaintAxis(p101x, p101y, p001x, p001y, bmin, bmax, ndivx, "");
1798  if (fZscale==kZScaleLinear) {
1799  bmin = fZmin;
1800  bmax = fZmax;
1801  ndivz = 10;
1802  THLimitsFinder::Optimize(bmin, bmax, ndivz, binLow, binHigh,
1803  nbins, binWidth, " ");
1804  for (i = 0; i < nbins + 1; i++) {
1805  axisLevel = binLow+i*binWidth;
1806  gridDist = (axisLevel-bmin)*(p101y-p100y)/(bmax-bmin);
1807  gridY1 = p100y + gridDist, gridY2 = p110y + gridDist;
1808  line->PaintLine(p100x,gridY1,p110x,gridY2);
1809  gridY2 = p000y + gridDist;
1810  line->PaintLine(p100x,gridY1,p000x,gridY2);
1811  }
1812  }
1813  }
1814 
1815  // End.
1816  line->ResetAttLine("");
1817  line->SetLineColor(fPenColor);
1818  line->SetLineWidth(fPenWidth);
1819  line->SetLineStyle(fPenDash);
1820  turni = 0;
1821  turnj = 0;
1822  Transform(w1,0,0);
1823  x1 = fXt;
1824  Transform(0,0,0);
1825  x2 = fXt;
1826  Transform(0,w2,0);
1827  x3 = fXt;
1828  if (x2>=x1) turnj = 1;
1829  if (x3>=x2) turni = 1;
1830  q1 = 1;
1831  q2 = 0;
1832  qv = 1;
1833  do {
1834  uhl = 0;
1835  smer = 0;
1836  flag = 0;
1837 l2:
1838  if (turni==1) {
1839  i = q1;
1840  } else {
1841  i = w1-q1;
1842  }
1843  if (turnj==1) {
1844  j = q2;
1845  } else {
1846  j = w2-q2;
1847  }
1848  Transform(i,j,0);
1849  x1 = fXt;
1850  y1 = fYt;
1851  Transform(i,j,-1);
1852  x1d = fXt;
1853  y1d = fYt;
1854  do {
1855  if (flag==0) {
1856  flag = 1;
1857  if (smer==0) q1 -= 1;
1858  else q2 -= 1;
1859  } else {
1860  flag = 0;
1861  if (smer==0) q2 += 1;
1862  else q1 += 1;
1863  }
1864  if (turni==1) {
1865  i = q1;
1866  } else {
1867  i = w1-q1;
1868  }
1869  if (turnj==1) {
1870  j = q2;
1871  } else {
1872  j = w2-q2;
1873  }
1874  Transform(i,j,0);
1875  x2 = fXt;
1876  y2 = fYt;
1877  if (flag==1) {
1878  x = x1;
1879  y = y1;
1880  x1 = x2;
1881  y1 = y2;
1882  x2 = x;
1883  y2 = y;
1884  }
1885  switch (fDisplayMode) {
1886  case kDisplayModePoints:
1888  Envelope(x1,y1,x2,y2);
1889  if (y1<=fEnvelope[x1]) {
1890  line->PaintLine(gPad->PixeltoX(x1) ,gPad->PixeltoY(y1)+1,
1891  gPad->PixeltoX(x1+1),gPad->PixeltoY(y1)+1);
1892  }
1893  if (y2<=fEnvelope[x2]) {
1894  line->PaintLine(gPad->PixeltoX(x2) ,gPad->PixeltoY(y2)+1,
1895  gPad->PixeltoX(x2+1),gPad->PixeltoY(y2)+1);
1896  }
1897  } else {
1898  if ((q1!=q2||smer!=0) && flag==1) {
1899  s1 = q1+1;
1900  t1 = q2;
1901  s2 = q1;
1902  t2 = q2;
1903  s3 = q1;
1904  t3 = q2+1;
1905  s4 = q1+1;
1906  t4 = q2+1;
1907  if (fShading==kShaded) {
1908  sr1 = s1;
1909  tr1 = (Int_t)TMath::Max(t1-1,0);
1910  sr2 = s2;
1911  tr2 = (Int_t)TMath::Max(t2-1,0);
1912  sr3 = (Int_t)TMath::Max(s2-1,0);
1913  tr3 = t2;
1914  sr4 = (Int_t)TMath::Max(s3-1,0);
1915  tr4 = t3;
1916  sr5 = s3;
1917  tr5 = t3+1;
1918  sr6 = s4;
1919  tr6 = t4+1;
1920  sr7 = s4+1;
1921  tr7 = t4;
1922  sr8 = s1+1;
1923  tr8 = t1;
1924  }
1925  if (turni==1) {
1926  i1 = s1;
1927  i2 = s2;
1928  i3 = s3;
1929  i4 = s4;
1930  } else {
1931  i1 = (Int_t)TMath::Max(w1-s1,0);
1932  i2 = (Int_t)TMath::Max(w1-s2,0);
1933  i3 = (Int_t)TMath::Max(w1-s3,0);
1934  i4 = (Int_t)TMath::Max(w1-s4,0);
1935  if (fShading==kShaded) {
1936  sr1 = (Int_t)TMath::Max(w1-sr1,0);
1937  sr2 = (Int_t)TMath::Max(w1-sr2,0);
1938  sr3 = (Int_t)TMath::Max(w1-sr3,0);
1939  sr4 = (Int_t)TMath::Max(w1-sr4,0);
1940  sr5 = (Int_t)TMath::Max(w1-sr5,0);
1941  sr6 = (Int_t)TMath::Max(w1-sr6,0);
1942  sr7 = (Int_t)TMath::Max(w1-sr7,0);
1943  sr8 = (Int_t)TMath::Max(w1-sr8,0);
1944  }
1945  }
1946  if (turnj==1) {
1947  j1 = t1;
1948  j2 = t2;
1949  j3 = t3;
1950  j4 = t4;
1951  } else {
1952  j1 = (Int_t)TMath::Max(w2-t1,0);
1953  j2 = (Int_t)TMath::Max(w2-t2,0);
1954  j3 = (Int_t)TMath::Max(w2-t3,0);
1955  j4 = (Int_t)TMath::Max(w2-t4,0);
1956  if (fShading==kShaded) {
1957  tr1 = (Int_t)TMath::Max(w2-tr1,0);
1958  tr2 = (Int_t)TMath::Max(w2-tr2,0);
1959  tr3 = (Int_t)TMath::Max(w2-tr3,0);
1960  tr4 = (Int_t)TMath::Max(w2-tr4,0);
1961  tr5 = (Int_t)TMath::Max(w2-tr5,0);
1962  tr6 = (Int_t)TMath::Max(w2-tr6,0);
1963  tr7 = (Int_t)TMath::Max(w2-tr7,0);
1964  tr8 = (Int_t)TMath::Max(w2-tr8,0);
1965  }
1966  }
1967  Transform(i1,j1,0);
1968  x1 = fXt;
1969  y1 = fYt;
1970  dx1 = fDxspline;
1971  dy1 = fDyspline;
1972  z1 = fZ;
1973  Transform(i2,j2,0);
1974  x2 = fXt;
1975  y2 = fYt;
1976  dx2 = fDxspline;
1977  dy2 = fDyspline;
1978  z2 = fZ;
1979  Transform(i3,j3,0);
1980  x3 = fXt;
1981  y3 = fYt;
1982  dx3 = fDxspline;
1983  dy3 = fDyspline;
1984  z3 = fZ;
1985  Transform(i4,j4,0);
1986  x4 = fXt;
1987  y4 = fYt;
1988  dx4 = fDxspline;
1989  dy4 = fDyspline;
1990  z4 = fZ;
1991  Envelope(x1,y1,x2,y2);
1992  Envelope(x2,y2,x3,y3);
1993  xtaz = (dx1+dx2+dx4)/3;
1994  ytaz = (dy1+dy2+dy4)/3;
1995  ztaz = (z1+z2+z4)/3;
1996  v = ColorCalculation(dx1,dy1,z1,dx2,dy2,z2,dx4,dy4,z4);
1997  if (fShading==kShaded) {
1998  if (fShadow==kShadowsNotPainted) {
1999  if (sr1<0||sr1>w1||tr1<0||tr1>w2) Transform(sr1,tr1,-1);
2000  else Transform(sr1,tr1,0);
2001  dxr1 = fDxspline;
2002  dyr1 = fDyspline;
2003  zr1 = fZ;
2004  if (sr8<0||sr8>w1||tr8<0||tr8>w2) Transform(sr8,tr8,-1);
2005  else Transform(sr8,tr8,0);
2006  dxr2 = fDxspline;
2007  dyr2 = fDyspline;
2008  zr2 = fZ;
2009  v = v+ColorCalculation(dxr1,dyr1,zr1,dx2,dy2,z2,dx1,dy1,z1);
2010  v = v+ColorCalculation(dxr1,dyr1,zr1,dx1,dy1,z1,dxr2,dyr2,zr2);
2011  v = v+ColorCalculation(dxr2,dyr2,zr2,dx1,dy1,z1,dx4,dy4,z4);
2012  v1 = v/4;
2013  if (sr3<0||sr3>w1||tr3<0||tr3>w2) Transform(sr3,tr3,-1);
2014  else Transform(sr3,tr3,0);
2015  dxr1 = fDxspline;
2016  dyr1 = fDyspline;
2017  zr1 = fZ;
2018  if (sr2<0||sr2>w1||tr2<0||tr2>w2) Transform(sr2,tr2,-1);
2019  else Transform(sr2,tr2,0);
2020  dxr2 = fDxspline;
2021  dyr2 = fDyspline;
2022  zr2 = fZ;
2023  v = ColorCalculation(dx1,dy1,z1,dx2,dy2,z2,dx3,dy3,z3);
2024  v = v+ColorCalculation(dx2,dy2,z2,dxr1,dyr1,zr1,dx3,dy3,z3);
2025  v = v+ColorCalculation(dx2,dy2,z2,dxr2,dyr2,zr2,dxr1,dyr1,zr1);
2026  v = v+ColorCalculation(dxr2,dyr2,zr2,dx2,dy2,z2,dx1,dy1,z1);
2027  v2 = v/4;
2028  if (sr5<0||sr5>w1||tr5<0||tr5>w2) Transform(sr5,tr5,-1);
2029  else Transform(sr5,tr5,0);
2030  dxr1 = fDxspline;
2031  dyr1 = fDyspline;
2032  zr1 = fZ;
2033  if (sr4<0||sr4>w1||tr4<0||tr4>w2) Transform(sr4,tr4,-1);
2034  else Transform(sr4,tr4,0);
2035  dxr2 = fDxspline;
2036  dyr2 = fDyspline;
2037  zr2 = fZ;
2038  v = ColorCalculation(dx2,dy2,z2,dx3,dy3,z3,dx4,dy4,z4);
2039  v = v+ColorCalculation(dx4,dy4,z4,dx3,dy3,z3,dxr1,dyr1,zr1);
2040  v = v+ColorCalculation(dx3,dy3,z3,dxr2,dyr2,zr2,dxr1,dyr1,zr1);
2041  v = v+ColorCalculation(dx2,dy2,z2,dxr2,dyr2,zr2,dx3,dy3,z3);
2042  v3 = v/4;
2043  if (sr7<0||sr7>w1||tr7<0||tr7>w2) Transform(sr7,tr7,-1);
2044  else Transform(sr7,tr7,0);
2045  dxr1 = fDxspline;
2046  dyr1 = fDyspline;
2047  zr1 = fZ;
2048  if (sr6<0||sr6>w1||tr6<0||tr6>w2) Transform(sr6,tr6,-1);
2049  else Transform(sr6,tr6,0);
2050  dxr2 = fDxspline;
2051  dyr2 = fDyspline;
2052  zr2 = fZ;
2053  v = ColorCalculation(dx1,dy1,z1,dx3,dy3,z3,dx4,dy4,z4);
2054  v = v+ColorCalculation(dx4,dy4,z4,dx3,dy3,z3,dxr2,dyr2,zr2);
2055  v = v+ColorCalculation(dx4,dy4,z4,dxr2,dyr2,zr2,dxr1,dyr1,zr1);
2056  v = v+ColorCalculation(dx1,dy1,z1,dx4,dy4,z4,dxr1,dyr1,zr1);
2057  v4 = v/4;
2058  } else {
2059  spriz = ShadowColorCalculation(xtaz,ytaz,ztaz,shad_noise);
2060  v = v+spriz;
2061  v = v/2;
2062  if (sr1<0||sr1>w1||tr1<0||tr1>w2) Transform(sr1,tr1,-1);
2063  else Transform(sr1,tr1,0);
2064  dxr1 = fDxspline;
2065  dyr1 = fDyspline;
2066  zr1 = fZ;
2067  if (sr8<0||sr8>w1||tr8<0||tr8>w2) Transform(sr8,tr8,-1);
2068  else Transform(sr8,tr8,0);
2069  dxr2 = fDxspline;
2070  dyr2 = fDyspline;
2071  zr2 = fZ;
2072  da = (dxr1+dx2+dx1)/3;
2073  db = (dyr1+dy2+dy1)/3;
2074  dc = (zr1+z2+z1)/3;
2075  spriz = ShadowColorCalculation(da,db,dc,shad_noise);
2076  v = v+(ColorCalculation(dxr1,dyr1,zr1,dx2,dy2,z2,dx1,dy1,z1)+spriz)/2;
2077  da = (dxr1+dxr2+dx1)/3;
2078  db = (dyr1+dyr2+dy1)/3;
2079  dc = (zr1+zr2+z1)/3;
2080  spriz = ShadowColorCalculation(da,db,dc,shad_noise);
2081  v = v+(ColorCalculation(dxr1,dyr1,zr1,dx1,dy1,z1,dxr2,dyr2,zr2)+spriz)/2;
2082  da = (dxr2+dx1+dx4)/3;
2083  db = (dyr2+dy1+dy4)/3;
2084  dc = (zr2+z1+z4)/3;
2085  spriz = ShadowColorCalculation(da,db,dc,shad_noise);
2086  v = v+(ColorCalculation(dxr2,dyr2,zr2,dx1,dy1,z1,dx4,dy4,z4)+spriz)/2;
2087  v1 = v/4;
2088  if (sr3<0||sr3>w1||tr3<0||tr3>w2) Transform(sr3,tr3,-1);
2089  else Transform(sr3,tr3,0);
2090  dxr1 = fDxspline;
2091  dyr1 = fDyspline;
2092  zr1 = fZ;
2093  if (sr2<0||sr2>w1||tr2<0||tr2>w2) Transform(sr2,tr2,-1);
2094  else Transform(sr2,tr2,0);
2095  dxr2 = fDxspline;
2096  dyr2 = fDyspline;
2097  zr2 = fZ;
2098  da = (dx1+dx2+dx3)/3;
2099  db = (dy1+dy2+dy3)/3;
2100  dc = (z1+z2+z3)/3;
2101  spriz = ShadowColorCalculation(da,db,dc,shad_noise);
2102  v = (ColorCalculation(dx1,dy1,z1,dx2,dy2,z2,dx3,dy3,z3)+spriz)/2;
2103  da = (dx2+dxr1+dx3)/3;
2104  db = (dy2+dyr1+dy3)/3;
2105  dc = (z2+zr1+z3)/3;
2106  spriz = ShadowColorCalculation(da,db,dc,shad_noise);
2107  v = v+(ColorCalculation(dx2,dy2,z2,dxr1,dyr1,zr1,dx3,dy3,z3)+spriz)/2;
2108  da = (dx2+dxr2+dxr1)/3;
2109  db = (dy2+dyr2+dyr1)/3;
2110  dc = (z2+zr2+zr1)/3;
2111  spriz = ShadowColorCalculation(da,db,dc,shad_noise);
2112  v = v+(ColorCalculation(dx2,dy2,z2,dxr2,dyr2,zr2,dxr1,dyr1,zr1)+spriz)/2;
2113  da = (dxr2+dx2+dx1)/3;
2114  db = (dyr2+dy2+dy1)/3;
2115  dc = (zr2+z2+z1)/3;
2116  spriz = ShadowColorCalculation(da,db,dc,shad_noise);
2117  v = v+(ColorCalculation(dxr2,dyr2,zr2,dx2,dy2,z2,dx1,dy1,z1)+spriz)/2;
2118  v2 = v/4;
2119  if (sr5<0||sr5>w1||tr5<0||tr5>w2) Transform(sr5,tr5,-1);
2120  else Transform(sr5,tr5,0);
2121  dxr1 = fDxspline;
2122  dyr1 = fDyspline;
2123  zr1 = fZ;
2124  if (sr4<0||sr4>w1||tr4<0||tr4>w2) Transform(sr4,tr4,-1);
2125  else Transform(sr4,tr4,0);
2126  dxr2 = fDxspline;
2127  dyr2 = fDyspline;
2128  zr2 = fZ;
2129  da = (dx2+dx3+dx4)/3;
2130  db = (dy2+dy3+dy4)/3;
2131  dc = (z2+z3+z4)/3;
2132  spriz = ShadowColorCalculation(da,db,dc,shad_noise);
2133  v = (ColorCalculation(dx2,dy2,z2,dx3,dy3,z3,dx4,dy4,z4)+spriz)/2;
2134  da = (dx4+dx3+dxr1)/3;
2135  db = (dy4+dy3+dyr1)/3;
2136  dc = (z4+z3+zr1)/3;
2137  spriz = ShadowColorCalculation(da,db,dc,shad_noise);
2138  v = v+(ColorCalculation(dx4,dy4,z4,dx3,dy3,z3,dxr1,dyr1,zr1)+spriz)/2;
2139  da = (dx3+dxr2+dxr1)/3;
2140  db = (dy3+dyr2+dyr1)/3;
2141  dc = (z3+zr2+zr1)/3;
2142  spriz = ShadowColorCalculation(da,db,dc,shad_noise);
2143  v = v+(ColorCalculation(dx3,dy3,z3,dxr2,dyr2,zr2,dxr1,dyr1,zr1)+spriz)/2;
2144  da = (dx2+dxr2+dx3)/3;
2145  db = (dy2+dyr2+dy3)/3;
2146  dc = (z2+zr2+z3)/3;
2147  spriz = ShadowColorCalculation(da,db,dc,shad_noise);
2148  v = v+(ColorCalculation(dx2,dy2,z2,dxr2,dyr2,zr2,dx3,dy3,z3)+spriz)/2;
2149  v3 = v/4;
2150  if (sr7<0||sr7>w1||tr7<0||tr7>w2) Transform(sr7,tr7,-1);
2151  else Transform(sr7,tr7,0);
2152  dxr1 = fDxspline;
2153  dyr1 = fDyspline;
2154  zr1 = fZ;
2155  if (sr6<0||sr6>w1||tr6<0||tr6>w2) Transform(sr6,tr6,-1);
2156  else Transform(sr6,tr6,0);
2157  dxr2 = fDxspline;
2158  dyr2 = fDyspline;
2159  zr2 = fZ;
2160  da = (dx1+dx3+dx4)/3;
2161  db = (dy1+dy3+dy4)/3;
2162  dc = (z1+z3+z4)/3;
2163  spriz = ShadowColorCalculation(da,db,dc,shad_noise);
2164  v = (ColorCalculation(dx1,dy1,z1,dx3,dy3,z3,dx4,dy4,z4)+spriz)/2;
2165  da = (dx4+dx3+dxr2)/3;
2166  db = (dy4+dy3+dyr2)/3;
2167  dc = (z4+z3+zr2)/3;
2168  spriz = ShadowColorCalculation(da,db,dc,shad_noise);
2169  v = v+(ColorCalculation(dx4,dy4,z4,dx3,dy3,z3,dxr2,dyr2,zr2)+spriz)/2;
2170  da = (dx4+dxr2+dxr1)/3;
2171  db = (dy4+dyr2+dyr1)/3;
2172  dc = (z4+zr2+zr1)/3;
2173  spriz = ShadowColorCalculation(da,db,dc,shad_noise);
2174  v = v+(ColorCalculation(dx4,dy4,z4,dxr2,dyr2,zr2,dxr1,dyr1,zr1)+spriz)/2;
2175  da = (dx1+dx4+dxr1)/3;
2176  db = (dy1+dy4+dyr1)/3;
2177  dc = (z1+z4+zr1)/3;
2178  spriz = ShadowColorCalculation(da,db,dc,shad_noise);
2179  v = v+(ColorCalculation(dx1,dy1,z1,dx4,dy4,z4,dxr1,dyr1,zr1)+spriz)/2;
2180  v4 = v/4;
2181  }
2182  }
2183  spriz = 0;
2184  if (fShadow==kShadowsNotPainted) {
2185  if (fShading==kNotShaded) {
2186  v = v*fLevels+0.5;
2187  iv = fLevels-(Int_t)v;
2188  } else {
2189  v1 = v1*fLevels;
2190  iv1 = fLevels-(Int_t)v1;
2191  v2 = v2*fLevels;
2192  iv2 = fLevels-(Int_t)v2;
2193  v4 = v4*fLevels;
2194  iv4 = fLevels-(Int_t)v4;
2195  }
2196  } else {
2197  spriz = ShadowColorCalculation(xtaz,ytaz,ztaz,shad_noise);
2198  if (fShading==kNotShaded) {
2199  v = v*fLevels/2.0;
2200  iv = fLevels-(Int_t)(v+0.5);
2201  } else {
2202  v1 = v1*fLevels;
2203  iv1 = fLevels-(Int_t)v1;
2204  v2 = v2*fLevels;
2205  iv2 = fLevels-(Int_t)v2;
2206  v4 = v4*fLevels;
2207  iv4 = fLevels-(Int_t)v4;
2208  }
2209  }
2210  if (fShading==kNotShaded) {
2211  ColorModel(iv,ui1,ui2,ui3);
2213  if (fEnvelope[x1]>=y1) {
2214  line->PaintLine(gPad->PixeltoX(x1),gPad->PixeltoY(y1)+1,gPad->PixeltoX(x1+1),gPad->PixeltoY(y1)+1);
2215  fEnvelope[x1] = y1;
2216  }
2217  if (fEnvelope[x2]>=y2) {
2218  line->PaintLine(gPad->PixeltoX(x2),gPad->PixeltoY(y2)+1,gPad->PixeltoX(x2+1),gPad->PixeltoY(y2)+1);
2219  fEnvelope[x2] = y2;
2220  }
2221  if (fEnvelope[x4]>=y4) {
2222  line->PaintLine(gPad->PixeltoX(x4),gPad->PixeltoY(y4)+1,gPad->PixeltoX(x4+1),gPad->PixeltoY(y4)+1);
2223  fEnvelope[x4] = y4;
2224  }
2225  } else {
2226  if (fEnvelope[x1]>=y1) {
2227  iv = iv1;
2228  ColorModel(iv,ui1,ui2,ui3);
2230  line->PaintLine(gPad->PixeltoX(x1),gPad->PixeltoY(y1)+1,gPad->PixeltoX(x1+1),gPad->PixeltoY(y1)+1);
2231  fEnvelope[x1] = y1;
2232  }
2233  if (fEnvelope[x2]>=y2) {
2234  iv = iv2;
2235  ColorModel(iv,ui1,ui2,ui3);
2237  line->PaintLine(gPad->PixeltoX(x2),gPad->PixeltoY(y2)+1,gPad->PixeltoX(x2+1),gPad->PixeltoY(y2)+1);
2238  fEnvelope[x2]=y2;
2239  }
2240  if (fEnvelope[x4]>=y4) {
2241  iv = iv4;
2242  ColorModel(iv,ui1,ui2,ui3);
2244  line->PaintLine(gPad->PixeltoX(x4),gPad->PixeltoY(y4)+1,gPad->PixeltoX(x4+1),gPad->PixeltoY(y4)+1);
2245  fEnvelope[x4] = y4;
2246  }
2247  }
2248  xtaz = (dx3+dx2+dx4)/3;
2249  ytaz = (dy3+dy2+dy4)/3;
2250  ztaz = (z3+z2+z4)/3;
2251  if (fShading==kNotShaded) v=ColorCalculation(dx2,dy2,z2,dx3,dy3,z3,dx4,dy4,z4);
2252  spriz = 0;
2253  if (fShadow==kShadowsNotPainted) {
2254  if (fShading==kNotShaded) {
2255  v = v*fLevels;
2256  iv = fLevels-(Int_t)v;
2257  } else {
2258  v3 = v3*fLevels;
2259  iv3 = fLevels-(Int_t)v3;
2260  }
2261  } else {
2262  spriz = ShadowColorCalculation(xtaz,ytaz,ztaz,shad_noise);
2263  if (fShading==kNotShaded) {
2264  v = v*fLevels/2;
2265  iv = fLevels-(Int_t)v;
2266  iv = (Int_t)(iv-fLevels*spriz/2);
2267  } else {
2268  v3 = v3*fLevels;
2269  iv3 = fLevels-(Int_t)v3;
2270  }
2271  }
2272  if (fShading==kNotShaded) {
2273  ColorModel(iv,ui1,ui2,ui3);
2274  line->ResetAttLine("");
2276  if (fEnvelope[x3]>=y3) {
2277  line->PaintLine(gPad->PixeltoX(x3),gPad->PixeltoY(y3)+1,gPad->PixeltoX(x3+1),gPad->PixeltoY(y3)+1);
2278  fEnvelope[x3] = y3;
2279  }
2280  } else {
2281  if (fEnvelope[x3]>=y3) {
2282  iv = iv3;
2283  ColorModel(iv,ui1,ui2,ui3);
2284  line->ResetAttLine("");
2286  line->PaintLine(gPad->PixeltoX(x3),gPad->PixeltoY(y3)+1,gPad->PixeltoX(x3+1),gPad->PixeltoY(y3)+1);
2287  fEnvelope[x3]=y3;
2288  }
2289  }
2290  }
2291  }
2292  break;
2293  case kDisplayModeGrid:
2294  if (fBezier==kNoBezierInterpol) {
2296  Envelope(x1,y1,x2,y2);
2297  if (fLine!=0) {
2298  if (fLine==1) {
2299  fXe = x2;
2300  fYe = y2;
2301  }
2302  line->PaintLine(gPad->PixeltoX(fXs),gPad->PixeltoY(fYs)+1,gPad->PixeltoX(fXe),gPad->PixeltoY(fYe)+1);
2303  }
2304  } else {
2305  if ((q1!=q2||smer!=0)&&flag==1) {
2306  s1 = q1+1;
2307  t1 = q2;
2308  s2 = q1;
2309  t2 = q2;
2310  s3 = q1;
2311  t3 = q2+1;
2312  s4 = q1+1;
2313  t4 = q2+1;
2314  if (fShading==kShaded) {
2315  sr1 = s1;
2316  tr1 = (Int_t)TMath::Max(t1-1,0);
2317  sr2 = s2;
2318  tr2 = (Int_t)TMath::Max(t2-1,0);
2319  sr3 = (Int_t)TMath::Max(s2-1,0);
2320  tr3 = t2;
2321  sr4 = (Int_t)TMath::Max(s3-1,0);
2322  tr4 = t3;
2323  sr5 = s3;
2324  tr5 = t3+1;
2325  sr6 = s4;
2326  tr6 = t4+1;
2327  sr7 = s4+1;
2328  tr7 = t4;
2329  sr8 = s1+1;
2330  tr8 = t1;
2331  }
2332  if (turni==1) {
2333  i1 = s1;
2334  i2 = s2;
2335  i3 = s3;
2336  i4 = s4;
2337  } else {
2338  i1 = (Int_t)TMath::Max(w1-s1,0);
2339  i2 = (Int_t)TMath::Max(w1-s2,0);
2340  i3 = (Int_t)TMath::Max(w1-s3,0);
2341  i4 = (Int_t)TMath::Max(w1-s4,0);
2342  if (fShading==kShaded) {
2343  sr1 = (Int_t)TMath::Max(w1-sr1,0);
2344  sr2 = (Int_t)TMath::Max(w1-sr2,0);
2345  sr3 = (Int_t)TMath::Max(w1-sr3,0);
2346  sr4 = (Int_t)TMath::Max(w1-sr4,0);
2347  sr5 = (Int_t)TMath::Max(w1-sr5,0);
2348  sr6 = (Int_t)TMath::Max(w1-sr6,0);
2349  sr7 = (Int_t)TMath::Max(w1-sr7,0);
2350  sr8 = (Int_t)TMath::Max(w1-sr8,0);
2351  }
2352  }
2353  if (turnj==1) {
2354  j1 = t1;
2355  j2 = t2;
2356  j3 = t3;
2357  j4 = t4;
2358  } else {
2359  j1 = (Int_t)TMath::Max(w2-t1,0);
2360  j2 = (Int_t)TMath::Max(w2-t2,0);
2361  j3 = (Int_t)TMath::Max(w2-t3,0);
2362  j4 = (Int_t)TMath::Max(w2-t4,0);
2363  if (fShading==kShaded) {
2364  tr1 = (Int_t)TMath::Max(w2-tr1,0);
2365  tr2 = (Int_t)TMath::Max(w2-tr2,0);
2366  tr3 = (Int_t)TMath::Max(w2-tr3,0);
2367  tr4 = (Int_t)TMath::Max(w2-tr4,0);
2368  tr5 = (Int_t)TMath::Max(w2-tr5,0);
2369  tr6 = (Int_t)TMath::Max(w2-tr6,0);
2370  tr7 = (Int_t)TMath::Max(w2-tr7,0);
2371  tr8 = (Int_t)TMath::Max(w2-tr8,0);
2372  }
2373  }
2374  Transform(i1,j1,0);
2375  x1 = fXt;
2376  y1 = fYt;
2377  dx1 = fDxspline;
2378  dy1 = fDyspline;
2379  z1 = fZ;
2380  Transform(i2,j2,0);
2381  x2 = fXt;
2382  y2 = fYt;
2383  dx2 = fDxspline;
2384  dy2 = fDyspline;
2385  z2 = fZ;
2386  Transform(i3,j3,0);
2387  x3 = fXt;
2388  y3 = fYt;
2389  dx3 = fDxspline;
2390  dy3 = fDyspline;
2391  z3 = fZ;
2392  Transform(i4,j4,0);
2393  x4 = fXt;
2394  y4 = fYt;
2395  dx4 = fDxspline;
2396  dy4 = fDyspline;
2397  z4 = fZ;
2398  Envelope(x1,y1,x2,y2);
2399  Envelope(x2,y2,x3,y3);
2400  xtaz = (dx1+dx2+dx4)/3;
2401  ytaz = (dy1+dy2+dy4)/3;
2402  ztaz = (z1+z2+z4)/3;
2403  v = ColorCalculation(dx1,dy1,z1,dx2,dy2,z2,dx4,dy4,z4);
2404  if (fShading==kShaded) {
2405  if (fShadow==kShadowsNotPainted) {
2406  if (sr1<0||sr1>w1||tr1<0||tr1>w2) Transform(sr1,tr1,-1);
2407  else Transform(sr1,tr1,0);
2408  dxr1 = fDxspline;
2409  dyr1 = fDyspline;
2410  zr1 = fZ;
2411  if (sr8<0||sr8>w1||tr8<0||tr8>w2) Transform(sr8,tr8,-1);
2412  else Transform(sr8,tr8,0);
2413  dxr2 = fDxspline;
2414  dyr2 = fDyspline;
2415  zr2 = fZ;
2416  v = v+ColorCalculation(dxr1,dyr1,zr1,dx2,dy2,z2,dx1,dy1,z1);
2417  v = v+ColorCalculation(dxr1,dyr1,zr1,dx1,dy1,z1,dxr2,dyr2,zr2);
2418  v = v+ColorCalculation(dxr2,dyr2,zr2,dx1,dy1,z1,dx4,dy4,z4);
2419  v1 = v/4;
2420  if (sr3<0||sr3>w1||tr3<0||tr3>w2) Transform(sr3,tr3,-1);
2421  else Transform(sr3,tr3,0);
2422  dxr1 = fDxspline;
2423  dyr1 = fDyspline;
2424  zr1 = fZ;
2425  if (sr2<0||sr2>w1||tr2<0||tr2>w2) Transform(sr2,tr2,-1);
2426  else Transform(sr2,tr2,0);
2427  dxr2 = fDxspline;
2428  dyr2 = fDyspline;
2429  zr2 = fZ;
2430  v = ColorCalculation(dx1,dy1,z1,dx2,dy2,z2,dx3,dy3,z3);
2431  v = v+ColorCalculation(dx2,dy2,z2,dxr1,dyr1,zr1,dx3,dy3,z3);
2432  v = v+ColorCalculation(dx2,dy2,z2,dxr2,dyr2,zr2,dxr1,dyr1,zr1);
2433  v = v+ColorCalculation(dxr2,dyr2,zr2,dx2,dy2,z2,dx1,dy1,z1);
2434  v2 = v/4;
2435  if (sr5<0||sr5>w1||tr5<0||tr5>w2) Transform(sr5,tr5,-1);
2436  else Transform(sr5,tr5,0);
2437  dxr1 = fDxspline;
2438  dyr1 = fDyspline;
2439  zr1 = fZ;
2440  if (sr4<0||sr4>w1||tr4<0||tr4>w2) Transform(sr4,tr4,-1);
2441  else Transform(sr4,tr4,0);
2442  dxr2 = fDxspline;
2443  dyr2 = fDyspline;
2444  zr2 = fZ;
2445  v = ColorCalculation(dx2,dy2,z2,dx3,dy3,z3,dx4,dy4,z4);
2446  v = v+ColorCalculation(dx4,dy4,z4,dx3,dy3,z3,dxr1,dyr1,zr1);
2447  v = v+ColorCalculation(dx3,dy3,z3,dxr2,dyr2,zr2,dxr1,dyr1,zr1);
2448  v = v+ColorCalculation(dx2,dy2,z2,dxr2,dyr2,zr2,dx3,dy3,z3);
2449  v3 = v/4;
2450  if (sr7<0||sr7>w1||tr7<0||tr7>w2) Transform(sr7,tr7,-1);
2451  else Transform(sr7,tr7,0);
2452  dxr1 = fDxspline;
2453  dyr1 = fDyspline;
2454  zr1 = fZ;
2455  if (sr6<0||sr6>w1||tr6<0||tr6>w2) Transform(sr6,tr6,-1);
2456  else Transform(sr6,tr6,0);
2457  dxr2 = fDxspline;
2458  dyr2 = fDyspline;
2459  zr2 = fZ;
2460  v = ColorCalculation(dx1,dy1,z1,dx3,dy3,z3,dx4,dy4,z4);
2461  v = v+ColorCalculation(dx4,dy4,z4,dx3,dy3,z3,dxr2,dyr2,zr2);
2462  v = v+ColorCalculation(dx4,dy4,z4,dxr2,dyr2,zr2,dxr1,dyr1,zr1);
2463  v = v+ColorCalculation(dx1,dy1,z1,dx4,dy4,z4,dxr1,dyr1,zr1);
2464  v4 = v/4;
2465  } else {
2466  spriz = ShadowColorCalculation(xtaz,ytaz,ztaz,shad_noise);
2467  v = v+spriz;
2468  v = v/2;
2469  if (sr1<0||sr1>w1||tr1<0||tr1>w2) Transform(sr1,tr1,-1);
2470  else Transform(sr1,tr1,0);
2471  dxr1 = fDxspline;
2472  dyr1 = fDyspline;
2473  zr1 = fZ;
2474  if (sr8<0||sr8>w1||tr8<0||tr8>w2) Transform(sr8,tr8,-1);
2475  else Transform(sr8,tr8,0);
2476  dxr2 = fDxspline;
2477  dyr2 = fDyspline;
2478  zr2 = fZ;
2479  da = (dxr1+dx2+dx1)/3;
2480  db = (dyr1+dy2+dy1)/3;
2481  dc = (zr1+z2+z1)/3;
2482  spriz = ShadowColorCalculation(da,db,dc,shad_noise);
2483  v = v+(ColorCalculation(dxr1,dyr1,zr1,dx2,dy2,z2,dx1,dy1,z1)+spriz)/2;
2484  da = (dxr1+dxr2+dx1)/3;
2485  db = (dyr1+dyr2+dy1)/3;
2486  dc = (zr1+zr2+z1)/3;
2487  spriz = ShadowColorCalculation(da,db,dc,shad_noise);
2488  v = v+(ColorCalculation(dxr1,dyr1,zr1,dx1,dy1,z1,dxr2,dyr2,zr2)+spriz)/2;
2489  da = (dxr2+dx1+dx4)/3;
2490  db = (dyr2+dy1+dy4)/3;
2491  dc = (zr2+z1+z4)/3;
2492  spriz = ShadowColorCalculation(da,db,dc,shad_noise);
2493  v = v+(ColorCalculation(dxr2,dyr2,zr2,dx1,dy1,z1,dx4,dy4,z4)+spriz)/2;
2494  v1 = v/4;
2495  if (sr3<0||sr3>w1||tr3<0||tr3>w2) Transform(sr3,tr3,-1);
2496  else Transform(sr3,tr3,0);
2497  dxr1 = fDxspline;
2498  dyr1 = fDyspline;
2499  zr1 = fZ;
2500  if (sr2<0||sr2>w1||tr2<0||tr2>w2) Transform(sr2,tr2,-1);
2501  else Transform(sr2,tr2,0);
2502  dxr2 = fDxspline;
2503  dyr2 = fDyspline;
2504  zr2 = fZ;
2505  da = (dx1+dx2+dx3)/3;
2506  db = (dy1+dy2+dy3)/3;
2507  dc = (z1+z2+z3)/3;
2508  spriz = ShadowColorCalculation(da,db,dc,shad_noise);
2509  v = (ColorCalculation(dx1,dy1,z1,dx2,dy2,z2,dx3,dy3,z3)+spriz)/2;
2510  da = (dx2+dxr1+dx3)/3;
2511  db = (dy2+dyr1+dy3)/3;
2512  dc = (z2+zr1+z3)/3;
2513  spriz = ShadowColorCalculation(da,db,dc,shad_noise);
2514  v = v+(ColorCalculation(dx2,dy2,z2,dxr1,dyr1,zr1,dx3,dy3,z3)+spriz)/2;
2515  da = (dx2+dxr2+dxr1)/3;
2516  db = (dy2+dyr2+dyr1)/3;
2517  dc = (z2+zr2+zr1)/3;
2518  spriz = ShadowColorCalculation(da,db,dc,shad_noise);
2519  v = v+(ColorCalculation(dx2,dy2,z2,dxr2,dyr2,zr2,dxr1,dyr1,zr1)+spriz)/2;
2520  da = (dxr2+dx2+dx1)/3;
2521  db = (dyr2+dy2+dy1)/3;
2522  dc = (zr2+z2+z1)/3;
2523  spriz = ShadowColorCalculation(da,db,dc,shad_noise);
2524  v = v+(ColorCalculation(dxr2,dyr2,zr2,dx2,dy2,z2,dx1,dy1,z1)+spriz)/2;
2525  v2 = v/4;
2526  if (sr5<0||sr5>w1||tr5<0||tr5>w2) Transform(sr5,tr5,-1);
2527  else Transform(sr5,tr5,0);
2528  dxr1 = fDxspline;
2529  dyr1 = fDyspline;
2530  zr1 = fZ;
2531  if (sr4<0||sr4>w1||tr4<0||tr4>w2) Transform(sr4,tr4,-1);
2532  else Transform(sr4,tr4,0);
2533  dxr2 = fDxspline;
2534  dyr2 = fDyspline;
2535  zr2 = fZ;
2536  da = (dx2+dx3+dx4)/3;
2537  db = (dy2+dy3+dy4)/3;
2538  dc = (z2+z3+z4)/3;
2539  spriz = ShadowColorCalculation(da,db,dc,shad_noise);
2540  v = (ColorCalculation(dx2,dy2,z2,dx3,dy3,z3,dx4,dy4,z4)+spriz)/2;
2541  da = (dx4+dx3+dxr1)/3;
2542  db = (dy4+dy3+dyr1)/3;
2543  dc = (z4+z3+zr1)/3;
2544  spriz = ShadowColorCalculation(da,db,dc,shad_noise);
2545  v = v+(ColorCalculation(dx4,dy4,z4,dx3,dy3,z3,dxr1,dyr1,zr1)+spriz)/2;
2546  da = (dx3+dxr2+dxr1)/3;
2547  db = (dy3+dyr2+dyr1)/3;
2548  dc = (z3+zr2+zr1)/3;
2549  spriz = ShadowColorCalculation(da,db,dc,shad_noise);
2550  v = v+(ColorCalculation(dx3,dy3,z3,dxr2,dyr2,zr2,dxr1,dyr1,zr1)+spriz)/2;
2551  da = (dx2+dxr2+dx3)/3;
2552  db = (dy2+dyr2+dy3)/3;
2553  dc = (z2+zr2+z3)/3;
2554  spriz = ShadowColorCalculation(da,db,dc,shad_noise);
2555  v = v+(ColorCalculation(dx2,dy2,z2,dxr2,dyr2,zr2,dx3,dy3,z3)+spriz)/2;
2556  v3 = v/4;
2557  if (sr7<0||sr7>w1||tr7<0||tr7>w2) Transform(sr7,tr7,-1);
2558  else Transform(sr7,tr7,0);
2559  dxr1 = fDxspline;
2560  dyr1 = fDyspline;
2561  zr1 = fZ;
2562  if (sr6<0||sr6>w1||tr6<0||tr6>w2) Transform(sr6,tr6,-1);
2563  else Transform(sr6,tr6,0);
2564  dxr2 = fDxspline;
2565  dyr2 = fDyspline;
2566  zr2 = fZ;
2567  da = (dx1+dx3+dx4)/3;
2568  db = (dy1+dy3+dy4)/3;
2569  dc = (z1+z3+z4)/3;
2570  spriz = ShadowColorCalculation(da,db,dc,shad_noise);
2571  v = (ColorCalculation(dx1,dy1,z1,dx3,dy3,z3,dx4,dy4,z4)+spriz)/2;
2572  da = (dx4+dx3+dxr2)/3;
2573  db = (dy4+dy3+dyr2)/3;
2574  dc = (z4+z3+zr2)/3;
2575  spriz = ShadowColorCalculation(da,db,dc,shad_noise);
2576  v = v+(ColorCalculation(dx4,dy4,z4,dx3,dy3,z3,dxr2,dyr2,zr2)+spriz)/2;
2577  da = (dx4+dxr2+dxr1)/3;
2578  db = (dy4+dyr2+dyr1)/3;
2579  dc = (z4+zr2+zr1)/3;
2580  spriz = ShadowColorCalculation(da,db,dc,shad_noise);
2581  v = v+(ColorCalculation(dx4,dy4,z4,dxr2,dyr2,zr2,dxr1,dyr1,zr1)+spriz)/2;
2582  da = (dx1+dx4+dxr1)/3;
2583  db = (dy1+dy4+dyr1)/3;
2584  dc = (z1+z4+zr1)/3;
2585  spriz = ShadowColorCalculation(da,db,dc,shad_noise);
2586  v = v+(ColorCalculation(dx1,dy1,z1,dx4,dy4,z4,dxr1,dyr1,zr1)+spriz)/2;
2587  v4 = v/4;
2588  }
2589  }
2590  spriz = 0;
2591  if (fShadow==kShadowsNotPainted) {
2592  if (fShading==kNotShaded) {
2593  v = v*fLevels+0.5;
2594  iv = fLevels-(Int_t)v;
2595  } else {
2596  v1 = v1*fLevels;
2597  iv1 = fLevels-(Int_t)v1;
2598  v2 = v2*fLevels;
2599  iv2 = fLevels-(Int_t)v2;
2600  v4 = v4*fLevels;
2601  iv4 = fLevels-(Int_t)v4;
2602  }
2603  } else {
2604  spriz = ShadowColorCalculation(xtaz,ytaz,ztaz,shad_noise);
2605  if (fShading==kNotShaded) {
2606  v = v*fLevels/2.0;
2607  iv = fLevels-(Int_t)(v+0.5);
2608  } else {
2609  v1 = v1*fLevels;
2610  iv1 = fLevels-(Int_t)v1;
2611  v2 = v2*fLevels;
2612  iv2 = fLevels-(Int_t)v2;
2613  v4 = v4*fLevels;
2614  iv4 = fLevels-(Int_t)v4;
2615  }
2616  }
2617  if (fShading==kNotShaded) {
2618  ColorModel(iv,ui1,ui2,ui3);
2620  } else {
2621  dx1 = x1;
2622  dy1 = y1;
2623  dx2 = x2;
2624  dy2 = y2;
2625  dx3 = x4;
2626  dy3 = y4;
2627  z1 = iv1;
2628  z2 = iv2;
2629  z3 = iv4;
2630  da = (dy2-dy1)*(z3-z1)-(dy3-dy1)*(z2-z1);
2631  db = (z2-z1)*(dx3-dx1)-(z3-z1)*(dx2-dx1);
2632  dc = (dx2-dx1)*(dy3-dy1)-(dx3-dx1)*(dy2-dy1);
2633  dd = -da*dx1-db*dy1-dc*z1;
2634  }
2635  sx1 = x1;
2636  sy1 = y1;
2637  sx2 = x2;
2638  sy2 = y2;
2639  if (sx2<sx1) {
2640  sx4 = sx1;
2641  sy4 = sy1;
2642  sx1 = sx2;
2643  sy1 = sy2;
2644  sx2 = sx4;
2645  sy2 = sy4;
2646  }
2647  sdx1 = 0;
2648  pom1 = sy2-sy1;
2649  pom2 = sx2-sx1;
2650  if (pom2!=0) sdx1 = pom1/pom2;
2651  pom1 = sy1;
2652  pom2 = sx1;
2653  sdy1 = pom1-sdx1*pom2;
2654  for (sx4=sx1,sx5=sx1,sy5=sy1;sx4<=sx2;sx4++) {
2655  pom1 = sx4;
2656  sdy4 = sdx1*pom1+sdy1;
2657  sy4 = (Int_t)(sdy4);
2658  if (sy4<=fEnvelope[sx4]) {
2659  fEnvelope[sx4] = sy4;
2660  if (fShading==kNotShaded) {
2661  line->PaintLine(gPad->PixeltoX(sx4),gPad->PixeltoY(sy4)+1,gPad->PixeltoX(sx5),gPad->PixeltoY(sy5)+1);
2662  } else {
2663  dx1 = sx4;
2664  dy1 = sy4;
2665  if (dc!=0) v = (-dd-da*dx1-db*dy1)/dc;
2666  else v = (iv1+iv2+iv4)/3;
2667  iv = (Int_t)v;
2668  ColorModel(iv,ui1,ui2,ui3);
2670  line->PaintLine(gPad->PixeltoX(sx4),gPad->PixeltoY(sy4)+1,gPad->PixeltoX(sx5),gPad->PixeltoY(sy5)+1);
2671  }
2672  sy5 = sy4;
2673  } else {
2674  sy4 = fEnvelope[sx4];
2675  if (fShading==kNotShaded&&sy5<=fEnvelope[sx5]) {
2676  line->PaintLine(gPad->PixeltoX(sx4),gPad->PixeltoY(sy4)+1,gPad->PixeltoX(sx5),gPad->PixeltoY(sy5)+1);
2677  } else if (sy5<=fEnvelope[sx5]) {
2678  dx1 = sx4;
2679  dy1 = sy4;
2680  if (dc!=0) v = (-dd-da*dx1-db*dy1)/dc;
2681  else v = (iv1+iv2+iv4)/3;
2682  iv = (Int_t)v;
2683  ColorModel(iv,ui1,ui2,ui3);
2685  line->PaintLine(gPad->PixeltoX(sx4),gPad->PixeltoY(sy4)+1,gPad->PixeltoX(sx5),gPad->PixeltoY(sy5)+1);
2686  }
2687  sy5 = fEnvelope[sx4];
2688  }
2689  sx5 = sx4;
2690  }
2691  sx1 = x1;
2692  sy1 = y1;
2693  sx3 = x4;
2694  sy3 = y4;
2695  if (sx3<sx1) {
2696  sx4 = sx1;
2697  sy4 = sy1;
2698  sx1 = sx3;
2699  sy1 = sy3;
2700  sx3 = sx4;
2701  sy3 = sy4;
2702  }
2703  pom1 = sy3-sy1;
2704  pom2 = sx3-sx1;
2705  if (pom2!=0) sdx2 = pom1/pom2;
2706  pom1 = sy1;
2707  pom2 = sx1;
2708  sdy2 = pom1-sdx2*pom2;
2709  sx1p = sx1;
2710  sy1p = sy1;
2711  sx3p = sx3;
2712  sdx2p = sdx2;
2713  sdy2p = sdy2;
2714  dap = da;
2715  dbp = db;
2716  dcp = dc;
2717  ddp = dd;
2718  uip = fNewColorIndex;
2719  xtaz = (dx3+dx2+dx4)/3;
2720  ytaz = (dy3+dy2+dy4)/3;
2721  ztaz = (z3+z2+z4)/3;
2722  if (fShading==kNotShaded) v = ColorCalculation(dx2,dy2,z2,dx3,dy3,z3,dx4,dy4,z4);
2723  spriz = 0;
2724  if (fShadow==kShadowsNotPainted) {
2725  if (fShading==kNotShaded) {
2726  v = v*fLevels;
2727  iv = fLevels-(Int_t)v;
2728  } else {
2729  v3 = v3*fLevels;
2730  iv3 = fLevels-(Int_t)v3;
2731  }
2732  } else {
2733  spriz = ShadowColorCalculation(xtaz,ytaz,ztaz,shad_noise);
2734  if (fShading==kNotShaded) {
2735  v = v*fLevels/2;
2736  iv = fLevels-(Int_t)v;
2737  iv = (Int_t)(iv-fLevels*spriz/2);
2738  } else {
2739  v3 = v3*fLevels;
2740  iv3 = fLevels-(Int_t)v3;
2741  }
2742  }
2743  if (fShading==kNotShaded) {
2744  ColorModel(iv,ui1,ui2,ui3);
2746  } else {
2747  dx1 = x2;
2748  dy1 = y2;
2749  dx2 = x3;
2750  dy2 = y3;
2751  dx3 = x4;
2752  dy3 = y4;
2753  z1 = iv2;
2754  z2 = iv3;
2755  z3 = iv4;
2756  da = (dy2-dy1)*(z3-z1)-(dy3-dy1)*(z2-z1);
2757  db = (z2-z1)*(dx3-dx1)-(z3-z1)*(dx2-dx1);
2758  dc = (dx2-dx1)*(dy3-dy1)-(dx3-dx1)*(dy2-dy1);
2759  dd = -da*dx1-db*dy1-dc*z1;
2760  }
2761  sx1 = x2;
2762  sy1 = y2;
2763  sx2 = x3;
2764  sy2 = y3;
2765  if (sx2<sx1) {
2766  sx4 = sx1;
2767  sy4 = sy1;
2768  sx1 = sx2;
2769  sy1 = sy2;
2770  sx2 = sx4;
2771  sy2 = sy4;
2772  }
2773  pom1 = sy2-sy1;
2774  pom2 = sx2-sx1;
2775  sdx1 = 0;
2776  if (pom2!=0) sdx1 = pom1/pom2;
2777  pom1 = sy1;
2778  pom2 = sx1;
2779  sdy1 = pom1-sdx1*pom2;
2780  for (sx4=sx1,sx5=sx1,sy5=sy1;sx4<=sx2;sx4++) {
2781  pom1 = sx4;
2782  sdy4 = sdx1*pom1+sdy1;
2783  sy4 = (Int_t)sdy4;
2784  if (sy4<=fEnvelope[sx4]) {
2785  fEnvelope[sx4] = sy4;
2786  if (fShading==kNotShaded) {
2787  line->PaintLine(gPad->PixeltoX(sx4),gPad->PixeltoY(sy4)+1,gPad->PixeltoX(sx5),gPad->PixeltoY(sy5)+1);
2788  } else {
2789  dx1 = sx4;
2790  dy1 = sy4;
2791  if (dc!=0) v = (-dd-da*dx1-db*dy1)/dc;
2792  else v = (iv1+iv2+iv4)/3;
2793  iv = (Int_t)v;
2794  ColorModel(iv,ui1,ui2,ui3);
2796  line->PaintLine(gPad->PixeltoX(sx4),gPad->PixeltoY(sy4)+1,gPad->PixeltoX(sx5),gPad->PixeltoY(sy5)+1);
2797  }
2798  sy5 = sy4;
2799  } else {
2800  sy4 = fEnvelope[sx4];
2801  if (fShading==kNotShaded&&sy5<=fEnvelope[sx5]) {
2802  line->PaintLine(gPad->PixeltoX(sx4),gPad->PixeltoY(sy4)+1,gPad->PixeltoX(sx5),gPad->PixeltoY(sy5)+1);
2803  } else if (sy5<=fEnvelope[sx5]) {
2804  dx1 = sx4;
2805  dy1 = sy4;
2806  if (dc!=0) v = (-dd-da*dx1-db*dy1)/dc;
2807  else v = (iv1+iv2+iv4)/3;
2808  iv = (Int_t)v;
2809  ColorModel(iv,ui1,ui2,ui3);
2811  line->PaintLine(gPad->PixeltoX(sx4),gPad->PixeltoY(sy4)+1,gPad->PixeltoX(sx5),gPad->PixeltoY(sy5)+1);
2812  }
2813  sy5 = fEnvelope[sx4];
2814  }
2815  sx5 = sx4;
2816  }
2817  for (sx4=sx1p,sx5=sx1p,sy5=sy1p;sx4<=sx3p;sx4++) {
2818  pom1 = sx4;
2819  sdy4 = sdx2p*pom1+sdy2p;
2820  sy4 = (Int_t)sdy4;
2821  if (sy4<=fEnvelope[sx4]) {
2822  fEnvelope[sx4]=sy4;
2823  if (fShading==kNotShaded) {
2824  line->SetLineColor(uip);
2825  line->PaintLine(gPad->PixeltoX(sx4),gPad->PixeltoY(sy4)+1,gPad->PixeltoX(sx5),gPad->PixeltoY(sy5)+1);
2826  } else {
2827  dx1 = sx4;
2828  dy1 = sy4;
2829  if (dcp!=0) v = (-ddp-dap*dx1-dbp*dy1)/dcp;
2830  else v = (iv1+iv2+iv4)/3;
2831  iv = (Int_t)v;
2832  ColorModel(iv,ui1,ui2,ui3);
2834  line->PaintLine(gPad->PixeltoX(sx4),gPad->PixeltoY(sy4)+1,gPad->PixeltoX(sx5),gPad->PixeltoY(sy5)+1);
2835  }
2836  sy5 = sy4;
2837  } else {
2838  sy4 = fEnvelope[sx4];
2839  if (fShading==kNotShaded&&sy5<=fEnvelope[sx5]) {
2840  line->SetLineColor(uip);
2841  line->PaintLine(gPad->PixeltoX(sx4),gPad->PixeltoY(sy4)+1,gPad->PixeltoX(sx5),gPad->PixeltoY(sy5)+1);
2842  } else if (sy5<=fEnvelope[sx5]) {
2843  dx1 = sx4;
2844  dy1 = sy4;
2845  if (dcp!=0) v = (-ddp-dap*dx1-dbp*dy1)/dcp;
2846  else v = (iv1+iv2+iv4)/3;
2847  iv = (Int_t)v;
2848  ColorModel(iv,ui1,ui2,ui3);
2850  line->PaintLine(gPad->PixeltoX(sx4),gPad->PixeltoY(sy4)+1,gPad->PixeltoX(sx5),gPad->PixeltoY(sy5)+1);
2851  }
2852  sy5 = fEnvelope[sx4];
2853  }
2854  sx5 = sx4;
2855  }
2856  sx2 = x3;
2857  sy2 = y3;
2858  sx3 = x4;
2859  sy3 = y4;
2860  if (sx3<sx2) {
2861  sx4 = sx2;
2862  sy4 = sy2;
2863  sx2 = sx3;
2864  sy2 = sy3;
2865  sx3 = sx4;
2866  sy3 = sy4;
2867  }
2868  sdx2 = 0;
2869  pom1 = sy3-sy2;
2870  pom2 = sx3-sx2;
2871  if (pom2!=0) sdx2 = pom1/pom2;
2872  pom1 = sy2;
2873  pom2 = sx2;
2874  sdy2 = pom1-sdx2*pom2;
2875  for (sx4=sx2,sx5=sx2,sy5=sy2;sx4<=sx3;sx4++) {
2876  pom1 = sx4;
2877  sdy4 = sdx2*pom1+sdy2;
2878  sy4 = (Int_t)sdy4;
2879  if (sy4<=fEnvelope[sx4]) {
2880  fEnvelope[sx4] = sy4;
2881  if (fShading==kNotShaded) {
2882  line->PaintLine(gPad->PixeltoX(sx4),gPad->PixeltoY(sy4)+1,gPad->PixeltoX(sx5),gPad->PixeltoY(sy5)+1);
2883  } else {
2884  dx1 = sx4;
2885  dy1 = sy4;
2886  if (dc!=0) v = (-dd-da*dx1-db*dy1)/dc;
2887  else v =(iv1+iv2+iv4)/3;
2888  iv = (Int_t)v;
2889  ColorModel(iv,ui1,ui2,ui3);
2891  line->PaintLine(gPad->PixeltoX(sx4),gPad->PixeltoY(sy4)+1,gPad->PixeltoX(sx5),gPad->PixeltoY(sy5)+1);
2892  }
2893  sy5 = sy4;
2894  } else {
2895  sy4 = fEnvelope[sx4];
2896  if (fShading==kNotShaded&&sy5<=fEnvelope[sx5]) {
2897  line->PaintLine(gPad->PixeltoX(sx4),gPad->PixeltoY(sy4)+1,gPad->PixeltoX(sx5),gPad->PixeltoY(sy5)+1);
2898  } else if (sy5<=fEnvelope[sx5]) {
2899  dx1 = sx4;
2900  dy1 = sy4;
2901  if (dc!=0) v = (-dd-da*dx1-db*dy1)/dc;
2902  else v =(iv1+iv2+iv4)/3;
2903  iv = (Int_t)v;
2904  ColorModel(iv,ui1,ui2,ui3);
2906  line->PaintLine(gPad->PixeltoX(sx4),gPad->PixeltoY(sy4)+1,gPad->PixeltoX(sx5),gPad->PixeltoY(sy5)+1);
2907  }
2908  sy5 = fEnvelope[sx4];
2909  }
2910  sx5 = sx4;
2911  }
2912  }
2913  }
2914  } else {
2915  if (((flag==0)&&(smer==0))||((flag!=0)&&(smer!=0))) {
2916  s1 = q1;
2917  t1 = (Int_t)TMath::Max(q2-1,0);
2918  s2 = q1;
2919  t2 = (Int_t)TMath::Min(q2+2,w2);
2920  } else if (((flag!=0)&&(smer==0))||((flag==0)&&(smer!=0))) {
2921  s1 = (Int_t)TMath::Max(q1-1,0);
2922  t1 = q2;
2923  s2 = (Int_t)TMath::Min(q1+2,w1);
2924  t2 = q2;
2925  }
2926  if (turni==1) {
2927  i1 = s1;
2928  i2 = s2;
2929  } else {
2930  i1 = w1-s1;
2931  i2 = w1-s2;
2932  }
2933  if (turnj==1) {
2934  j1 = t1;
2935  j2 = t2;
2936  } else {
2937  j1 = w2-t1;
2938  j2 = w2-t2;
2939  }
2940  Transform(i1,j1,0);
2941  x3 = fXt;
2942  y3 = fYt;
2943  Transform(i2,j2,0);
2944  x4 = fXt;
2945  y4 = fYt;
2946  bezx1 = x1+(x2-x1)/3;
2947  bezx2 = x1+2*(x2-x1)/3;
2948  bezy1 = y1+(y2-y3)/6;
2949  bezy2 = y2-(y4-y1)/6;
2950  if (x1<=x2) {
2951  if (bezx1<=x1) {
2952  bezx1 = x1;
2953  bezy1 = y1;
2954  }
2955  if (bezx1>=x2) {
2956  bezx1 = x2;
2957  bezy1 = y2;
2958  }
2959  if (bezx2<=x1) {
2960  bezx2 = x1;
2961  bezy2 = y1;
2962  }
2963  if (bezx2>=x2) {
2964  bezx2 = x2;
2965  bezy2 = y2;
2966  }
2967  fBzX[0] = x1;
2968  fBzY[0] = y1;
2969  fBzX[1] = (Int_t)bezx1;
2970  fBzY[1] = (Int_t)bezy1;
2971  fBzX[2] = (Int_t)bezx2;
2972  fBzY[2] = (Int_t)bezy2;
2973  fBzX[3] = x2;
2974  fBzY[3] = y2;
2975  for (bezf=0;bezf<1.01;bezf+=0.1) {
2976  BezierSmoothing(bezf);
2977  if (bezf==0) {
2978  ibezx1 = (Int_t)(fGbezx+0.5);
2979  ibezy1 = (Int_t)(fGbezy+0.5);
2980  } else {
2981  ibezx2 = ibezx1;
2982  ibezy2 = ibezy1;
2983  ibezx1 = (Int_t)(fGbezx+0.5);
2984  ibezy1 = (Int_t)(fGbezy+0.5);
2985  Envelope(ibezx2,ibezy2,ibezx1,ibezy1);
2986  if (fLine!=0) {
2987  if (fLine==1) {
2988  fXe = ibezx1;
2989  fYe = ibezy1;
2990  }
2991  line->PaintLine(gPad->PixeltoX(fXs),gPad->PixeltoY(fYs)+1,gPad->PixeltoX(fXe),gPad->PixeltoY(fYe)+1);
2992  }
2993  }
2994  }
2995  } else if (x1>x2) {
2996  if (bezx1>=x1) {
2997  bezx1 = x1;
2998  bezy1 = y1;
2999  }
3000  if (bezx1<=x2) {
3001  bezx1 = x2;
3002  bezy1 = y2;
3003  }
3004  if (bezx2>=x1) {
3005  bezx2 = x1;
3006  bezy2 = y1;
3007  }
3008  if (bezx2<=x2) {
3009  bezx2 = x2;
3010  bezy2 = y2;
3011  }
3012  fBzX[0] = x1;
3013  fBzY[0] = y1;
3014  fBzX[1] = (Int_t)bezx1;
3015  fBzY[1] = (Int_t)bezy1;
3016  fBzX[2] = (Int_t)bezx2;
3017  fBzY[2] = (Int_t)bezy2;
3018  fBzX[3] = x2;
3019  fBzY[3] = y2;
3020  for (bezf=0;bezf<1.01;bezf+=0.1) {
3021  BezierSmoothing(bezf);
3022  if (bezf==0) {
3023  ibezx1 = (Int_t)(fGbezx+0.5);
3024  ibezy1 = (Int_t)(fGbezy+0.5);
3025  } else {
3026  ibezx2 = ibezx1;
3027  ibezy2 = ibezy1;
3028  ibezx1 = (Int_t)(fGbezx+0.5);
3029  ibezy1 = (Int_t)(fGbezy+0.5);
3030  Envelope(ibezx1,ibezy1,ibezx2,ibezy2);
3031  if (fLine!=0) {
3032  if (fLine==1) {
3033  fXe = ibezx2;
3034  fYe = ibezy2;
3035  }
3036  line->PaintLine(gPad->PixeltoX(fXs),gPad->PixeltoY(fYs)+1,gPad->PixeltoX(fXe),gPad->PixeltoY(fYe)+1);
3037  }
3038  }
3039  }
3040  }
3041  }
3042  break;
3043  case kDisplayModeContours:
3044  if ((q1!=q2||smer!=0)&&flag==1) {
3045  s1 = q1+1;
3046  t1 = q2;
3047  s2 = q1;
3048  t2 = q2;
3049  s3 = q1;
3050  t3 = q2+1;
3051  s4 = q1+1;
3052  t4 = q2+1;
3053  if (turni==1) {
3054  i1 = (Int_t)TMath::Min(w1,s1);
3055  i2 = (Int_t)TMath::Min(w1,s2);
3056  i3 = (Int_t)TMath::Min(w1,s3);
3057  i4 = (Int_t)TMath::Min(w1,s4);
3058  } else {
3059  i1 = (Int_t)TMath::Max(w1-s1,0);
3060  i2 = (Int_t)TMath::Max(w1-s2,0);
3061  i3 = (Int_t)TMath::Max(w1-s3,0);
3062  i4 = (Int_t)TMath::Max(w1-s4,0);
3063  }
3064  if (turnj==1) {
3065  j1 = (Int_t)TMath::Min(w2,t1);
3066  j2 = (Int_t)TMath::Min(w2,t2);
3067  j3 = (Int_t)TMath::Min(w2,t3);
3068  j4 = (Int_t)TMath::Min(w2,t4);
3069  } else {
3070  j1 = (Int_t)TMath::Max(w2-t1,0);
3071  j2 = (Int_t)TMath::Max(w2-t2,0);
3072  j3 = (Int_t)TMath::Max(w2-t3,0);
3073  j4 = (Int_t)TMath::Max(w2-t4,0);
3074  }
3075  Transform(i1,j1,0);
3076  dx1 = fDxspline;
3077  dy1 = fDyspline;
3078  z1 = fZ;
3079  z1l = fZeq;
3080  Transform(i2,j2,0);
3081  dx2 = fDxspline;
3082  dy2 = fDyspline;
3083  z2 = fZ;
3084  z2l = fZeq;
3085  Transform(i3,j3,0);
3086  dx3 = fDxspline;
3087  dy3 = fDyspline;
3088  z3 = fZ;
3089  z3l = fZeq;
3090  Transform(i4,j4,0);
3091  dx4 = fDxspline;
3092  dy4 = fDyspline;
3093  z4 = fZ;
3094  z4l = fZeq;
3095  zh = (Double_t)TMath::Max(z1,z2);
3096  zh = (Double_t)TMath::Max(zh,z3);
3097  zh = (Double_t)TMath::Max(zh,z4);
3098  zl = (Double_t)TMath::Min(z1l,z2l);
3099  zl = (Double_t)TMath::Min(zl,z3l);
3100  zl = (Double_t)TMath::Min(zl,z4l);
3101  i1 = (Int_t)(zl/dcount_reg+1);
3102  if (z1!=z2||z2!=z3||z3!=z4) {
3103  do {
3104  fZ = i1*dcount_reg;
3105  switch (fZscale) {
3106  case kZScaleLog:
3107  if (fZ>=1.0) fZ = log(fZ);
3108  else fZ = 0;
3109  break;
3110  case kZScaleSqrt:
3111  if (fZ>0) fZ = sqrt(fZ);
3112  else fZ = 0;
3113  break;
3114  }
3116  v = ColorCalculation(dx1,dy1,fZ,dx2,dy2,fZ,dx4,dy4,fZ);
3117  v = v*fLevels+0.5;
3118  iv = fLevels-(Int_t)v;
3119  ColorModel(iv,ui1,ui2,ui3);
3121  }
3122  if (fZ>zh) goto eqend;
3123  i1 += 1;
3124  ekv = 0;
3125  stvor = 0;
3126  if ((z2<=fZ&&fZ<z1)||(z2<fZ&&fZ<=z1)) {
3127  xb = (fZ-z2)*(dx1-dx2)/(z1-z2)+dx2;
3128  goto ekvi1;
3129  }
3130  if ((z1<=fZ&&fZ<z2)||(z1<fZ&&fZ<=z2)) {
3131  xb = (fZ-z1)*(dx2-dx1)/(z2-z1)+dx1;
3132  goto ekvi1;
3133  }
3134  if (z2==fZ&&fZ==z1) {
3135  xb = dx2;
3136 ekvi1:
3137  yb = dy2;
3138  ekv = 1;
3139  x5 = xb;
3140  y5 = yb;
3141  stvor += 1;
3142  }
3143  if ((z1<=fZ&&fZ<z4)||(z1<fZ&&fZ<=z4)) {
3144  ya = (fZ-z1)*(dy4-dy1)/(z4-z1)+dy1;
3145  goto ekvi2;
3146  }
3147  if ((z4<=fZ&&fZ<z1)||(z4<fZ&&fZ<=z1)) {
3148  ya = (fZ-z4)*(dy1-dy4)/(z1-z4)+dy4;
3149  goto ekvi2;
3150  }
3151  if (z4==fZ&&fZ==z1) {
3152  ya = dy1;
3153 ekvi2:
3154  xa = dx1;
3155  if (ekv==1) {
3156  Slice(xa,ya,xb,yb,line);
3157  stvor += 1;
3158  }
3159  xb = xa;
3160  yb = ya;
3161  ekv = 1;
3162  }
3163  if ((z3<=fZ&&fZ<z4)||(z3<fZ&&fZ<=z4)) {
3164  xa = (fZ-z3)*(dx4-dx3)/(z4-z3)+dx3;
3165  goto ekvi3;
3166  }
3167  if ((z4<=fZ&&fZ<z3)||(z4<fZ&&fZ<=z3)) {
3168  xa = (fZ-z4)*(dx3-dx4)/(z3-z4)+dx4;
3169  goto ekvi3;
3170  }
3171  if (z4==fZ&&fZ==z3) {
3172  xa = dx4;
3173 ekvi3:
3174  ya = dy4;
3175  if (ekv==1) {
3176  Slice(xa,ya,xb,yb,line);
3177  stvor += 1;
3178  }
3179  xb = xa;
3180  yb = ya;
3181  ekv = 1;
3182  }
3183  if ((z2<=fZ&&fZ<z3)||(z2<fZ&&fZ<=z3)) {
3184  ya = (fZ-z2)*(dy3-dy2)/(z3-z2)+dy2;
3185  goto ekvi4;
3186  }
3187  if ((z3<=fZ&&fZ<z2)||(z3<fZ&&fZ<=z2)) {
3188  ya = (fZ-z3)*(dy2-dy3)/(z2-z3)+dy3;
3189  goto ekvi4;
3190  }
3191  if (z3==fZ&&fZ==z2) {
3192  ya = dy3;
3193 ekvi4:
3194  xa = dx3;
3195  if (ekv==1) {
3196  Slice(xa,ya,xb,yb,line);
3197  stvor += 1;
3198  }
3199  if (stvor==4) Slice(xa,ya,x5,y5,line);
3200  }
3201  } while (fZ<=zh);
3202 eqend:
3203  CopyEnvelope(dx1,dx3,dy1,dy3);
3204  }
3205  }
3206  break;
3207  case kDisplayModeBars:
3208  case kDisplayModeBarsX:
3209  case kDisplayModeBarsY:
3210  if ((q1!=q2||smer!=0)&&flag==1) {
3211  s1 = q1+1;
3212  t1 = q2;
3213  s2 = q1;
3214  t2 = q2;
3215  s3 = q1;
3216  t3 = q2+1;
3217  s4 = q1+1;
3218  t4 = q2+1;
3219  }
3220  if (turni==1) {
3222  if (s1<=w1&&s2<=w1&&s3<=w1&&s4<=w1) {
3223  i1 = s1;
3224  i2 = s2;
3225  i3 = s3;
3226  i4 = s4;
3227  }
3228  } else {
3229  i1 = (Int_t)TMath::Min(w1,s1);
3230  i2 = (Int_t)TMath::Min(w1,s2);
3231  i3 = (Int_t)TMath::Min(w1,s3);
3232  i4 = (Int_t)TMath::Min(w1,s4);
3233  }
3234  } else {
3236  if (s1<=w1&&s2<=w1&&s3<=w1&&s4<=w1) {
3237  i1 = w1-s1;
3238  i2 = w1-s2;
3239  i3 = w1-s3;
3240  i4 = w1-s4;
3241  }
3242  } else {
3243  i1 = (Int_t)TMath::Max(w1-s1,0);
3244  i2 = (Int_t)TMath::Max(w1-s2,0);
3245  i3 = (Int_t)TMath::Max(w1-s3,0);
3246  i4 = (Int_t)TMath::Max(w1-s4,0);
3247  }
3248  }
3249  if (turnj==1) {
3251  if (t1<=w2&&t2<=w2&&t3<=w2&&t4<=w2) {
3252  j1 = t1;
3253  j2 = t2;
3254  j3 = t3;
3255  j4 = t4;
3256  }
3257  } else {
3258  j1 = (Int_t)TMath::Min(w2,t1);
3259  j2 = (Int_t)TMath::Min(w2,t2);
3260  j3 = (Int_t)TMath::Min(w2,t3);
3261  j4 = (Int_t)TMath::Min(w2,t4);
3262  }
3263  } else {
3265  if (t1<=w2&&t2<=w2&&t3<=w2&&t4<=w2) {
3266  j1 = w2-t1;
3267  j2 = w2-t2;
3268  j3 = w2-t3;
3269  j4 = w2-t4;
3270  }
3271  } else {
3272  j1 = (Int_t)TMath::Max(w2-t1,0);
3273  j2 = (Int_t)TMath::Max(w2-t2,0);
3274  j3 = (Int_t)TMath::Max(w2-t3,0);
3275  j4 = (Int_t)TMath::Max(w2-t4,0);
3276  }
3277  }
3278  Transform(i1,j1,0);
3279  x1 = fXt;
3280  dx1 = fDxspline;
3281  dy1 = fDyspline;
3282  z1 = fZ;
3283  Transform(i2,j2,0);
3284  x2 = fXt;
3285  dx2 = fDxspline;
3286  dy2 = fDyspline;
3287  z2 = fZ;
3288  Transform(i3,j3,0);
3289  x3 = fXt;
3290  dx3 = fDxspline;
3291  dy3 = fDyspline;
3292  z3 = fZ;
3293  Transform(i4,j4,0);
3294  x4 = fXt;
3295  y4 = fYt;
3296  dx4 = fDxspline;
3297  dy4 = fDyspline;
3298  z4 = fZ;
3299  Transform(i1,j1,-1);
3300  ix5 = fXt;
3301  iy5 = fYt;
3302  Transform(i2,j2,-1);
3303  x6 = fXt;
3304  y6 = fYt;
3305  Transform(i3,j3,-1);
3306  x7 = fXt;
3307  y7 = fYt;
3308  Transform(i4,j4,-1);
3309  y8 = fYt;
3310  y1 = iy5+(y4-y8);
3311  y2 = y6+(y4-y8);
3312  y3 = y7+(y4-y8);
3313  if ((fDisplayMode==kDisplayModeBars)&&(q1!=q2||smer!=0)&&(flag==1)) {
3314  EnvelopeBars(ix5,iy5,x6,y6);
3315  if (fLine!=0) {
3316  if (fLine==1) {
3317  fXe = x6;
3318  fYe = y6;
3319  }
3320  line->PaintLine(gPad->PixeltoX(fXs),gPad->PixeltoY(fYs)+1,gPad->PixeltoX(fXe),gPad->PixeltoY(fYe)+1);
3321  }
3322  EnvelopeBars(x6,y6,x7,y7);
3323  if (fLine!=0) {
3324  if (fLine==1) {
3325  fXe = x7;
3326  fYe = y7;
3327  }
3328  line->PaintLine(gPad->PixeltoX(fXs),gPad->PixeltoY(fYs)+1,gPad->PixeltoX(fXe),gPad->PixeltoY(fYe)+1);
3329  }
3330  EnvelopeBars(ix5,iy5,x1,y1);
3331  if (fLine!=0) {
3332  if (fLine==1) {
3333  fXe = x1;
3334  fYe = y1;
3335  }
3336  line->PaintLine(gPad->PixeltoX(fXs),gPad->PixeltoY(fYs)+1,gPad->PixeltoX(fXe),gPad->PixeltoY(fYe)+1);
3337  }
3338  EnvelopeBars(x6,y6,x2,y2);
3339  if (fLine!=0) {
3340  if (fLine==1) {
3341  fXe = x2;
3342  fYe = y2;
3343  }
3344  line->PaintLine(gPad->PixeltoX(fXs),gPad->PixeltoY(fYs)+1,gPad->PixeltoX(fXe),gPad->PixeltoY(fYe)+1);
3345  }
3346  EnvelopeBars(x7,y7,x3,y3);
3347  if (fLine!=0) {
3348  if (fLine==1) {
3349  fXe = x3;
3350  fYe = y3;
3351  }
3352  line->PaintLine(gPad->PixeltoX(fXs),gPad->PixeltoY(fYs)+1,gPad->PixeltoX(fXe),gPad->PixeltoY(fYe)+1);
3353  }
3355  v = ColorCalculation(dx1,dy1,z4,dx2,dy2,z4,dx4,dy4,z4);
3356  v = v*fLevels+0.5;
3357  iv = fLevels-(Int_t)v;
3358  uip = fNewColorIndex;
3359  ColorModel(iv,ui1,ui2,ui3);
3361  sx1 = x1;
3362  sy1 = y1;
3363  sx2 = x2;
3364  sy2 = y2;
3365  sx3 = x4;
3366  sy3 = y4;
3367  if (sx2<sx1) {
3368  sx4 = sx1;
3369  sy4 = sy1;
3370  sx1 = sx2;
3371  sy1 = sy2;
3372  sx2 = sx4;
3373  sy2 = sy4;
3374  }
3375  if (sx3<sx1) {
3376  sx4 = sx1;
3377  sy4 = sy1;
3378  sx1 = sx3;
3379  sy1 = sy3;
3380  sx3 = sx4;
3381  sy3 = sy4;
3382  }
3383  if (sy2<sy3) {
3384  sx4 = sx2;
3385  sy4 = sy2;
3386  sx2 = sx3;
3387  sy2 = sy3;
3388  sx3 = sx4;
3389  sy3 = sy4;
3390  }
3391  sdx1 = 0;
3392  sdx2 = 0;
3393  sdx3 = 0;
3394  pom1 = sy2-sy1;
3395  pom2 = sx2-sx1;
3396  if (pom2!=0) sdx1 = pom1/pom2;
3397  pom1 = sy1;
3398  pom2 = sx1;
3399  sdy1 = pom1-sdx1*pom2;
3400  pom1 = sy3-sy1;
3401  pom2 = sx3-sx1;
3402  if (pom2!=0) sdx2 = pom1/pom2;
3403  pom1 = sy1;
3404  pom2 = sx1;
3405  sdy2 = pom1-sdx2*pom2;
3406  pom1 = sy3-sy2;
3407  pom2 = sx3-sx2;
3408  if (pom2!=0) sdx3 = pom1/pom2;
3409  pom1 = sy2;
3410  pom2 = sx2;
3411  sdy3 = pom1-sdx3*pom2;
3412  if (sx2<sx3) {
3413  if (sx1!=sx2) {
3414  for (sx4=sx1;sx4<=sx2;sx4++) {
3415  pom1 = sx4;
3416  sdy4 = sdx1*pom1+sdy1;
3417  sy4 = (Int_t)sdy4;
3418  if (sx3!=sx1) {
3419  sdy4 = sdx2*pom1+sdy2;
3420  sy5 = (Int_t)sdy4;
3421  y5 = fEnvelope[sx4];
3422  if (sy4<sy5) {
3423  pom1 = sy4;
3424  sy4 = sy5;
3425  sy5 = (Int_t)pom1;
3426  }
3427  if ((sy4<=y5)||(sy5<y5)) {
3428  sy4 = (Int_t)TMath::Min(sy4,(Int_t)y5);
3429  sy5 = (Int_t)TMath::Min(sy5,(Int_t)y5);
3430  line->PaintLine(gPad->PixeltoX(sx4),gPad->PixeltoY(sy4)+1,gPad->PixeltoX(sx4),gPad->PixeltoY(sy5)+1);
3431  }
3432  }
3433  }
3434  }
3435  if (sx2!=sx3) {
3436  for (sx4=sx2;sx4<=sx3;sx4++) {
3437  pom1 = sx4;
3438  sdy4 = sdx3*pom1+sdy3;
3439  sy4 = (Int_t)sdy4;
3440  if (sx3!=sx1) {
3441  sdy4 = sdx2*pom1+sdy2;
3442  sy5 = (Int_t)sdy4;
3443  y5 = fEnvelope[sx4];
3444  if (sy4<sy5) {
3445  pom1 = sy4;
3446  sy4 = sy5;
3447  sy5 = (Int_t)pom1;
3448  }
3449  if ((sy4<=y5)||(sy5<y5)) {
3450  sy4 = (Int_t)TMath::Min(sy4,(Int_t)y5);
3451  sy5 = (Int_t)TMath::Min(sy5,(Int_t)y5);
3452  line->PaintLine(gPad->PixeltoX(sx4),gPad->PixeltoY(sy4)+1,gPad->PixeltoX(sx4),gPad->PixeltoY(sy5)+1);
3453  }
3454  }
3455  }
3456  }
3457  } else {
3458  if (sx3!=sx1) {
3459  for (sx4=sx1;sx4<=sx3;sx4++) {
3460  pom1 = sx4;
3461  sdy4 = sdx2*pom1+sdy2;
3462  sy4 = (Int_t)sdy4;
3463  if (sx2!=sx1) {
3464  sdy4 = sdx1*pom1+sdy1;
3465  sy5 = (Int_t)sdy4;
3466  y5 = fEnvelope[sx4];
3467  if (sy4<sy5) {
3468  pom1 = sy4;
3469  sy4 = sy5;
3470  sy5 = (Int_t)pom1;
3471  }
3472  if ((sy4<=y5)||(sy5<y5)) {
3473  sy4 = (Int_t)TMath::Min(sy4,(Int_t)y5);
3474  sy5 = (Int_t)TMath::Min(sy5,(Int_t)y5);
3475  line->PaintLine(gPad->PixeltoX(sx4),gPad->PixeltoY(sy4)+1,gPad->PixeltoX(sx4),gPad->PixeltoY(sy5)+1);
3476  }
3477  }
3478  }
3479  }
3480  if (sx2!=sx3) {
3481  for (sx4=sx3;sx4<=sx2;sx4++) {
3482  pom1 = sx4;
3483  sdy4 = sdx3*pom1+sdy3;
3484  sy4 = (Int_t)sdy4;
3485  if (sx2!=sx1) {
3486  sdy4 = sdx1*pom1+sdy1;
3487  sy5 = (Int_t)sdy4;
3488  y5 = fEnvelope[sx4];
3489  if (sy4<sy5) {
3490  pom1 = sy4;
3491  sy4 = sy5;
3492  sy5 = (Int_t)pom1;
3493  }
3494  if ((sy4<=y5)||(sy5<y5)) {
3495  sy4 = (Int_t)TMath::Min(sy4,(Int_t)y5);
3496  sy5 = (Int_t)TMath::Min(sy5,(Int_t)y5);
3497  line->PaintLine(gPad->PixeltoX(sx4),gPad->PixeltoY(sy4)+1,gPad->PixeltoX(sx4),gPad->PixeltoY(sy5)+1);
3498  }
3499  }
3500  }
3501  }
3502  }
3503  sx1 = x2;
3504  sy1 = y2;
3505  sx2 = x3;
3506  sy2 = y3;
3507  sx3 = x4;
3508  sy3 = y4;
3509  if (sx2<sx1) {
3510  sx4 = sx1;
3511  sy4 = sy1;
3512  sx1 = sx2;
3513  sy1 = sy2;
3514  sx2 = sx4;
3515  sy2 = sy4;
3516  }
3517  if (sx3<sx1) {
3518  sx4 = sx1;
3519  sy4 = sy1;
3520  sx1 = sx3;
3521  sy1 = sy3;
3522  sx3 = sx4;
3523  sy3 = sy4;
3524  }
3525  if (sy2<sy3) {
3526  sx4 = sx2;
3527  sy4 = sy2;
3528  sx2 = sx3;
3529  sy2 = sy3;
3530  sx3 = sx4;
3531  sy3 = sy4;
3532  }
3533  sdx1 = 0;
3534  sdx2 = 0;
3535  sdx3 = 0;
3536  pom1 = sy2-sy1;
3537  pom2 = sx2-sx1;
3538  if (pom2!=0) sdx1 = pom1/pom2;
3539  pom1 = sy1;
3540  pom2 = sx1;
3541  sdy1 = pom1-sdx1*pom2;
3542  pom1 = sy3-sy1;
3543  pom2 = sx3-sx1;
3544  if (pom2!=0) sdx2 = pom1/pom2;
3545  pom1 = sy1;
3546  pom2 = sx1;
3547  sdy2 = pom1-sdx2*pom2;
3548  pom1 = sy3-sy2;
3549  pom2 = sx3-sx2;
3550  if (pom2!=0) sdx3 = pom1/pom2;
3551  pom1 = sy2;
3552  pom2 = sx2;
3553  sdy3 = pom1-sdx3*pom2;
3554  if (sx2<sx3) {
3555  if (sx1!=sx2) {
3556  for (sx4=sx1;sx4<=sx2;sx4++) {
3557  pom1 = sx4;
3558  sdy4 = sdx1*pom1+sdy1;
3559  sy4 = (Int_t)sdy4;
3560  if (sx3!=sx1) {
3561  sdy4 = sdx2*pom1+sdy2;
3562  sy5 = (Int_t)sdy4;
3563  y5 = fEnvelope[sx4];
3564  if (sy4<sy5) {
3565  pom1 = sy4;
3566  sy4 = sy5;
3567  sy5 = (Int_t)pom1;
3568  }
3569  if ((sy4<=y5)||(sy5<y5)) {
3570  sy4 = (Int_t)TMath::Min(sy4,(Int_t)y5);
3571  sy5 = (Int_t)TMath::Min(sy5,(Int_t)y5);
3572  line->PaintLine(gPad->PixeltoX(sx4),gPad->PixeltoY(sy4)+1,gPad->PixeltoX(sx4),gPad->PixeltoY(sy5)+1);
3573  }
3574  }
3575  }
3576  }
3577  if (sx2!=sx3) {
3578  for (sx4=sx2;sx4<=sx3;sx4++) {
3579  pom1 = sx4;
3580  sdy4 = sdx3*pom1+sdy3;
3581  sy4 = (Int_t)sdy4;
3582  if (sx3!=sx1) {
3583  sdy4 = sdx2*pom1+sdy2;
3584  sy5 = (Int_t)sdy4;
3585  y5 = fEnvelope[sx4];
3586  if (sy4<sy5) {
3587  pom1 = sy4;
3588  sy4 = sy5;
3589  sy5 = (Int_t)pom1;
3590  }
3591  if ((sy4<=y5)||(sy5<y5)) {
3592  sy4 = (Int_t)TMath::Min(sy4,(Int_t)y5);
3593  sy5 = (Int_t)TMath::Min(sy5,(Int_t)y5);
3594  line->PaintLine(gPad->PixeltoX(sx4),gPad->PixeltoY(sy4)+1,gPad->PixeltoX(sx4),gPad->PixeltoY(sy5)+1);
3595  }
3596  }
3597  }
3598  }
3599  } else {
3600  if (sx3!=sx1) {
3601  for (sx4=sx1;sx4<=sx3;sx4++) {
3602  pom1 = sx4;
3603  sdy4 = sdx2*pom1+sdy2;
3604  sy4 = (Int_t)sdy4;
3605  if (sx2!=sx1) {
3606  sdy4 = sdx1*pom1+sdy1;
3607  sy5 = (Int_t)sdy4;
3608  y5 = fEnvelope[sx4];
3609  if (sy4<sy5) {
3610  pom1 = sy4;
3611  sy4 = sy5;
3612  sy5 = (Int_t)pom1;
3613  }
3614  if ((sy4<=y5)||(sy5<y5)) {
3615  sy4 = (Int_t)TMath::Min(sy4,(Int_t)y5);
3616  sy5 = (Int_t)TMath::Min(sy5,(Int_t)y5);
3617  line->PaintLine(gPad->PixeltoX(sx4),gPad->PixeltoY(sy4)+1,gPad->PixeltoX(sx4),gPad->PixeltoY(sy5)+1);
3618  }
3619  }
3620  }
3621  }
3622  if (sx2!=sx3) {
3623  for (sx4=sx3;sx4<=sx2;sx4++) {
3624  pom1 = sx4;
3625  sdy4 = sdx3*pom1+sdy3;
3626  sy4 = (Int_t)sdy4;
3627  if (sx2!=sx1) {
3628  sdy4 = sdx1*pom1+sdy1;
3629  sy5 = (Int_t)sdy4;
3630  y5 = fEnvelope[sx4];
3631  if (sy4<sy5) {
3632  pom1 = sy4;
3633  sy4 = sy5;
3634  sy5 = (Int_t)pom1;
3635  }
3636  if ((sy4<=y5)||(sy5<y5)) {
3637  sy4 = (Int_t)TMath::Min(sy4,(Int_t)y5);
3638  sy5 = (Int_t)TMath::Min(sy5,(Int_t)y5);
3639  line->PaintLine(gPad->PixeltoX(sx4),gPad->PixeltoY(sy4)+1,gPad->PixeltoX(sx4),gPad->PixeltoY(sy5)+1);
3640  }
3641  }
3642  }
3643  }
3644  }
3645  line->SetLineColor(uip);
3646  }
3647  EnvelopeBars(x1,y1,x2,y2);
3648  if (fLine!=0) {
3649  if (fLine==1) {
3650  fXe = x2;
3651  fYe = y2;
3652  }
3653  line->PaintLine(gPad->PixeltoX(fXs),gPad->PixeltoY(fYs)+1,gPad->PixeltoX(fXe),gPad->PixeltoY(fYe)+1);
3654  }
3655  EnvelopeBars(x2,y2,x3,y3);
3656  if (fLine!=0) {
3657  if (fLine==1) {
3658  fXe = x3;
3659  fYe = y3;
3660  }
3661  line->PaintLine(gPad->PixeltoX(fXs),gPad->PixeltoY(fYs)+1,gPad->PixeltoX(fXe),gPad->PixeltoY(fYe)+1);
3662  }
3663  EnvelopeBars(x1,y1,x4,y4);
3664  if (fLine!=0) {
3665  if (fLine==1) {
3666  fXe = x4;
3667  fYe = y4;
3668  }
3669  line->PaintLine(gPad->PixeltoX(fXs),gPad->PixeltoY(fYs)+1,gPad->PixeltoX(fXe),gPad->PixeltoY(fYe)+1);
3670  }
3671  EnvelopeBars(x4,y4,x3,y3);
3672  if (fLine!=0) {
3673  if (fLine==1) {
3674  fXe = x3;
3675  fYe = y3;
3676  }
3677  line->PaintLine(gPad->PixeltoX(fXs),gPad->PixeltoY(fYs)+1,gPad->PixeltoX(fXe),gPad->PixeltoY(fYe)+1);
3678  }
3679  } else if ((fDisplayMode==kDisplayModeBarsY)&&(((flag!=0)&&(smer==0))||((flag==0)&&(smer!=0)))) {
3680  EnvelopeBars(ix5,iy5,x6,y6);
3681  if (fLine!=0) {
3682  if (fLine==1) {
3683  fXe = x6;
3684  fYe = y6;
3685  }
3686  line->PaintLine(gPad->PixeltoX(fXs),gPad->PixeltoY(fYs)+1,gPad->PixeltoX(fXe),gPad->PixeltoY(fYe)+1);
3687  }
3688  EnvelopeBars(x1,y1,ix5,iy5);
3689  if (fLine!=0) {
3690  if (fLine==1) {
3691  fXe = ix5;
3692  fYe = iy5;
3693  }
3694  line->PaintLine(gPad->PixeltoX(fXs),gPad->PixeltoY(fYs)+1,gPad->PixeltoX(fXe),gPad->PixeltoY(fYe)+1);
3695  }
3696  EnvelopeBars(x2,y2,x6,y6);
3697  if (fLine!=0) {
3698  if (fLine==1) {
3699  fXe = x6;
3700  fYe = y6;
3701  }
3702  line->PaintLine(gPad->PixeltoX(fXs),gPad->PixeltoY(fYs)+1,gPad->PixeltoX(fXe),gPad->PixeltoY(fYe)+1);
3703  }
3705  v = ColorCalculation(dx1,dy1,z4,dx2,dy2,z4,dx4,dy4,z4);
3706  v = v*fLevels+0.5;
3707  iv = fLevels-(Int_t)v;
3708  uip = fNewColorIndex;
3709  ColorModel(iv,ui1,ui2,ui3);
3711  }
3712  EnvelopeBars(x1,y1,x2,y2);
3713  if (fLine!=0) {
3714  if (fLine==1) {
3715  fXe = x2;
3716  fYe = y2;
3717  }
3718  line->PaintLine(gPad->PixeltoX(fXs),gPad->PixeltoY(fYs)+1,gPad->PixeltoX(fXe),gPad->PixeltoY(fYe)+1);
3719  }
3721  line->SetLineColor(uip);
3722  }
3723  } else if ((fDisplayMode==kDisplayModeBarsX)&&(((flag==0)&&(smer==0))||((flag!=0)&&(smer!=0)))) {
3724  EnvelopeBars(x7,y7,x6,y6);
3725  if (fLine!=0) {
3726  if (fLine==1) {
3727  fXe = x6;
3728  fYe = y6;
3729  }
3730  line->PaintLine(gPad->PixeltoX(fXs),gPad->PixeltoY(fYs)+1,gPad->PixeltoX(fXe),gPad->PixeltoY(fYe)+1);
3731  }
3732  EnvelopeBars(x2,y2,x6,y6);
3733  if (fLine!=0) {
3734  if (fLine==1) {
3735  fXe = x6;
3736  fYe = y6;
3737  }
3738  line->PaintLine(gPad->PixeltoX(fXs),gPad->PixeltoY(fYs)+1,gPad->PixeltoX(fXe),gPad->PixeltoY(fYe)+1);
3739  }
3740  EnvelopeBars(x3,y3,x7,y7);
3741  if (fLine!=0) {
3742  if (fLine==1) {
3743  fXe = x7;
3744  fYe = y7;
3745  }
3746  line->PaintLine(gPad->PixeltoX(fXs),gPad->PixeltoY(fYs)+1,gPad->PixeltoX(fXe),gPad->PixeltoY(fYe)+1);
3747  }
3749  v = ColorCalculation(dx1,dy1,z4,dx2,dy2,z4,dx4,dy4,z4);
3750  v = v*fLevels+0.5;
3751  iv = fLevels-(Int_t)v;
3752  uip = fNewColorIndex;
3753  ColorModel(iv,ui1,ui2,ui3);
3755  }
3756  EnvelopeBars(x3,y3,x2,y2);
3757  if (fLine!=0) {
3758  if (fLine==1) {
3759  fXe = x2;
3760  fYe = y2;
3761  }
3762  line->PaintLine(gPad->PixeltoX(fXs),gPad->PixeltoY(fYs)+1,gPad->PixeltoX(fXe),gPad->PixeltoY(fYe)+1);
3763  }
3765  line->SetLineColor(uip);
3766  }
3767  }
3768  break;
3769  case kDisplayModeLinesX:
3771  if (((flag==0)&&(smer==0))||((flag!=0)&&(smer!=0))) {
3772  if (fBezier==kNoBezierInterpol) {
3773  Envelope(x1,y1,x2,y2);
3774  if (fLine!=0) {
3775  if (fLine==1) {
3776  fXe = x2;
3777  fYe = y2;
3778  }
3779  line->PaintLine(gPad->PixeltoX(fXs),gPad->PixeltoY(fYs)+1,gPad->PixeltoX(fXe),gPad->PixeltoY(fYe)+1);
3780  }
3781  } else {
3782  s1 = q1;
3783  t1 = (Int_t)TMath::Max(q2-1,0);
3784  s2 = q1;
3785  t2 = (Int_t)TMath::Min(q2+2,w2);
3786  if (turni==1) {
3787  i1 = s1;
3788  i2 = s2;
3789  } else {
3790  i1 = (Int_t)TMath::Max(w1-s1,0);
3791  i2 = (Int_t)TMath::Max(w1-s2,0);
3792  }
3793  if (turnj==1) {
3794  j1 = t1;
3795  j2 = t2;
3796  } else {
3797  j1 = (Int_t)TMath::Max(w2-t1,0);
3798  j2 = (Int_t)TMath::Max(w2-t2,0);
3799  }
3800  Transform(i1,j1,0);
3801  x3 = fXt;
3802  y3 = fYt;
3803  Transform(i2,j2,0);
3804  x4 = fXt;
3805  y4 = fYt;
3806  bezx1 = x1+(x2-x1)/3;
3807  bezx2 = x1+2*(x2-x1)/3;
3808  bezy1 = y1+(y2-y3)/6;
3809  bezy2 = y2-(y4-y1)/6;
3810  if (x1<=x2) {
3811  if (bezx1<=x1) {
3812  bezx1 = x1;
3813  bezy1 = y1;
3814  }
3815  if (bezx1>=x2) {
3816  bezx1 = x2;
3817  bezy1 = y2;
3818  }
3819  if (bezx2<=x1) {
3820  bezx2 = x1;
3821  bezy2 = y1;
3822  }
3823  if (bezx2>=x2) {
3824  bezx2 = x2;
3825  bezy2 = y2;
3826  }
3827  fBzX[0] = x1;
3828  fBzY[0] = y1;
3829  fBzX[1] = (Int_t)bezx1;
3830  fBzY[1] = (Int_t)bezy1;
3831  fBzX[2] = (Int_t)bezx2;
3832  fBzY[2] = (Int_t)bezy2;
3833  fBzX[3] = x2;
3834  fBzY[3] = y2;
3835  for (bezf=0;bezf<1.01;bezf+=0.1) {
3836  BezierSmoothing(bezf);
3837  if (bezf==0) {
3838  ibezx1 = (Int_t)(fGbezx+0.5);
3839  ibezy1 = (Int_t)(fGbezy+0.5);
3840  } else {
3841  ibezx2 = ibezx1;
3842  ibezy2 = ibezy1;
3843  ibezx1 = (Int_t)(fGbezx+0.5);
3844  ibezy1 = (Int_t)(fGbezy+0.5);
3845  Envelope(ibezx2,ibezy2,ibezx1,ibezy1);
3846  if (fLine!=0) {
3847  if (fLine==1) {
3848  fXe = ibezx1;
3849  fYe = ibezy1;
3850  }
3851  line->PaintLine(gPad->PixeltoX(fXs),gPad->PixeltoY(fYs)+1,gPad->PixeltoX(fXe),gPad->PixeltoY(fYe)+1);
3852  }
3853  }
3854  }
3855  } else if (x1>x2) {
3856  if (bezx1>=x1) {
3857  bezx1 = x1;
3858  bezy1 = y1;
3859  }
3860  if (bezx1<=x2) {
3861  bezx1 = x2;
3862  bezy1 = y2;
3863  }
3864  if (bezx2>=x1) {
3865  bezx2 = x1;
3866  bezy2 = y1;
3867  }
3868  if (bezx2<=x2) {
3869  bezx2 = x2;
3870  bezy2 = y2;
3871  }
3872  fBzX[0] = x1;
3873  fBzY[0] = y1;
3874  fBzX[1] = (Int_t)bezx1;
3875  fBzY[1] = (Int_t)bezy1;
3876  fBzX[2] = (Int_t)bezx2;
3877  fBzY[2] = (Int_t)bezy2;
3878  fBzX[3] = x2;
3879  fBzY[3] = y2;
3880  for (bezf=0;bezf<1.01;bezf+=0.1) {
3881  BezierSmoothing(bezf);
3882  if (bezf==0) {
3883  ibezx1 = (Int_t)(fGbezx+0.5);
3884  ibezy1 = (Int_t)(fGbezy+0.5);
3885  } else {
3886  ibezx2 = ibezx1;
3887  ibezy2 = ibezy1;
3888  ibezx1 = (Int_t)(fGbezx+0.5);
3889  ibezy1 = (Int_t)(fGbezy+0.5);
3890  Envelope(ibezx1,ibezy1,ibezx2,ibezy2);
3891  if (fLine!=0) {
3892  if (fLine==1) {
3893  fXe = ibezx2;
3894  fYe = ibezy2;
3895  }
3896  line->PaintLine(gPad->PixeltoX(fXs),gPad->PixeltoY(fYs)+1,gPad->PixeltoX(fXe),gPad->PixeltoY(fYe)+1);
3897  }
3898  }
3899  }
3900  }
3901  }
3902  }
3903  } else {
3904  if ((q1!=q2||smer!=0)&&flag==1) {
3905  s1 = q1+1;
3906  t1 = q2;
3907  s2 = q1;
3908  t2 = q2;
3909  s3 = q1;
3910  t3 = q2+1;
3911  s4 = q1+1;
3912  t4 = q2+1;
3913  if (fShading==kShaded) {
3914  sr1 = s1;
3915  tr1 = (Int_t)TMath::Max(t1-1,0);
3916  sr2 = s2;
3917  tr2 = (Int_t)TMath::Max(t2-1,0);
3918  sr3 = (Int_t)TMath::Max(s2-1,0);
3919  tr3 = t2;
3920  sr4 = (Int_t)TMath::Max(s3-1,0);
3921  tr4 = t3;
3922  sr5 = s3;
3923  tr5 = t3+1;
3924  sr6 = s4;
3925  tr6 = t4+1;
3926  sr7 = s4+1;
3927  tr7 = t4;
3928  sr8 = s1+1;
3929  tr8 = t1;
3930  }
3931  if (turni==1) {
3932  i1 = s1;
3933  i2 = s2;
3934  i3 = s3;
3935  i4 = s4;
3936  } else {
3937  i1 = (Int_t)TMath::Max(w1-s1,0);
3938  i2 = (Int_t)TMath::Max(w1-s2,0);
3939  i3 = (Int_t)TMath::Max(w1-s3,0);
3940  i4 = (Int_t)TMath::Max(w1-s4,0);
3941  if (fShading==kShaded) {
3942  sr1 = (Int_t)TMath::Max(w1-sr1,0);
3943  sr2 = (Int_t)TMath::Max(w1-sr2,0);
3944  sr3 = (Int_t)TMath::Max(w1-sr3,0);
3945  sr4 = (Int_t)TMath::Max(w1-sr4,0);
3946  sr5 = (Int_t)TMath::Max(w1-sr5,0);
3947  sr6 = (Int_t)TMath::Max(w1-sr6,0);
3948  sr7 = (Int_t)TMath::Max(w1-sr7,0);
3949  sr8 = (Int_t)TMath::Max(w1-sr8,0);
3950  }
3951  }
3952  if (turnj==1) {
3953  j1 = t1;
3954  j2 = t2;
3955  j3 = t3;
3956  j4 = t4;
3957  } else {
3958  j1 = (Int_t)TMath::Max(w2-t1,0);
3959  j2 = (Int_t)TMath::Max(w2-t2,0);
3960  j3 = (Int_t)TMath::Max(w2-t3,0);
3961  j4 = (Int_t)TMath::Max(w2-t4,0);
3962  if (fShading==kShaded) {
3963  tr1 = (Int_t)TMath::Max(w2-tr1,0);
3964  tr2 = (Int_t)TMath::Max(w2-tr2,0);
3965  tr3 = (Int_t)TMath::Max(w2-tr3,0);
3966  tr4 = (Int_t)TMath::Max(w2-tr4,0);
3967  tr5 = (Int_t)TMath::Max(w2-tr5,0);
3968  tr6 = (Int_t)TMath::Max(w2-tr6,0);
3969  tr7 = (Int_t)TMath::Max(w2-tr7,0);
3970  tr8 = (Int_t)TMath::Max(w2-tr8,0);
3971  }
3972  }
3973  Transform(i1,j1,0);
3974  x1 = fXt;
3975  y1 = fYt;
3976  dx1 = fDxspline;
3977  dy1 = fDyspline;
3978  z1 = fZ;
3979  Transform(i2,j2,0);
3980  x2 = fXt;
3981  y2 = fYt;
3982  dx2 = fDxspline;
3983  dy2 = fDyspline;
3984  z2 = fZ;
3985  Transform(i3,j3,0);
3986  x3 = fXt;
3987  y3 = fYt;
3988  dx3 = fDxspline;
3989  dy3 = fDyspline;
3990  z3 = fZ;
3991  Transform(i4,j4,0);
3992  x4 = fXt;
3993  y4 = fYt;
3994  dx4 = fDxspline;
3995  dy4 = fDyspline;
3996  z4 = fZ;
3997  Envelope(x1,y1,x2,y2);
3998  Envelope(x2,y2,x3,y3);
3999  xtaz = (dx1+dx2+dx4)/3;
4000  ytaz = (dy1+dy2+dy4)/3;
4001  ztaz = (z1+z2+z4)/3;
4002  v = ColorCalculation(dx1,dy1,z1,dx2,dy2,z2,dx4,dy4,z4);
4003  if (fShading==kShaded) {
4004  if (fShadow==kShadowsNotPainted) {
4005  if (sr1<0||sr1>w1||tr1<0||tr1>w2) Transform(sr1,tr1,-1);
4006  else Transform(sr1,tr1,0);
4007  dxr1 = fDxspline;
4008  dyr1 = fDyspline;
4009  zr1 = fZ;
4010  if (sr8<0||sr8>w1||tr8<0||tr8>w2) Transform(sr8,tr8,-1);
4011  else Transform(sr8,tr8,0);
4012  dxr2 = fDxspline;
4013  dyr2 = fDyspline;
4014  zr2 = fZ;
4015  v = v+ColorCalculation(dxr1,dyr1,zr1,dx2,dy2,z2,dx1,dy1,z1);
4016  v = v+ColorCalculation(dxr1,dyr1,zr1,dx1,dy1,z1,dxr2,dyr2,zr2);
4017  v = v+ColorCalculation(dxr2,dyr2,zr2,dx1,dy1,z1,dx4,dy4,z4);
4018  v1 = v/4;
4019  if (sr3<0||sr3>w1||tr3<0||tr3>w2) Transform(sr3,tr3,-1);
4020  else Transform(sr3,tr3,0);
4021  dxr1 = fDxspline;
4022  dyr1 = fDyspline;
4023  zr1 = fZ;
4024  if (sr2<0||sr2>w1||tr2<0||tr2>w2) Transform(sr2,tr2,-1);
4025  else Transform(sr2,tr2,0);
4026  dxr2 = fDxspline;
4027  dyr2 = fDyspline;
4028  zr2 = fZ;
4029  v = ColorCalculation(dx1,dy1,z1,dx2,dy2,z2,dx3,dy3,z3);
4030  v = v+ColorCalculation(dx2,dy2,z2,dxr1,dyr1,zr1,dx3,dy3,z3);
4031  v = v+ColorCalculation(dx2,dy2,z2,dxr2,dyr2,zr2,dxr1,dyr1,zr1);
4032  v = v+ColorCalculation(dxr2,dyr2,zr2,dx2,dy2,z2,dx1,dy1,z1);
4033  v2 = v/4;
4034  if (sr5<0||sr5>w1||tr5<0||tr5>w2) Transform(sr5,tr5,-1);
4035  else Transform(sr5,tr5,0);
4036  dxr1 = fDxspline;
4037  dyr1 = fDyspline;
4038  zr1 = fZ;
4039  if (sr4<0||sr4>w1||tr4<0||tr4>w2) Transform(sr4,tr4,-1);
4040  else Transform(sr4,tr4,0);
4041  dxr2 = fDxspline;
4042  dyr2 = fDyspline;
4043  zr2 = fZ;
4044  v = ColorCalculation(dx2,dy2,z2,dx3,dy3,z3,dx4,dy4,z4);
4045  v = v+ColorCalculation(dx4,dy4,z4,dx3,dy3,z3,dxr1,dyr1,zr1);
4046  v = v+ColorCalculation(dx3,dy3,z3,dxr2,dyr2,zr2,dxr1,dyr1,zr1);
4047  v = v+ColorCalculation(dx2,dy2,z2,dxr2,dyr2,zr2,dx3,dy3,z3);
4048  v3 = v/4;
4049  if (sr7<0||sr7>w1||tr7<0||tr7>w2) Transform(sr7,tr7,-1);
4050  else Transform(sr7,tr7,0);
4051  dxr1 = fDxspline;
4052  dyr1 = fDyspline;
4053  zr1 = fZ;
4054  if (sr6<0||sr6>w1||tr6<0||tr6>w2) Transform(sr6,tr6,-1);
4055  else Transform(sr6,tr6,0);
4056  dxr2 = fDxspline;
4057  dyr2 = fDyspline;
4058  zr2 = fZ;
4059  v = ColorCalculation(dx1,dy1,z1,dx3,dy3,z3,dx4,dy4,z4);
4060  v = v+ColorCalculation(dx4,dy4,z4,dx3,dy3,z3,dxr2,dyr2,zr2);
4061  v = v+ColorCalculation(dx4,dy4,z4,dxr2,dyr2,zr2,dxr1,dyr1,zr1);
4062  v = v+ColorCalculation(dx1,dy1,z1,dx4,dy4,z4,dxr1,dyr1,zr1);
4063  v4 = v/4;
4064  } else {
4065  spriz = ShadowColorCalculation(xtaz,ytaz,ztaz,shad_noise);
4066  v = v+spriz;
4067  v = v/2;
4068  if (sr1<0||sr1>w1||tr1<0||tr1>w2) Transform(sr1,tr1,-1);
4069  else Transform(sr1,tr1,0);
4070  dxr1 = fDxspline;
4071  dyr1 = fDyspline;
4072  zr1 = fZ;
4073  if (sr8<0||sr8>w1||tr8<0||tr8>w2) Transform(sr8,tr8,-1);
4074  else Transform(sr8,tr8,0);
4075  dxr2 = fDxspline;
4076  dyr2 = fDyspline;
4077  zr2 = fZ;
4078  da = (dxr1+dx2+dx1)/3;
4079  db = (dyr1+dy2+dy1)/3;
4080  dc = (zr1+z2+z1)/3;
4081  spriz = ShadowColorCalculation(da,db,dc,shad_noise);
4082  v = v+(ColorCalculation(dxr1,dyr1,zr1,dx2,dy2,z2,dx1,dy1,z1)+spriz)/2;
4083  da = (dxr1+dxr2+dx1)/3;
4084  db = (dyr1+dyr2+dy1)/3;
4085  dc = (zr1+zr2+z1)/3;
4086  spriz = ShadowColorCalculation(da,db,dc,shad_noise);
4087  v = v+(ColorCalculation(dxr1,dyr1,zr1,dx1,dy1,z1,dxr2,dyr2,zr2)+spriz)/2;
4088  da = (dxr2+dx1+dx4)/3;
4089  db = (dyr2+dy1+dy4)/3;
4090  dc = (zr2+z1+z4)/3;
4091  spriz = ShadowColorCalculation(da,db,dc,shad_noise);
4092  v = v+(ColorCalculation(dxr2,dyr2,zr2,dx1,dy1,z1,dx4,dy4,z4)+spriz)/2;
4093  v1 = v/4;
4094  if (sr3<0||sr3>w1||tr3<0||tr3>w2) Transform(sr3,tr3,-1);
4095  else Transform(sr3,tr3,0);
4096  dxr1 = fDxspline;
4097  dyr1 = fDyspline;
4098  zr1 = fZ;
4099  if (sr2<0||sr2>w1||tr2<0||tr2>w2) Transform(sr2,tr2,-1);
4100  else Transform(sr2,tr2,0);
4101  dxr2 = fDxspline;
4102  dyr2 = fDyspline;
4103  zr2 = fZ;
4104  da = (dx1+dx2+dx3)/3;
4105  db = (dy1+dy2+dy3)/3;
4106  dc = (z1+z2+z3)/3;
4107  spriz = ShadowColorCalculation(da,db,dc,shad_noise);
4108  v = (ColorCalculation(dx1,dy1,z1,dx2,dy2,z2,dx3,dy3,z3)+spriz)/2;
4109  da = (dx2+dxr1+dx3)/3;
4110  db = (dy2+dyr1+dy3)/3;
4111  dc = (z2+zr1+z3)/3;
4112  spriz = ShadowColorCalculation(da,db,dc,shad_noise);
4113  v = v+(ColorCalculation(dx2,dy2,z2,dxr1,dyr1,zr1,dx3,dy3,z3)+spriz)/2;
4114  da = (dx2+dxr2+dxr1)/3;
4115  db = (dy2+dyr2+dyr1)/3;
4116  dc = (z2+zr2+zr1)/3;
4117  spriz = ShadowColorCalculation(da,db,dc,shad_noise);
4118  v = v+(ColorCalculation(dx2,dy2,z2,dxr2,dyr2,zr2,dxr1,dyr1,zr1)+spriz)/2;
4119  da = (dxr2+dx2+dx1)/3;
4120  db = (dyr2+dy2+dy1)/3;
4121  dc = (zr2+z2+z1)/3;
4122  spriz = ShadowColorCalculation(da,db,dc,shad_noise);
4123  v = v+(ColorCalculation(dxr2,dyr2,zr2,dx2,dy2,z2,dx1,dy1,z1)+spriz)/2;
4124  v2 = v/4;
4125  if (sr5<0||sr5>w1||tr5<0||tr5>w2) Transform(sr5,tr5,-1);
4126  else Transform(sr5,tr5,0);
4127  dxr1 = fDxspline;
4128  dyr1 = fDyspline;
4129  zr1 = fZ;
4130  if (sr4<0||sr4>w1||tr4<0||tr4>w2) Transform(sr4,tr4,-1);
4131  else Transform(sr4,tr4,0);
4132  dxr2 = fDxspline;
4133  dyr2 = fDyspline;
4134  zr2 = fZ;
4135  da = (dx2+dx3+dx4)/3;
4136  db = (dy2+dy3+dy4)/3;
4137  dc = (z2+z3+z4)/3;
4138  spriz = ShadowColorCalculation(da,db,dc,shad_noise);
4139  v = (ColorCalculation(dx2,dy2,z2,dx3,dy3,z3,dx4,dy4,z4)+spriz)/2;
4140  da = (dx4+dx3+dxr1)/3;
4141  db = (dy4+dy3+dyr1)/3;
4142  dc = (z4+z3+zr1)/3;
4143  spriz = ShadowColorCalculation(da,db,dc,shad_noise);
4144  v = v+(ColorCalculation(dx4,dy4,z4,dx3,dy3,z3,dxr1,dyr1,zr1)+spriz)/2;
4145  da = (dx3+dxr2+dxr1)/3;
4146  db = (dy3+dyr2+dyr1)/3;
4147  dc = (z3+zr2+zr1)/3;
4148  spriz = ShadowColorCalculation(da,db,dc,shad_noise);
4149  v = v+(ColorCalculation(dx3,dy3,z3,dxr2,dyr2,zr2,dxr1,dyr1,zr1)+spriz)/2;
4150  da = (dx2+dxr2+dx3)/3;
4151  db = (dy2+dyr2+dy3)/3;
4152  dc = (z2+zr2+z3)/3;
4153  spriz = ShadowColorCalculation(da,db,dc,shad_noise);
4154  v = v+(ColorCalculation(dx2,dy2,z2,dxr2,dyr2,zr2,dx3,dy3,z3)+spriz)/2;
4155  v3 = v/4;
4156  if (sr7<0||sr7>w1||tr7<0||tr7>w2) Transform(sr7,tr7,-1);
4157  else Transform(sr7,tr7,0);
4158  dxr1 = fDxspline;
4159  dyr1 = fDyspline;
4160  zr1 = fZ;
4161  if (sr6<0||sr6>w1||tr6<0||tr6>w2) Transform(sr6,tr6,-1);
4162  else Transform(sr6,tr6,0);
4163  dxr2 = fDxspline;
4164  dyr2 = fDyspline;
4165  zr2 = fZ;
4166  da = (dx1+dx3+dx4)/3;
4167  db = (dy1+dy3+dy4)/3;
4168  dc = (z1+z3+z4)/3;
4169  spriz = ShadowColorCalculation(da,db,dc,shad_noise);
4170  v = (ColorCalculation(dx1,dy1,z1,dx3,dy3,z3,dx4,dy4,z4)+spriz)/2;
4171  da = (dx4+dx3+dxr2)/3;
4172  db = (dy4+dy3+dyr2)/3;
4173  dc = (z4+z3+zr2)/3;
4174  spriz = ShadowColorCalculation(da,db,dc,shad_noise);
4175  v = v+(ColorCalculation(dx4,dy4,z4,dx3,dy3,z3,dxr2,dyr2,zr2)+spriz)/2;
4176  da = (dx4+dxr2+dxr1)/3;
4177  db = (dy4+dyr2+dyr1)/3;
4178  dc = (z4+zr2+zr1)/3;
4179  spriz = ShadowColorCalculation(da,db,dc,shad_noise);
4180  v = v+(ColorCalculation(dx4,dy4,z4,dxr2,dyr2,zr2,dxr1,dyr1,zr1)+spriz)/2;
4181  da = (dx1+dx4+dxr1)/3;
4182  db = (dy1+dy4+dyr1)/3;
4183  dc = (z1+z4+zr1)/3;
4184  spriz = ShadowColorCalculation(da,db,dc,shad_noise);
4185  v = v+(ColorCalculation(dx1,dy1,z1,dx4,dy4,z4,dxr1,dyr1,zr1)+spriz)/2;
4186  v4 = v/4;
4187  }
4188  }
4189  spriz = 0;
4190  if (fShadow==kShadowsNotPainted) {
4191  if (fShading==kNotShaded) {
4192  v = v*fLevels+0.5;
4193  iv = fLevels-(Int_t)v;
4194  } else {
4195  v1 = v1*fLevels;
4196  iv1 = fLevels-(Int_t)v1;
4197  v2 = v2*fLevels;
4198  iv2 = fLevels-(Int_t)v2;
4199  v4 = v4*fLevels;
4200  iv4 = fLevels-(Int_t)v4;
4201  }
4202  } else {
4203  spriz = ShadowColorCalculation(xtaz,ytaz,ztaz,shad_noise);
4204  if (fShading==kNotShaded) {
4205  v = v*fLevels/2.0;
4206  iv = fLevels-(Int_t)(v+0.5);
4207  } else {
4208  v1 = v1*fLevels;
4209  iv1 = fLevels-(Int_t)v1;
4210  v2 = v2*fLevels;
4211  iv2 = fLevels-(Int_t)v2;
4212  v4 = v4*fLevels;
4213  iv4 = fLevels-(Int_t)v4;
4214  }
4215  }
4216  if (fShading==kNotShaded) {
4217  ColorModel(iv,ui1,ui2,ui3);
4219  } else {
4220  dx1 = x1;
4221  dy1 = y1;
4222  dx2 = x2;
4223  dy2 = y2;
4224  dx3 = x4;
4225  dy3 = y4;
4226  z1 = iv1;
4227  z2 = iv2;
4228  z3 = iv4;
4229  da = (dy2-dy1)*(z3-z1)-(dy3-dy1)*(z2-z1);
4230  db = (z2-z1)*(dx3-dx1)-(z3-z1)*(dx2-dx1);
4231  dc = (dx2-dx1)*(dy3-dy1)-(dx3-dx1)*(dy2-dy1);
4232  dd = -da*dx1-db*dy1-dc*z1;
4233  }
4234  sx1 = x1;
4235  sy1 = y1;
4236  sx3 = x4;
4237  sy3 = y4;
4238  if (sx3<sx1) {
4239  sx4 = sx1;
4240  sy4 = sy1;
4241  sx1 = sx3;
4242  sy1 = sy3;
4243  sx3 = sx4;
4244  sy3 = sy4;
4245  }
4246  pom1 = sy3-sy1;
4247  pom2 = sx3-sx1;
4248  if (pom2!=0) sdx2 = pom1/pom2;
4249  pom1 = sy1;
4250  pom2 = sx1;
4251  sdy2 = pom1-sdx2*pom2;
4252  sx1p = sx1;
4253  sy1p = sy1;
4254  sx3p = sx3;
4255  sdx2p = sdx2;
4256  sdy2p = sdy2;
4257  dap = da;
4258  dbp = db;
4259  dcp = dc;
4260  ddp = dd;
4261  uip = fNewColorIndex;
4262  xtaz = (dx3+dx2+dx4)/3;
4263  ytaz = (dy3+dy2+dy4)/3;
4264  ztaz = (z3+z2+z4)/3;
4265  if (fShading==kNotShaded) v=ColorCalculation(dx2,dy2,z2,dx3,dy3,z3,dx4,dy4,z4);
4266  spriz = 0;
4267  if (fShadow==kShadowsNotPainted) {
4268  if (fShading==kNotShaded) {
4269  v = v*fLevels;
4270  iv = fLevels-(Int_t)v;
4271  } else {
4272  v3 = v3*fLevels;
4273  iv3 = fLevels-(Int_t)v3;
4274  }
4275  } else {
4276  spriz = ShadowColorCalculation(xtaz,ytaz,ztaz,shad_noise);
4277  if (fShading==kNotShaded) {
4278  v = v*fLevels/2;
4279  iv = fLevels-(Int_t)v;
4280  iv = (Int_t)(iv-fLevels*spriz/2);
4281  } else {
4282  v3 = v3*fLevels;
4283  iv3 = fLevels-(Int_t)v3;
4284  }
4285  }
4286  if (fShading==kNotShaded) {
4287  ColorModel(iv,ui1,ui2,ui3);
4289  } else {
4290  dx1 = x2;
4291  dy1 = y2;
4292  dx2 = x3;
4293  dy2 = y3;
4294  dx3 = x4;
4295  dy3 = y4;
4296  z1 = iv2;
4297  z2 = iv3;
4298  z3 = iv4;
4299  da = (dy2-dy1)*(z3-z1)-(dy3-dy1)*(z2-z1);
4300  db = (z2-z1)*(dx3-dx1)-(z3-z1)*(dx2-dx1);
4301  dc = (dx2-dx1)*(dy3-dy1)-(dx3-dx1)*(dy2-dy1);
4302  dd = -da*dx1-db*dy1-dc*z1;
4303  }
4304  sx1 = x2;
4305  sy1 = y2;
4306  sx2 = x3;
4307  sy2 = y3;
4308  if (sx2<sx1) {
4309  sx4 = sx1;
4310  sy4 = sy1;
4311  sx1 = sx2;
4312  sy1 = sy2;
4313  sx2 = sx4;
4314  sy2 = sy4;
4315  }
4316  pom1 = sy2-sy1;
4317  pom2 = sx2-sx1;
4318  sdx1 = 0;
4319  if (pom2!=0) sdx1 = pom1/pom2;
4320  pom1 = sy1;
4321  pom2 = sx1;
4322  sdy1 = pom1-sdx1*pom2;
4323  for (sx4=sx1,sx5=sx1,sy5=sy1;sx4<=sx2;sx4++) {
4324  pom1 = sx4;
4325  sdy4 = sdx1*pom1+sdy1;
4326  sy4 = (Int_t)sdy4;
4327  if (sy4<=fEnvelope[sx4]) {
4328  fEnvelope[sx4] = sy4;
4329  if (fShading==kNotShaded) {
4330  line->PaintLine(gPad->PixeltoX(sx4),gPad->PixeltoY(sy4)+1,gPad->PixeltoX(sx5),gPad->PixeltoY(sy5)+1);
4331  } else {
4332  dx1 = sx4;
4333  dy1 = sy4;
4334  if (dc!=0) v = (-dd-da*dx1-db*dy1)/dc;
4335  else v =(iv1+iv2+iv4)/3;
4336  iv = (Int_t)v;
4337  ColorModel(iv,ui1,ui2,ui3);
4339  line->PaintLine(gPad->PixeltoX(sx4),gPad->PixeltoY(sy4)+1,gPad->PixeltoX(sx5),gPad->PixeltoY(sy5)+1);
4340  }
4341  sy5 = sy4;
4342  } else {
4343  sy4 = fEnvelope[sx4];
4344  if (fShading==kNotShaded&&sy5<=fEnvelope[sx5]) {
4345  line->PaintLine(gPad->PixeltoX(sx4),gPad->PixeltoY(sy4)+1,gPad->PixeltoX(sx5),gPad->PixeltoY(sy5)+1);
4346  } else if (sy5<=fEnvelope[sx5]) {
4347  dx1 = sx4;
4348  dy1 = sy4;
4349  if (dc!=0) v = (-dd-da*dx1-db*dy1)/dc;
4350  else v =(iv1+iv2+iv4)/3;
4351  iv = (Int_t)v;
4352  ColorModel(iv,ui1,ui2,ui3);
4354  line->PaintLine(gPad->PixeltoX(sx4),gPad->PixeltoY(sy4)+1,gPad->PixeltoX(sx5),gPad->PixeltoY(sy5)+1);
4355  }
4356  sy5 = fEnvelope[sx4];
4357  }
4358  sx5 = sx4;
4359  }
4360  for (sx4=sx1p,sx5=sx1p,sy5=sy1p;sx4<=sx3p;sx4++) {
4361  pom1 = sx4;
4362  sdy4 = sdx2p*pom1+sdy2p;
4363  sy4 = (Int_t)sdy4;
4364  if (sy4<=fEnvelope[sx4]) {
4365  fEnvelope[sx4]=sy4;
4366  if (fShading==kNotShaded) {
4367  line->SetLineColor(uip);
4368  line->PaintLine(gPad->PixeltoX(sx4),gPad->PixeltoY(sy4)+1,gPad->PixeltoX(sx5),gPad->PixeltoY(sy5)+1);
4369  } else {
4370  dx1 = sx4;
4371  dy1 = sy4;
4372  if (dcp!=0) v = (-ddp-dap*dx1-dbp*dy1)/dcp;
4373  else v = (iv1+iv2+iv4)/3;
4374  iv = (Int_t)v;
4375  ColorModel(iv,ui1,ui2,ui3);
4377  line->PaintLine(gPad->PixeltoX(sx4),gPad->PixeltoY(sy4)+1,gPad->PixeltoX(sx5),gPad->PixeltoY(sy5)+1);
4378  }
4379  sy5 = sy4;
4380  } else {
4381  sy4 = fEnvelope[sx4];
4382  if (fShading==kNotShaded&&sy5<=fEnvelope[sx5]) {
4383  line->SetLineColor(uip);
4384  line->PaintLine(gPad->PixeltoX(sx4),gPad->PixeltoY(sy4)+1,gPad->PixeltoX(sx5),gPad->PixeltoY(sy5)+1);
4385  } else if (sy5<=fEnvelope[sx5]) {
4386  dx1 = sx4;
4387  dy1 = sy4;
4388  if (dcp!=0) v = (-ddp-dap*dx1-dbp*dy1)/dcp;
4389  else v = (iv1+iv2+iv4)/3;
4390  iv = (Int_t)v;
4391  ColorModel(iv,ui1,ui2,ui3);
4393  line->PaintLine(gPad->PixeltoX(sx4),gPad->PixeltoY(sy4)+1,gPad->PixeltoX(sx5),gPad->PixeltoY(sy5)+1);
4394  }
4395  sy5 = fEnvelope[sx4];
4396  }
4397  sx5 = sx4;
4398  }
4399  }
4400  }
4401  break;
4402  case kDisplayModeLinesY:
4404  if (((flag!=0)&&(smer==0))||((flag==0)&&(smer!=0))) {
4405  if (fBezier==kNoBezierInterpol) {
4406  Envelope(x1,y1,x2,y2);
4407  if (fLine!=0) {
4408  if (fLine==1) {
4409  fXe = x2;
4410  fYe = y2;
4411  }
4412  line->PaintLine(gPad->PixeltoX(fXs),gPad->PixeltoY(fYs)+1,gPad->PixeltoX(fXe),gPad->PixeltoY(fYe)+1);
4413  }
4414  } else {
4415  s1 = (Int_t)TMath::Max(q1-1,0);
4416  t1 = q2;
4417  s2 = (Int_t)TMath::Min(q1+2,w1);
4418  t2 = q2;
4419  if (turni==1) {
4420  i1 = s1;
4421  i2 = s2;
4422  } else {
4423  i1 = w1-s1;
4424  i2 = w1-s2;
4425  }
4426  if (turnj==1) {
4427  j1 = t1;
4428  j2 = t2;
4429  } else {
4430  j1 = w2-t1;
4431  j2 = w2-t2;
4432  }
4433  Transform(i1,j1,0);
4434  x3 = fXt;
4435  y3 = fYt;
4436  Transform(i2,j2,0);
4437  x4 = fXt;
4438  y4 = fYt;
4439  bezx1 = x1+(x2-x1)/3;
4440  bezx2 = x1+2*(x2-x1)/3;
4441  bezy1 = y1+(y2-y3)/6;
4442  bezy2 = y2-(y4-y1)/6;
4443  if (x1<=x2) {
4444  if (bezx1<=x1) {
4445  bezx1 = x1;
4446  bezy1 = y1;
4447  }
4448  if (bezx1>=x2) {
4449  bezx1 = x2;
4450  bezy1 = y2;
4451  }
4452  if (bezx2<=x1) {
4453  bezx2 = x1;
4454  bezy2 = y1;
4455  }
4456  if (bezx2>=x2) {
4457  bezx2 = x2;
4458  bezy2 = y2;
4459  }
4460  fBzX[0] = x1;
4461  fBzY[0] = y1;
4462  fBzX[1] = (Int_t)bezx1;
4463  fBzY[1] = (Int_t)bezy1;
4464  fBzX[2] = (Int_t)bezx2;
4465  fBzY[2] = (Int_t)bezy2;
4466  fBzX[3] = x2;
4467  fBzY[3] = y2;
4468  for (bezf=0;bezf<1.01;bezf+=0.1) {
4469  BezierSmoothing(bezf);
4470  if (bezf==0) {
4471  ibezx1 = (Int_t)(fGbezx+0.5);
4472  ibezy1 = (Int_t)(fGbezy+0.5);
4473  } else {
4474  ibezx2 = ibezx1;
4475  ibezy2 = ibezy1;
4476  ibezx1 = (Int_t)(fGbezx+0.5);
4477  ibezy1 = (Int_t)(fGbezy+0.5);
4478  Envelope(ibezx2,ibezy2,ibezx1,ibezy1);
4479  if (fLine!=0) {
4480  if (fLine==1) {
4481  fXe = ibezx1;
4482  fYe = ibezy1;
4483  }
4484  line->PaintLine(gPad->PixeltoX(fXs),gPad->PixeltoY(fYs)+1,gPad->PixeltoX(fXe),gPad->PixeltoY(fYe)+1);
4485  }
4486  }
4487  }
4488  } else if (x1>x2) {
4489  if (bezx1>=x1) {
4490  bezx1 = x1;
4491  bezy1 = y1;
4492  }
4493  if (bezx1<=x2) {
4494  bezx1 = x2;
4495  bezy1 = y2;
4496  }
4497  if (bezx2>=x1) {
4498  bezx2 = x1;
4499  bezy2 = y1;
4500  }
4501  if (bezx2<=x2) {
4502  bezx2 = x2;
4503  bezy2 = y2;
4504  }
4505  fBzX[0] = x1;
4506  fBzY[0] = y1;
4507  fBzX[1] = (Int_t)bezx1;
4508  fBzY[1] = (Int_t)bezy1;
4509  fBzX[2] = (Int_t)bezx2;
4510  fBzY[2] = (Int_t)bezy2;
4511  fBzX[3] = x2;
4512  fBzY[3] = y2;
4513  for (bezf=0;bezf<1.01;bezf+=0.1) {
4514  BezierSmoothing(bezf);
4515  if (bezf==0) {
4516  ibezx1 = (Int_t)(fGbezx+0.5);
4517  ibezy1 = (Int_t)(fGbezy+0.5);
4518  } else {
4519  ibezx2 = ibezx1;
4520  ibezy2 = ibezy1;
4521  ibezx1 = (Int_t)(fGbezx+0.5);
4522  ibezy1 = (Int_t)(fGbezy+0.5);
4523  Envelope(ibezx1,ibezy1,ibezx2,ibezy2);
4524  if (fLine!=0) {
4525  if (fLine==1) {
4526  fXe = ibezx2;
4527  fYe = ibezy2;
4528  }
4529  line->PaintLine(gPad->PixeltoX(fXs),gPad->PixeltoY(fYs)+1,gPad->PixeltoX(fXe),gPad->PixeltoY(fYe)+1);
4530  }
4531  }
4532  }
4533  }
4534  }
4535  }
4536  } else {
4537  if ((q1!=q2||smer!=0)&&flag==1) {
4538  s1 = q1+1;
4539  t1 = q2;
4540  s2 = q1;
4541  t2 = q2;
4542  s3 = q1;
4543  t3 = q2+1;
4544  s4 = q1+1;
4545  t4 = q2+1;
4546  if (fShading==kShaded) {
4547  sr1 = s1;
4548  tr1 = (Int_t)TMath::Max(t1-1,0);
4549  sr2 = s2;
4550  tr2 = (Int_t)TMath::Max(t2-1,0);
4551  sr3 = (Int_t)TMath::Max(s2-1,0);
4552  tr3 = t2;
4553  sr4 = (Int_t)TMath::Max(s3-1,0);
4554  tr4 = t3;
4555  sr5 = s3;
4556  tr5 = t3+1;
4557  sr6 = s4;
4558  tr6 = t4+1;
4559  sr7 = s4+1;
4560  tr7 = t4;
4561  sr8 = s1+1;
4562  tr8 = t1;
4563  }
4564  if (turni==1) {
4565  i1 = s1;
4566  i2 = s2;
4567  i3 = s3;
4568  i4 = s4;
4569  } else {
4570  i1 = (Int_t)TMath::Max(w1-s1,0);
4571  i2 = (Int_t)TMath::Max(w1-s2,0);
4572  i3 = (Int_t)TMath::Max(w1-s3,0);
4573  i4 = (Int_t)TMath::Max(w1-s4,0);
4574  if (fShading==kShaded) {
4575  sr1 = (Int_t)TMath::Max(w1-sr1,0);
4576  sr2 = (Int_t)TMath::Max(w1-sr2,0);
4577  sr3 = (Int_t)TMath::Max(w1-sr3,0);
4578  sr4 = (Int_t)TMath::Max(w1-sr4,0);
4579  sr5 = (Int_t)TMath::Max(w1-sr5,0);
4580  sr6 = (Int_t)TMath::Max(w1-sr6,0);
4581  sr7 = (Int_t)TMath::Max(w1-sr7,0);
4582  sr8 = (Int_t)TMath::Max(w1-sr8,0);
4583  }
4584  }
4585  if (turnj==1) {
4586  j1 = t1;
4587  j2 = t2;
4588  j3 = t3;
4589  j4 = t4;
4590  } else {
4591  j1 = (Int_t)TMath::Max(w2-t1,0);
4592  j2 = (Int_t)TMath::Max(w2-t2,0);
4593  j3 = (Int_t)TMath::Max(w2-t3,0);
4594  j4 = (Int_t)TMath::Max(w2-t4,0);
4595  if (fShading==kShaded) {
4596  tr1 = (Int_t)TMath::Max(w2-tr1,0);
4597  tr2 = (Int_t)TMath::Max(w2-tr2,0);
4598  tr3 = (Int_t)TMath::Max(w2-tr3,0);
4599  tr4 = (Int_t)TMath::Max(w2-tr4,0);
4600  tr5 = (Int_t)TMath::Max(w2-tr5,0);
4601  tr6 = (Int_t)TMath::Max(w2-tr6,0);
4602  tr7 = (Int_t)TMath::Max(w2-tr7,0);
4603  tr8 = (Int_t)TMath::Max(w2-tr8,0);
4604  }
4605  }
4606  Transform(i1,j1,0);
4607  x1 = fXt;
4608  y1 = fYt;
4609  dx1 = fDxspline;
4610  dy1 = fDyspline;
4611  z1 = fZ;
4612  Transform(i2,j2,0);
4613  x2 = fXt;
4614  y2 = fYt;
4615  dx2 = fDxspline;
4616  dy2 = fDyspline;
4617  z2 = fZ;
4618  Transform(i3,j3,0);
4619  x3 = fXt;
4620  y3 = fYt;
4621  dx3 = fDxspline;
4622  dy3 = fDyspline;
4623  z3 = fZ;
4624  Transform(i4,j4,0);
4625  x4 = fXt;
4626  y4 = fYt;
4627  dx4 = fDxspline;
4628  dy4 = fDyspline;
4629  z4 = fZ;
4630  Envelope(x1,y1,x2,y2);
4631  Envelope(x2,y2,x3,y3);
4632  xtaz = (dx1+dx2+dx4)/3;
4633  ytaz = (dy1+dy2+dy4)/3;
4634  ztaz = (z1+z2+z4)/3;
4635  v = ColorCalculation(dx1,dy1,z1,dx2,dy2,z2,dx4,dy4,z4);
4636  if (fShading==kShaded) {
4637  if (fShadow==kShadowsNotPainted) {
4638  if (sr1<0||sr1>w1||tr1<0||tr1>w2) Transform(sr1,tr1,-1);
4639  else Transform(sr1,tr1,0);
4640  dxr1 = fDxspline;
4641  dyr1 = fDyspline;
4642  zr1 = fZ;
4643  if (sr8<0||sr8>w1||tr8<0||tr8>w2) Transform(sr8,tr8,-1);
4644  else Transform(sr8,tr8,0);
4645  dxr2 = fDxspline;
4646  dyr2 = fDyspline;
4647  zr2 = fZ;
4648  v = v+ColorCalculation(dxr1,dyr1,zr1,dx2,dy2,z2,dx1,dy1,z1);
4649  v = v+ColorCalculation(dxr1,dyr1,zr1,dx1,dy1,z1,dxr2,dyr2,zr2);
4650  v = v+ColorCalculation(dxr2,dyr2,zr2,dx1,dy1,z1,dx4,dy4,z4);
4651  v1 = v/4;
4652  if (sr3<0||sr3>w1||tr3<0||tr3>w2) Transform(sr3,tr3,-1);
4653  else Transform(sr3,tr3,0);
4654  dxr1 = fDxspline;
4655  dyr1 = fDyspline;
4656  zr1 = fZ;
4657  if (sr2<0||sr2>w1||tr2<0||tr2>w2) Transform(sr2,tr2,-1);
4658  else Transform(sr2,tr2,0);
4659  dxr2 = fDxspline;
4660  dyr2 = fDyspline;
4661  zr2 = fZ;
4662  v = ColorCalculation(dx1,dy1,z1,dx2,dy2,z2,dx3,dy3,z3);
4663  v = v+ColorCalculation(dx2,dy2,z2,dxr1,dyr1,zr1,dx3,dy3,z3);
4664  v = v+ColorCalculation(dx2,dy2,z2,dxr2,dyr2,zr2,dxr1,dyr1,zr1);
4665  v = v+ColorCalculation(dxr2,dyr2,zr2,dx2,dy2,z2,dx1,dy1,z1);
4666  v2 = v/4;
4667  if (sr5<0||sr5>w1||tr5<0||tr5>w2) Transform(sr5,tr5,-1);
4668  else Transform(sr5,tr5,0);
4669  dxr1 = fDxspline;
4670  dyr1 = fDyspline;
4671  zr1 = fZ;
4672  if (sr4<0||sr4>w1||tr4<0||tr4>w2) Transform(sr4,tr4,-1);
4673  else Transform(sr4,tr4,0);
4674  dxr2 = fDxspline;
4675  dyr2 = fDyspline;
4676  zr2 = fZ;
4677  v = ColorCalculation(dx2,dy2,z2,dx3,dy3,z3,dx4,dy4,z4);
4678  v = v+ColorCalculation(dx4,dy4,z4,dx3,dy3,z3,dxr1,dyr1,zr1);
4679  v = v+ColorCalculation(dx3,dy3,z3,dxr2,dyr2,zr2,dxr1,dyr1,zr1);
4680  v = v+ColorCalculation(dx2,dy2,z2,dxr2,dyr2,zr2,dx3,dy3,z3);
4681  v3 = v/4;
4682  if (sr7<0||sr7>w1||tr7<0||tr7>w2) Transform(sr7,tr7,-1);
4683  else Transform(sr7,tr7,0);
4684  dxr1 = fDxspline;
4685  dyr1 = fDyspline;
4686  zr1 = fZ;
4687  if (sr6<0||sr6>w1||tr6<0||tr6>w2) Transform(sr6,tr6,-1);
4688  else Transform(sr6,tr6,0);
4689  dxr2 = fDxspline;
4690  dyr2 = fDyspline;
4691  zr2 = fZ;
4692  v = ColorCalculation(dx1,dy1,z1,dx3,dy3,z3,dx4,dy4,z4);
4693  v = v+ColorCalculation(dx4,dy4,z4,dx3,dy3,z3,dxr2,dyr2,zr2);
4694  v = v+ColorCalculation(dx4,dy4,z4,dxr2,dyr2,zr2,dxr1,dyr1,zr1);
4695  v = v+ColorCalculation(dx1,dy1,z1,dx4,dy4,z4,dxr1,dyr1,zr1);
4696  v4 = v/4;
4697  } else {
4698  spriz = ShadowColorCalculation(xtaz,ytaz,ztaz,shad_noise);
4699  v = v+spriz;
4700  v = v/2;
4701  if (sr1<0||sr1>w1||tr1<0||tr1>w2) Transform(sr1,tr1,-1);
4702  else Transform(sr1,tr1,0);
4703  dxr1 = fDxspline;
4704  dyr1 = fDyspline;
4705  zr1 = fZ;
4706  if (sr8<0||sr8>w1||tr8<0||tr8>w2) Transform(sr8,tr8,-1);
4707  else Transform(sr8,tr8,0);
4708  dxr2 = fDxspline;
4709  dyr2 = fDyspline;
4710  zr2 = fZ;
4711  da = (dxr1+dx2+dx1)/3;
4712  db = (dyr1+dy2+dy1)/3;
4713  dc = (zr1+z2+z1)/3;
4714  spriz = ShadowColorCalculation(da,db,dc,shad_noise);
4715  v = v+(ColorCalculation(dxr1,dyr1,zr1,dx2,dy2,z2,dx1,dy1,z1)+spriz)/2;
4716  da = (dxr1+dxr2+dx1)/3;
4717  db = (dyr1+dyr2+dy1)/3;
4718  dc = (zr1+zr2+z1)/3;
4719  spriz = ShadowColorCalculation(da,db,dc,shad_noise);
4720  v = v+(ColorCalculation(dxr1,dyr1,zr1,dx1,dy1,z1,dxr2,dyr2,zr2)+spriz)/2;
4721  da = (dxr2+dx1+dx4)/3;
4722  db = (dyr2+dy1+dy4)/3;
4723  dc = (zr2+z1+z4)/3;
4724  spriz = ShadowColorCalculation(da,db,dc,shad_noise);
4725  v = v+(ColorCalculation(dxr2,dyr2,zr2,dx1,dy1,z1,dx4,dy4,z4)+spriz)/2;
4726  v1 = v/4;
4727  if (sr3<0||sr3>w1||tr3<0||tr3>w2) Transform(sr3,tr3,-1);
4728  else Transform(sr3,tr3,0);
4729  dxr1 = fDxspline;
4730  dyr1 = fDyspline;
4731  zr1 = fZ;
4732  if (sr2<0||sr2>w1||tr2<0||tr2>w2) Transform(sr2,tr2,-1);
4733  else Transform(sr2,tr2,0);
4734  dxr2 = fDxspline;
4735  dyr2 = fDyspline;
4736  zr2 = fZ;
4737  da = (dx1+dx2+dx3)/3;
4738  db = (dy1+dy2+dy3)/3;
4739  dc = (z1+z2+z3)/3;
4740  spriz = ShadowColorCalculation(da,db,dc,shad_noise);
4741  v = (ColorCalculation(dx1,dy1,z1,dx2,dy2,z2,dx3,dy3,z3)+spriz)/2;
4742  da = (dx2+dxr1+dx3)/3;
4743  db = (dy2+dyr1+dy3)/3;
4744  dc = (z2+zr1+z3)/3;
4745  spriz = ShadowColorCalculation(da,db,dc,shad_noise);
4746  v = v+(ColorCalculation(dx2,dy2,z2,dxr1,dyr1,zr1,dx3,dy3,z3)+spriz)/2;
4747  da = (dx2+dxr2+dxr1)/3;
4748  db = (dy2+dyr2+dyr1)/3;
4749  dc = (z2+zr2+zr1)/3;
4750  spriz = ShadowColorCalculation(da,db,dc,shad_noise);
4751  v = v+(ColorCalculation(dx2,dy2,z2,dxr2,dyr2,zr2,dxr1,dyr1,zr1)+spriz)/2;
4752  da = (dxr2+dx2+dx1)/3;
4753  db = (dyr2+dy2+dy1)/3;
4754  dc = (zr2+z2+z1)/3;
4755  spriz = ShadowColorCalculation(da,db,dc,shad_noise);
4756  v = v+(ColorCalculation(dxr2,dyr2,zr2,dx2,dy2,z2,dx1,dy1,z1)+spriz)/2;
4757  v2 = v/4;
4758  if (sr5<0||sr5>w1||tr5<0||tr5>w2) Transform(sr5,tr5,-1);
4759  else Transform(sr5,tr5,0);
4760  dxr1 = fDxspline;
4761  dyr1 = fDyspline;
4762  zr1 = fZ;
4763  if (sr4<0||sr4>w1||tr4<0||tr4>w2) Transform(sr4,tr4,-1);
4764  else Transform(sr4,tr4,0);
4765  dxr2 = fDxspline;
4766  dyr2 = fDyspline;
4767  zr2 = fZ;
4768  da = (dx2+dx3+dx4)/3;
4769  db = (dy2+dy3+dy4)/3;
4770  dc = (z2+z3+z4)/3;
4771  spriz = ShadowColorCalculation(da,db,dc,shad_noise);
4772  v = (ColorCalculation(dx2,dy2,z2,dx3,dy3,z3,dx4,dy4,z4)+spriz)/2;
4773  da = (dx4+dx3+dxr1)/3;
4774  db = (dy4+dy3+dyr1)/3;
4775  dc = (z4+z3+zr1)/3;
4776  spriz = ShadowColorCalculation(da,db,dc,shad_noise);
4777  v = v+(ColorCalculation(dx4,dy4,z4,dx3,dy3,z3,dxr1,dyr1,zr1)+spriz)/2;
4778  da = (dx3+dxr2+dxr1)/3;
4779  db = (dy3+dyr2+dyr1)/3;
4780  dc = (z3+zr2+zr1)/3;
4781  spriz = ShadowColorCalculation(da,db,dc,shad_noise);
4782  v = v+(ColorCalculation(dx3,dy3,z3,dxr2,dyr2,zr2,dxr1,dyr1,zr1)+spriz)/2;
4783  da = (dx2+dxr2+dx3)/3;
4784  db = (dy2+dyr2+dy3)/3;
4785  dc = (z2+zr2+z3)/3;
4786  spriz = ShadowColorCalculation(da,db,dc,shad_noise);
4787  v = v+(ColorCalculation(dx2,dy2,z2,dxr2,dyr2,zr2,dx3,dy3,z3)+spriz)/2;
4788  v3 = v/4;
4789  if (sr7<0||sr7>w1||tr7<0||tr7>w2) Transform(sr7,tr7,-1);
4790  else Transform(sr7,tr7,0);
4791  dxr1 = fDxspline;
4792  dyr1 = fDyspline;
4793  zr1 = fZ;
4794  if (sr6<0||sr6>w1||tr6<0||tr6>w2) Transform(sr6,tr6,-1);
4795  else Transform(sr6,tr6,0);
4796  dxr2 = fDxspline;
4797  dyr2 = fDyspline;
4798  zr2 = fZ;
4799  da = (dx1+dx3+dx4)/3;
4800  db = (dy1+dy3+dy4)/3;
4801  dc = (z1+z3+z4)/3;
4802  spriz = ShadowColorCalculation(da,db,dc,shad_noise);
4803  v = (ColorCalculation(dx1,dy1,z1,dx3,dy3,z3,dx4,dy4,z4)+spriz)/2;
4804  da = (dx4+dx3+dxr2)/3;
4805  db = (dy4+dy3+dyr2)/3;
4806  dc = (z4+z3+zr2)/3;
4807  spriz = ShadowColorCalculation(da,db,dc,shad_noise);
4808  v = v+(ColorCalculation(dx4,dy4,z4,dx3,dy3,z3,dxr2,dyr2,zr2)+spriz)/2;
4809  da = (dx4+dxr2+dxr1)/3;
4810  db = (dy4+dyr2+dyr1)/3;
4811  dc = (z4+zr2+zr1)/3;
4812  spriz = ShadowColorCalculation(da,db,dc,shad_noise);
4813  v = v+(ColorCalculation(dx4,dy4,z4,dxr2,dyr2,zr2,dxr1,dyr1,zr1)+spriz)/2;
4814  da = (dx1+dx4+dxr1)/3;
4815  db = (dy1+dy4+dyr1)/3;
4816  dc = (z1+z4+zr1)/3;
4817  spriz = ShadowColorCalculation(da,db,dc,shad_noise);
4818  v = v+(ColorCalculation(dx1,dy1,z1,dx4,dy4,z4,dxr1,dyr1,zr1)+spriz)/2;
4819  v4 = v/4;
4820  }
4821  }
4822  spriz = 0;
4823  if (fShadow==kShadowsNotPainted) {
4824  if (fShading==kNotShaded) {
4825  v = v*fLevels+0.5;
4826  iv = fLevels-(Int_t)v;
4827  } else {
4828  v1 = v1*fLevels;
4829  iv1 = fLevels-(Int_t)v1;
4830  v2 = v2*fLevels;
4831  iv2 = fLevels-(Int_t)v2;
4832  v4 = v4*fLevels;
4833  iv4 = fLevels-(Int_t)v4;
4834  }
4835  } else {
4836  spriz = ShadowColorCalculation(xtaz,ytaz,ztaz,shad_noise);
4837  if (fShading==kNotShaded) {
4838  v = v*fLevels/2.0;
4839  iv = fLevels-(Int_t)(v+0.5);
4840  } else {
4841  v1 = v1*fLevels;
4842  iv1 = fLevels-(Int_t)v1;
4843  v2 = v2*fLevels;
4844  iv2 = fLevels-(Int_t)v2;
4845  v4 = v4*fLevels;
4846  iv4 = fLevels-(Int_t)v4;
4847  }
4848  }
4849  if (fShading==kNotShaded) {
4850  ColorModel(iv,ui1,ui2,ui3);
4852  } else {
4853  dx1 = x1;
4854  dy1 = y1;
4855  dx2 = x2;
4856  dy2 = y2;
4857  dx3 = x4;
4858  dy3 = y4;
4859  z1 = iv1;
4860  z2 = iv2;
4861  z3 = iv4;
4862  da = (dy2-dy1)*(z3-z1)-(dy3-dy1)*(z2-z1);
4863  db = (z2-z1)*(dx3-dx1)-(z3-z1)*(dx2-dx1);
4864  dc = (dx2-dx1)*(dy3-dy1)-(dx3-dx1)*(dy2-dy1);
4865  dd = -da*dx1-db*dy1-dc*z1;
4866  }
4867  sx1 = x1;
4868  sy1 = y1;
4869  sx2 = x2;
4870  sy2 = y2;
4871  if (sx2<sx1) {
4872  sx4 = sx1;
4873  sy4 = sy1;
4874  sx1 = sx2;
4875  sy1 = sy2;
4876  sx2 = sx4;
4877  sy2 = sy4;
4878  }
4879  sdx1 = 0;
4880  pom1 = sy2-sy1;
4881  pom2 = sx2-sx1;
4882  if (pom2!=0) sdx1 = pom1/pom2;
4883  pom1 = sy1;
4884  pom2 = sx1;
4885  sdy1 = pom1-sdx1*pom2;
4886  for (sx4=sx1,sx5=sx1,sy5=sy1;sx4<=sx2;sx4++) {
4887  pom1 = sx4;
4888  sdy4 = sdx1*pom1+sdy1;
4889  sy4 = (Int_t)sdy4;
4890  if (sy4<=fEnvelope[sx4]) {
4891  fEnvelope[sx4] = sy4;
4892  if (fShading==kNotShaded) {
4893  line->PaintLine(gPad->PixeltoX(sx4),gPad->PixeltoY(sy4)+1,gPad->PixeltoX(sx5),gPad->PixeltoY(sy5)+1);
4894  } else {
4895  dx1 = sx4;
4896  dy1 = sy4;
4897  if (dc!=0) v = (-dd-da*dx1-db*dy1)/dc;
4898  else v =(iv1+iv2+iv4)/3;
4899  iv = (Int_t)v;
4900  ColorModel(iv,ui1,ui2,ui3);
4902  line->PaintLine(gPad->PixeltoX(sx4),gPad->PixeltoY(sy4)+1,gPad->PixeltoX(sx5),gPad->PixeltoY(sy5)+1);
4903  }
4904  sy5 = sy4;
4905  } else {
4906  sy4 = fEnvelope[sx4];
4907  if (fShading==kNotShaded&&sy5<=fEnvelope[sx5]) {
4908  line->PaintLine(gPad->PixeltoX(sx4),gPad->PixeltoY(sy4)+1,gPad->PixeltoX(sx5),gPad->PixeltoY(sy5)+1);
4909  } else if (sy5<=fEnvelope[sx5]) {
4910  dx1 = sx4;
4911  dy1 = sy4;
4912  if (dc!=0) v = (-dd-da*dx1-db*dy1)/dc;
4913  else v =(iv1+iv2+iv4)/3;
4914  iv = (Int_t)v;
4915  ColorModel(iv,ui1,ui2,ui3);
4917  line->PaintLine(gPad->PixeltoX(sx4),gPad->PixeltoY(sy4)+1,gPad->PixeltoX(sx5),gPad->PixeltoY(sy5)+1);
4918  }
4919  sy5 = fEnvelope[sx4];
4920  }
4921  sx5 = sx4;
4922  }
4923  xtaz = (dx3+dx2+dx4)/3;
4924  ytaz = (dy3+dy2+dy4)/3;
4925  ztaz = (z3+z2+z4)/3;
4926  if (fShading==kNotShaded) v=ColorCalculation(dx2,dy2,z2,dx3,dy3,z3,dx4,dy4,z4);
4927  spriz = 0;
4928  if (fShadow==kShadowsNotPainted) {
4929  if (fShading==kNotShaded) {
4930  v = v*fLevels;
4931  iv = fLevels-(Int_t)v;
4932  } else {
4933  v3 = v3*fLevels;
4934  iv3 = fLevels-(Int_t)v3;
4935  }
4936  } else {
4937  spriz = ShadowColorCalculation(xtaz,ytaz,ztaz,shad_noise);
4938  if (fShading==kNotShaded) {
4939  v = v*fLevels/2;
4940  iv = fLevels-(Int_t)v;
4941  iv = (Int_t)(iv-fLevels*spriz/2);
4942  } else {
4943  v3 = v3*fLevels;
4944  iv3 = fLevels-(Int_t)v3;
4945  }
4946  }
4947  if (fShading==kNotShaded) {
4948  ColorModel(iv,ui1,ui2,ui3);
4950  } else {
4951  dx1 = x2;
4952  dy1 = y2;
4953  dx2 = x3;
4954  dy2 = y3;
4955  dx3 = x4;
4956  dy3 = y4;
4957  z1 = iv2;
4958  z2 = iv3;
4959  z3 = iv4;
4960  da = (dy2-dy1)*(z3-z1)-(dy3-dy1)*(z2-z1);
4961  db = (z2-z1)*(dx3-dx1)-(z3-z1)*(dx2-dx1);
4962  dc = (dx2-dx1)*(dy3-dy1)-(dx3-dx1)*(dy2-dy1);
4963  dd = -da*dx1-db*dy1-dc*z1;
4964  }
4965  sx2 = x3;
4966  sy2 = y3;
4967  sx3 = x4;
4968  sy3 = y4;
4969  if (sx3<sx2) {
4970  sx4 = sx2;
4971  sy4 = sy2;
4972  sx2 = sx3;
4973  sy2 = sy3;
4974  sx3 = sx4;
4975  sy3 = sy4;
4976  }
4977  sdx2 = 0;
4978  pom1 = sy3-sy2;
4979  pom2 = sx3-sx2;
4980  if (pom2!=0) sdx2 = pom1/pom2;
4981  pom1 = sy2;
4982  pom2 = sx2;
4983  sdy2 = pom1-sdx2*pom2;
4984  for (sx4=sx2,sx5=sx2,sy5=sy2;sx4<=sx3;sx4++) {
4985  pom1 = sx4;
4986  sdy4 = sdx2*pom1+sdy2;
4987  sy4 = (Int_t)sdy4;
4988  if (sy4<=fEnvelope[sx4]) {
4989  fEnvelope[sx4] = sy4;
4990  if (fShading==kNotShaded) {
4991  line->PaintLine(gPad->PixeltoX(sx4),gPad->PixeltoY(sy4)+1,gPad->PixeltoX(sx5),gPad->PixeltoY(sy5)+1);
4992  } else {
4993  dx1 = sx4;
4994  dy1 = sy4;
4995  if (dc!=0) v = (-dd-da*dx1-db*dy1)/dc;
4996  else v =(iv1+iv2+iv4)/3;
4997  iv = (Int_t)v;
4998  ColorModel(iv,ui1,ui2,ui3);
5000  line->PaintLine(gPad->PixeltoX(sx4),gPad->PixeltoY(sy4)+1,gPad->PixeltoX(sx5),gPad->PixeltoY(sy5)+1);
5001  }
5002  sy5 = sy4;
5003  } else {
5004  sy4 = fEnvelope[sx4];
5005  if (fShading==kNotShaded&&sy5<=fEnvelope[sx5]) {
5006  line->PaintLine(gPad->PixeltoX(sx4),gPad->PixeltoY(sy4)+1,gPad->PixeltoX(sx5),gPad->PixeltoY(sy5)+1);
5007  } else if (sy5<=fEnvelope[sx5]) {
5008  dx1 = sx4;
5009  dy1 = sy4;
5010  if (dc!=0) v = (-dd-da*dx1-db*dy1)/dc;
5011  else v =(iv1+iv2+iv4)/3;
5012  iv = (Int_t)v;
5013  ColorModel(iv,ui1,ui2,ui3);
5015  line->PaintLine(gPad->PixeltoX(sx4),gPad->PixeltoY(sy4)+1,gPad->PixeltoX(sx5),gPad->PixeltoY(sy5)+1);
5016  }
5017  sy5 = fEnvelope[sx4];
5018  }
5019  sx5 = sx4;
5020  }
5021  }
5022  }
5023  break;
5024  case kDisplayModeNeedles:
5025  Transform(i,j,-1);
5026  x2d = fXt;
5027  y2d = fYt;
5028  if (flag==1) {
5029  x = x1d;
5030  y = y1d;
5031  x1d = x2d;
5032  y1d = y2d;
5033  x2d = x;
5034  y2d = y;
5035  }
5036  line->PaintLine(gPad->PixeltoX(x1),gPad->PixeltoY(y1)+1,gPad->PixeltoX(x1d),gPad->PixeltoY(y1d)+1);
5037  line->PaintLine(gPad->PixeltoX(x2),gPad->PixeltoY(y2)+1,gPad->PixeltoX(x2d),gPad->PixeltoY(y2d)+1);
5038  break;
5039  case kDisplayModeSurface:
5040  box->SetFillStyle(1001);
5041  if ((q1!=q2||smer!=0)&&flag==1) {
5042  s1 = q1+1;
5043  t1 = q2;
5044  s2 = q1;
5045  t2 = q2;
5046  s3 = q1;
5047  t3 = q2+1;
5048  s4 = q1+1;
5049  t4 = q2+1;
5050  if (fShading==kShaded) {
5051  sr1 = s1;
5052  tr1 = (Int_t)TMath::Max(t1-1,0);
5053  sr2 = s2;
5054  tr2 = (Int_t)TMath::Max(t2-1,0);
5055  sr3 = (Int_t)TMath::Max(s2-1,0);
5056  tr3 = t2;
5057  sr4 = (Int_t)TMath::Max(s3-1,0);
5058  tr4 = t3;
5059  sr5 = s3;
5060  tr5 = t3+1;
5061  sr6 = s4;
5062  tr6 = t4+1;
5063  sr7 = s4+1;
5064  tr7 = t4;
5065  sr8 = s1+1;
5066  tr8 = t1;
5067  }
5068  if (turni==1) {
5069  i1 = s1;
5070  i2 = s2;
5071  i3 = s3;
5072  i4 = s4;
5073  } else {
5074  i1 = (Int_t)TMath::Max(w1-s1,0);
5075  i2 = (Int_t)TMath::Max(w1-s2,0);
5076  i3 = (Int_t)TMath::Max(w1-s3,0);
5077  i4 = (Int_t)TMath::Max(w1-s4,0);
5078  if (fShading==kShaded) {
5079  sr1 = (Int_t)TMath::Max(w1-sr1,0);
5080  sr2 = (Int_t)TMath::Max(w1-sr2,0);
5081  sr3 = (Int_t)TMath::Max(w1-sr3,0);
5082  sr4 = (Int_t)TMath::Max(w1-sr4,0);
5083  sr5 = (Int_t)TMath::Max(w1-sr5,0);
5084  sr6 = (Int_t)TMath::Max(w1-sr6,0);
5085  sr7 = (Int_t)TMath::Max(w1-sr7,0);
5086  sr8 = (Int_t)TMath::Max(w1-sr8,0);
5087  }
5088  }
5089  if (turnj==1) {
5090  j1 = t1;
5091  j2 = t2;
5092  j3 = t3;
5093  j4 = t4;
5094  } else {
5095  j1 = (Int_t)TMath::Max(w2-t1,0);
5096  j2 = (Int_t)TMath::Max(w2-t2,0);
5097  j3 = (Int_t)TMath::Max(w2-t3,0);
5098  j4 = (Int_t)TMath::Max(w2-t4,0);
5099  if (fShading==kShaded) {
5100  tr1 = (Int_t)TMath::Max(w2-tr1,0);
5101  tr2 = (Int_t)TMath::Max(w2-tr2,0);
5102  tr3 = (Int_t)TMath::Max(w2-tr3,0);
5103  tr4 = (Int_t)TMath::Max(w2-tr4,0);
5104  tr5 = (Int_t)TMath::Max(w2-tr5,0);
5105  tr6 = (Int_t)TMath::Max(w2-tr6,0);
5106  tr7 = (Int_t)TMath::Max(w2-tr7,0);
5107  tr8 = (Int_t)TMath::Max(w2-tr8,0);
5108  }
5109  }
5110  Transform(i1,j1,0);
5111  x1 = fXt;
5112  y1 = fYt;
5113  dx1 = fDxspline;
5114  dy1 = fDyspline;
5115  z1 = fZ;
5116  Transform(i2,j2,0);
5117  x2 = fXt;
5118  y2 = fYt;
5119  dx2 = fDxspline;
5120  dy2 = fDyspline;
5121  z2 = fZ;
5122  Transform(i3,j3,0);
5123  x3 = fXt;
5124  y3 = fYt;
5125  dx3 = fDxspline;
5126  dy3 = fDyspline;
5127  z3 = fZ;
5128  Transform(i4,j4,0);
5129  x4 = fXt;
5130  y4 = fYt;
5131  dx4 = fDxspline;
5132  dy4 = fDyspline;
5133  z4 = fZ;
5134  Envelope(x1,y1,x2,y2);
5135  Envelope(x2,y2,x3,y3);
5136  xtaz = (dx1+dx2+dx4)/3;
5137  ytaz = (dy1+dy2+dy4)/3;
5138  ztaz = (z1+z2+z4)/3;
5139  v = ColorCalculation(dx1,dy1,z1,dx2,dy2,z2,dx4,dy4,z4);
5140  if (fShading==kShaded) {
5141  if (fShadow==kShadowsNotPainted) {
5142  if (sr1<0||sr1>w1||tr1<0||tr1>w2) Transform(sr1,tr1,-1);
5143  else Transform(sr1,tr1,0);
5144  dxr1 = fDxspline;
5145  dyr1 = fDyspline;
5146  zr1 = fZ;
5147  if (sr8<0||sr8>w1||tr8<0||tr8>w2) Transform(sr8,tr8,-1);
5148  else Transform(sr8,tr8,0);
5149  dxr2 = fDxspline;
5150  dyr2 = fDyspline;
5151  zr2 = fZ;
5152  v = v+ColorCalculation(dxr1,dyr1,zr1,dx2,dy2,z2,dx1,dy1,z1);
5153  v = v+ColorCalculation(dxr1,dyr1,zr1,dx1,dy1,z1,dxr2,dyr2,zr2);
5154  v = v+ColorCalculation(dxr2,dyr2,zr2,dx1,dy1,z1,dx4,dy4,z4);
5155  v1 = v/4;
5156  if (sr3<0||sr3>w1||tr3<0||tr3>w2) Transform(sr3,tr3,-1);
5157  else Transform(sr3,tr3,0);
5158  dxr1 = fDxspline;
5159  dyr1 = fDyspline;
5160  zr1 = fZ;
5161  if (sr2<0||sr2>w1||tr2<0||tr2>w2) Transform(sr2,tr2,-1);
5162  else Transform(sr2,tr2,0);
5163  dxr2 = fDxspline;
5164  dyr2 = fDyspline;
5165  zr2 = fZ;
5166  v = ColorCalculation(dx1,dy1,z1,dx2,dy2,z2,dx3,dy3,z3);
5167  v = v+ColorCalculation(dx2,dy2,z2,dxr1,dyr1,zr1,dx3,dy3,z3);
5168  v = v+ColorCalculation(dx2,dy2,z2,dxr2,dyr2,zr2,dxr1,dyr1,zr1);
5169  v = v+ColorCalculation(dxr2,dyr2,zr2,dx2,dy2,z2,dx1,dy1,z1);
5170  v2 = v/4;
5171  if (sr5<0||sr5>w1||tr5<0||tr5>w2) Transform(sr5,tr5,-1);
5172  else Transform(sr5,tr5,0);
5173  dxr1 = fDxspline;
5174  dyr1 = fDyspline;
5175  zr1 = fZ;
5176  if (sr4<0||sr4>w1||tr4<0||tr4>w2) Transform(sr4,tr4,-1);
5177  else Transform(sr4,tr4,0);
5178  dxr2 = fDxspline;
5179  dyr2 = fDyspline;
5180  zr2 = fZ;
5181  v = ColorCalculation(dx2,dy2,z2,dx3,dy3,z3,dx4,dy4,z4);
5182  v = v+ColorCalculation(dx4,dy4,z4,dx3,dy3,z3,dxr1,dyr1,zr1);
5183  v = v+ColorCalculation(dx3,dy3,z3,dxr2,dyr2,zr2,dxr1,dyr1,zr1);
5184  v = v+ColorCalculation(dx2,dy2,z2,dxr2,dyr2,zr2,dx3,dy3,z3);
5185  v3 = v/4;
5186  if (sr7<0||sr7>w1||tr7<0||tr7>w2) Transform(sr7,tr7,-1);
5187  else Transform(sr7,tr7,0);
5188  dxr1 = fDxspline;
5189  dyr1 = fDyspline;
5190  zr1 = fZ;
5191  if (sr6<0||sr6>w1||tr6<0||tr6>w2) Transform(sr6,tr6,-1);
5192  else Transform(sr6,tr6,0);
5193  dxr2 = fDxspline;
5194  dyr2 = fDyspline;
5195  zr2 = fZ;
5196  v = ColorCalculation(dx1,dy1,z1,dx3,dy3,z3,dx4,dy4,z4);
5197  v = v+ColorCalculation(dx4,dy4,z4,dx3,dy3,z3,dxr2,dyr2,zr2);
5198  v = v+ColorCalculation(dx4,dy4,z4,dxr2,dyr2,zr2,dxr1,dyr1,zr1);
5199  v = v+ColorCalculation(dx1,dy1,z1,dx4,dy4,z4,dxr1,dyr1,zr1);
5200  v4 = v/4;
5201  } else {
5202  spriz = ShadowColorCalculation(xtaz,ytaz,ztaz,shad_noise);
5203  v = v+spriz;
5204  v = v/2;
5205  if (sr1<0||sr1>w1||tr1<0||tr1>w2) Transform(sr1,tr1,-1);
5206  else Transform(sr1,tr1,0);
5207  dxr1 = fDxspline;
5208  dyr1 = fDyspline;
5209  zr1 = fZ;
5210  if (sr8<0||sr8>w1||tr8<0||tr8>w2) Transform(sr8,tr8,-1);
5211  else Transform(sr8,tr8,0);
5212  dxr2 = fDxspline;
5213  dyr2 = fDyspline;
5214  zr2 = fZ;
5215  da = (dxr1+dx2+dx1)/3;
5216  db = (dyr1+dy2+dy1)/3;
5217  dc = (zr1+z2+z1)/3;
5218  spriz = ShadowColorCalculation(da,db,dc,shad_noise);
5219  v = v+(ColorCalculation(dxr1,dyr1,zr1,dx2,dy2,z2,dx1,dy1,z1)+spriz)/2;
5220  da = (dxr1+dxr2+dx1)/3;
5221  db = (dyr1+dyr2+dy1)/3;
5222  dc = (zr1+zr2+z1)/3;
5223  spriz = ShadowColorCalculation(da,db,dc,shad_noise);
5224  v = v+(ColorCalculation(dxr1,dyr1,zr1,dx1,dy1,z1,dxr2,dyr2,zr2)+spriz)/2;
5225  da = (dxr2+dx1+dx4)/3;
5226  db = (dyr2+dy1+dy4)/3;
5227  dc = (zr2+z1+z4)/3;
5228  spriz = ShadowColorCalculation(da,db,dc,shad_noise);
5229  v = v+(ColorCalculation(dxr2,dyr2,zr2,dx1,dy1,z1,dx4,dy4,z4)+spriz)/2;
5230  v1 = v/4;
5231  if (sr3<0||sr3>w1||tr3<0||tr3>w2) Transform(sr3,tr3,-1);
5232  else Transform(sr3,tr3,0);
5233  dxr1 = fDxspline;
5234  dyr1 = fDyspline;
5235  zr1 = fZ;
5236  if (sr2<0||sr2>w1||tr2<0||tr2>w2) Transform(sr2,tr2,-1);
5237  else Transform(sr2,tr2,0);
5238  dxr2 = fDxspline;
5239  dyr2 = fDyspline;
5240  zr2 = fZ;
5241  da = (dx1+dx2+dx3)/3;
5242  db = (dy1+dy2+dy3)/3;
5243  dc = (z1+z2+z3)/3;
5244  spriz = ShadowColorCalculation(da,db,dc,shad_noise);
5245  v = (ColorCalculation(dx1,dy1,z1,dx2,dy2,z2,dx3,dy3,z3)+spriz)/2;
5246  da = (dx2+dxr1+dx3)/3;
5247  db = (dy2+dyr1+dy3)/3;
5248  dc = (z2+zr1+z3)/3;
5249  spriz = ShadowColorCalculation(da,db,dc,shad_noise);
5250  v = v+(ColorCalculation(dx2,dy2,z2,dxr1,dyr1,zr1,dx3,dy3,z3)+spriz)/2;
5251  da = (dx2+dxr2+dxr1)/3;
5252  db = (dy2+dyr2+dyr1)/3;
5253  dc = (z2+zr2+zr1)/3;
5254  spriz = ShadowColorCalculation(da,db,dc,shad_noise);
5255  v = v+(ColorCalculation(dx2,dy2,z2,dxr2,dyr2,zr2,dxr1,dyr1,zr1)+spriz)/2;
5256  da = (dxr2+dx2+dx1)/3;
5257  db = (dyr2+dy2+dy1)/3;
5258  dc = (zr2+z2+z1)/3;
5259  spriz = ShadowColorCalculation(da,db,dc,shad_noise);
5260  v = v+(ColorCalculation(dxr2,dyr2,zr2,dx2,dy2,z2,dx1,dy1,z1)+spriz)/2;
5261  v2 = v/4;
5262  if (sr5<0||sr5>w1||tr5<0||tr5>w2) Transform(sr5,tr5,-1);
5263  else Transform(sr5,tr5,0);
5264  dxr1 = fDxspline;
5265  dyr1 = fDyspline;
5266  zr1 = fZ;
5267  if (sr4<0||sr4>w1||tr4<0||tr4>w2) Transform(sr4,tr4,-1);
5268  else Transform(sr4,tr4,0);
5269  dxr2 = fDxspline;
5270  dyr2 = fDyspline;
5271  zr2 = fZ;
5272  da = (dx2+dx3+dx4)/3;
5273  db = (dy2+dy3+dy4)/3;
5274  dc = (z2+z3+z4)/3;
5275  spriz = ShadowColorCalculation(da,db,dc,shad_noise);
5276  v = (ColorCalculation(dx2,dy2,z2,dx3,dy3,z3,dx4,dy4,z4)+spriz)/2;
5277  da = (dx4+dx3+dxr1)/3;
5278  db = (dy4+dy3+dyr1)/3;
5279  dc = (z4+z3+zr1)/3;
5280  spriz = ShadowColorCalculation(da,db,dc,shad_noise);
5281  v = v+(ColorCalculation(dx4,dy4,z4,dx3,dy3,z3,dxr1,dyr1,zr1)+spriz)/2;
5282  da = (dx3+dxr2+dxr1)/3;
5283  db = (dy3+dyr2+dyr1)/3;
5284  dc = (z3+zr2+zr1)/3;
5285  spriz = ShadowColorCalculation(da,db,dc,shad_noise);
5286  v = v+(ColorCalculation(dx3,dy3,z3,dxr2,dyr2,zr2,dxr1,dyr1,zr1)+spriz)/2;
5287  da = (dx2+dxr2+dx3)/3;
5288  db = (dy2+dyr2+dy3)/3;
5289  dc = (z2+zr2+z3)/3;
5290  spriz = ShadowColorCalculation(da,db,dc,shad_noise);
5291  v = v+(ColorCalculation(dx2,dy2,z2,dxr2,dyr2,zr2,dx3,dy3,z3)+spriz)/2;
5292  v3 = v/4;
5293  if (sr7<0||sr7>w1||tr7<0||tr7>w2) Transform(sr7,tr7,-1);
5294  else Transform(sr7,tr7,0);
5295  dxr1 = fDxspline;
5296  dyr1 = fDyspline;
5297  zr1 = fZ;
5298  if (sr6<0||sr6>w1||tr6<0||tr6>w2) Transform(sr6,tr6,-1);
5299  else Transform(sr6,tr6,0);
5300  dxr2 = fDxspline;
5301  dyr2 = fDyspline;
5302  zr2 = fZ;
5303  da = (dx1+dx3+dx4)/3;
5304  db = (dy1+dy3+dy4)/3;
5305  dc = (z1+z3+z4)/3;
5306  spriz = ShadowColorCalculation(da,db,dc,shad_noise);
5307  v = (ColorCalculation(dx1,dy1,z1,dx3,dy3,z3,dx4,dy4,z4)+spriz)/2;
5308  da = (dx4+dx3+dxr2)/3;
5309  db = (dy4+dy3+dyr2)/3;
5310  dc = (z4+z3+zr2)/3;
5311  spriz = ShadowColorCalculation(da,db,dc,shad_noise);
5312  v = v+(ColorCalculation(dx4,dy4,z4,dx3,dy3,z3,dxr2,dyr2,zr2)+spriz)/2;
5313  da = (dx4+dxr2+dxr1)/3;
5314  db = (dy4+dyr2+dyr1)/3;
5315  dc = (z4+zr2+zr1)/3;
5316  spriz = ShadowColorCalculation(da,db,dc,shad_noise);
5317  v = v+(ColorCalculation(dx4,dy4,z4,dxr2,dyr2,zr2,dxr1,dyr1,zr1)+spriz)/2;
5318  da = (dx1+dx4+dxr1)/3;
5319  db = (dy1+dy4+dyr1)/3;
5320  dc = (z1+z4+zr1)/3;
5321  spriz = ShadowColorCalculation(da,db,dc,shad_noise);
5322  v = v+(ColorCalculation(dx1,dy1,z1,dx4,dy4,z4,dxr1,dyr1,zr1)+spriz)/2;
5323  v4 = v/4;
5324  }
5325  }
5326  spriz = 0;
5327  if (fShadow==kShadowsNotPainted) {
5328  if (fShading==kNotShaded) {
5329  v = v*fLevels+0.5;
5330  iv = fLevels-(Int_t)v;
5331  } else {
5332  v1 = v1*fLevels+0.5;
5333  iv1 = fLevels-(Int_t)v1;
5334  v2 = v2*fLevels+0.5;
5335  iv2 = fLevels-(Int_t)v2;
5336  v4 = v4*fLevels+0.5;
5337  iv4 = fLevels-(Int_t)v4;
5338  }
5339  } else {
5340  spriz = ShadowColorCalculation(xtaz,ytaz,ztaz,shad_noise);
5341  if (fShading==kNotShaded) {
5342  v = v*fLevels/2.0;
5343  iv = fLevels-(Int_t)(v+0.5);
5344  } else {
5345  v1 = v1*fLevels;
5346  iv1 = fLevels-(Int_t)v1;
5347  v2 = v2*fLevels;
5348  iv2 = fLevels-(Int_t)v2;
5349  v4 = v4*fLevels;
5350  iv4 = fLevels-(Int_t)v4;
5351  }
5352  }
5353  if (fShading==kNotShaded) {
5354  ColorModel(iv,ui1,ui2,ui3);
5356  } else {
5357  dx1 = x1;
5358  dy1 = y1;
5359  dx2 = x2;
5360  dy2 = y2;
5361  dx3 = x4;
5362  dy3 = y4;
5363  z1 = iv1;
5364  z2 = iv2;
5365  z3 = iv4;
5366  da = (dy2-dy1)*(z3-z1)-(dy3-dy1)*(z2-z1);
5367  db = (z2-z1)*(dx3-dx1)-(z3-z1)*(dx2-dx1);
5368  dc = (dx2-dx1)*(dy3-dy1)-(dx3-dx1)*(dy2-dy1);
5369  dd = -da*dx1-db*dy1-dc*z1;
5370  }
5371  sx1 = x1;
5372  sy1 = y1;
5373  sx2 = x2;
5374  sy2 = y2;
5375  sx3 = x4;
5376  sy3 = y4;
5377  if (sx2<sx1) {
5378  sx4 = sx1;
5379  sy4 = sy1;
5380  sx1 = sx2;
5381  sy1 = sy2;
5382  sx2 = sx4;
5383  sy2 = sy4;
5384  }
5385  if (sx3<sx1) {
5386  sx4 = sx1;
5387  sy4 = sy1;
5388  sx1 = sx3;
5389  sy1 = sy3;
5390  sx3 = sx4;
5391  sy3 = sy4;
5392  }
5393  if (sy2<sy3) {
5394  sx4 = sx2;
5395  sy4 = sy2;
5396  sx2 = sx3;
5397  sy2 = sy3;
5398  sx3 = sx4;
5399  sy3 = sy4;
5400  }
5401  sdx1 = 0;
5402  sdx2 = 0;
5403  sdx3 = 0;
5404  pom1 = sy2-sy1;
5405  pom2 = sx2-sx1;
5406  if (pom2!=0) sdx1 = pom1/pom2;
5407  pom1 = sy1;
5408  pom2 = sx1;
5409  sdy1 = pom1-sdx1*pom2;
5410  pom1 = sy3-sy1;
5411  pom2 = sx3-sx1;
5412  if (pom2!=0) sdx2 = pom1/pom2;
5413  pom1 = sy1;
5414  pom2 = sx1;
5415  sdy2 = pom1-sdx2*pom2;
5416  pom1 = sy3-sy2;
5417  pom2 = sx3-sx2;
5418  if (pom2!=0) sdx3 = pom1/pom2;
5419  pom1 = sy2;
5420  pom2 = sx2;
5421  sdy3 = pom1-sdx3*pom2;
5422  if (sx2<sx3) {
5423  if (sx1!=sx2) {
5424  for (sx4=sx1;sx4<=sx2;sx4++) {
5425  pom1 = sx4;
5426  sdy4 = sdx1*pom1+sdy1;
5427  sy4 = (Int_t)sdy4;
5428  if (sx3!=sx1) {
5429  sdy4 = sdx2*pom1+sdy2;
5430  sy5 = (Int_t)sdy4;
5431  y5 = fEnvelope[sx4];
5432  if (sy4<sy5) {
5433  pom1 = sy4;
5434  sy4 = sy5;
5435  sy5 = (Int_t)pom1;
5436  }
5437  if ((sy4<=y5)||(sy5<y5)) {
5438  sy4 = (Int_t)TMath::Min(sy4,(Int_t)y5);
5439  sy5 = (Int_t)TMath::Min(sy5,(Int_t)y5);
5440  if (fShading==kNotShaded) {
5441  box->PaintBox(gPad->PixeltoX(sx4),gPad->PixeltoY(sy4)+1,gPad->PixeltoX(sx4+1),gPad->PixeltoY(sy5-1)+1);
5442  } else {
5443  for (il=sy5;il<=sy4+1;il++) {
5444  dx1 = sx4;
5445  if(il<=sy4) dy1 = il;
5446  else dy1 = sy4;
5447  if (dc!=0) v = (-dd-da*dx1-db*dy1)/dc;
5448  else v =(iv1+iv2+iv4)/3;
5449  iv = (Int_t)v;
5450  ColorModel(iv,ui1,ui2,ui3);
5452  box->PaintBox(gPad->PixeltoX(sx4),gPad->PixeltoY(il)+1,gPad->PixeltoX(sx4+1),gPad->PixeltoY(il-1)+1);
5453  }
5454  }
5455  }
5456  }
5457  }
5458  }
5459  if (sx2!=sx3) {
5460  for (sx4=sx2;sx4<=sx3;sx4++) {
5461  pom1 = sx4;
5462  sdy4 = sdx3*pom1+sdy3;
5463  sy4 = (Int_t)sdy4;
5464  if (sx3!=sx1) {
5465  sdy4 = sdx2*pom1+sdy2;
5466  sy5 = (Int_t)sdy4;
5467  y5 = fEnvelope[sx4];
5468  if (sy4<sy5) {
5469  pom1 = sy4;
5470  sy4 = sy5;
5471  sy5 = (Int_t)pom1;
5472  }
5473  if ((sy4<=y5)||(sy5<y5)) {
5474  sy4 = (Int_t)TMath::Min(sy4,(Int_t)y5);
5475  sy5 = (Int_t)TMath::Min(sy5,(Int_t)y5);
5476  if (fShading==kNotShaded) {
5477  box->PaintBox(gPad->PixeltoX(sx4),gPad->PixeltoY(sy4)+1,gPad->PixeltoX(sx4+1),gPad->PixeltoY(sy5-1)+1);
5478  } else {
5479  for (il=sy5;il<=sy4+1;il++) {
5480  dx1 = sx4;
5481  if(il<=sy4) dy1 = il;
5482  else dy1 = sy4;
5483  if (dc!=0) v = (-dd-da*dx1-db*dy1)/dc;
5484  else v =(iv1+iv2+iv4)/3;
5485  iv = (Int_t)v;
5486  ColorModel(iv,ui1,ui2,ui3);
5488  box->PaintBox(gPad->PixeltoX(sx4),gPad->PixeltoY(il)+1,gPad->PixeltoX(sx4+1),gPad->PixeltoY(il-1)+1);
5489  }
5490  }
5491  }
5492  }
5493  }
5494  }
5495  } else {
5496  if (sx3!=sx1) {
5497  for (sx4=sx1;sx4<=sx3;sx4++) {
5498  pom1 = sx4;
5499  sdy4 = sdx2*pom1+sdy2;
5500  sy4 = (Int_t)sdy4;
5501  if (sx2!=sx1) {
5502  sdy4 = sdx1*pom1+sdy1;
5503  sy5 = (Int_t)sdy4;
5504  y5 = fEnvelope[sx4];
5505  if (sy4<sy5) {
5506  pom1 = sy4;
5507  sy4 = sy5;
5508  sy5 = (Int_t)pom1;
5509  }
5510  if ((sy4<=y5)||(sy5<y5)) {
5511  sy4 = (Int_t)TMath::Min(sy4,(Int_t)y5);
5512  sy5 = (Int_t)TMath::Min(sy5,(Int_t)y5);
5513  if (fShading==kNotShaded) {
5514  box->PaintBox(gPad->PixeltoX(sx4),gPad->PixeltoY(sy4)+1,gPad->PixeltoX(sx4+1),gPad->PixeltoY(sy5-1)+1);
5515  } else {
5516  for (il=sy5;il<=sy4+1;il++) {
5517  dx1 = sx4;
5518  if(il<=sy4) dy1 = il;
5519  else dy1 = sy4;
5520  if (dc!=0) v = (-dd-da*dx1-db*dy1)/dc;
5521  else v =(iv1+iv2+iv4)/3;
5522  iv = (Int_t)v;
5523  ColorModel(iv,ui1,ui2,ui3);
5525  box->PaintBox(gPad->PixeltoX(sx4),gPad->PixeltoY(il)+1,gPad->PixeltoX(sx4+1),gPad->PixeltoY(il-1)+1);
5526  }
5527  }
5528  }
5529  }
5530  }
5531  }
5532  if (sx2!=sx3) {
5533  for (sx4=sx3;sx4<=sx2;sx4++) {
5534  pom1 = sx4;
5535  sdy4 = sdx3*pom1+sdy3;
5536  sy4 = (Int_t)sdy4;
5537  if (sx2!=sx1) {
5538  sdy4 = sdx1*pom1+sdy1;
5539  sy5 = (Int_t)sdy4;
5540  y5 = fEnvelope[sx4];
5541  if (sy4<sy5) {
5542  pom1 = sy4;
5543  sy4 = sy5;
5544  sy5 = (Int_t)pom1;
5545  }
5546  if ((sy4<=y5)||(sy5<y5)) {
5547  sy4 = (Int_t)TMath::Min(sy4,(Int_t)y5);
5548  sy5 = (Int_t)TMath::Min(sy5,(Int_t)y5);
5549  if (fShading==kNotShaded) {
5550  box->PaintBox(gPad->PixeltoX(sx4),gPad->PixeltoY(sy4)+1,gPad->PixeltoX(sx4+1),gPad->PixeltoY(sy5-1)+1);
5551  } else {
5552  for (il=sy5;il<=sy4+1;il++) {
5553  dx1 = sx4;
5554  if(il<=sy4) dy1 = il;
5555  else dy1 = sy4;
5556  if (dc!=0) v = (-dd-da*dx1-db*dy1)/dc;
5557  else v =(iv1+iv2+iv4)/3;
5558  iv = (Int_t)v;
5559  ColorModel(iv,ui1,ui2,ui3);
5561  box->PaintBox(gPad->PixeltoX(sx4),gPad->PixeltoY(il)+1,gPad->PixeltoX(sx4+1),gPad->PixeltoY(il-1)+1);
5562  }
5563  }
5564  }
5565  }
5566  }
5567  }
5568  }
5569  xtaz = (dx3+dx2+dx4)/3;
5570  ytaz = (dy3+dy2+dy4)/3;
5571  ztaz = (z3+z2+z4)/3;
5572  if (fShading==kNotShaded) v=ColorCalculation(dx2,dy2,z2,dx3,dy3,z3,dx4,dy4,z4);
5573  spriz = 0;
5574  if (fShadow==kShadowsNotPainted) {
5575  if (fShading==kNotShaded) {
5576  v = v*fLevels;
5577  iv = fLevels-(Int_t)v;
5578  } else {
5579  v3 = v3*fLevels;
5580  iv3 = fLevels-(Int_t)v3;
5581  }
5582  } else {
5583  spriz = ShadowColorCalculation(xtaz,ytaz,ztaz,shad_noise);
5584  if (fShading==kNotShaded) {
5585  v = v*fLevels/2;
5586  iv = fLevels-(Int_t)v;
5587  iv = (Int_t)(iv-fLevels*spriz/2);
5588  } else {
5589  v3 = v3*fLevels;
5590  iv3 = fLevels-(Int_t)v3;
5591  }
5592  }
5593  if (fShading==kNotShaded) {
5594  ColorModel(iv,ui1,ui2,ui3);
5596  } else {
5597  dx1 = x2;
5598  dy1 = y2;
5599  dx2 = x3;
5600  dy2 = y3;
5601  dx3 = x4;
5602  dy3 = y4;
5603  z1 = iv2;
5604  z2 = iv3;
5605  z3 = iv4;
5606  da = (dy2-dy1)*(z3-z1)-(dy3-dy1)*(z2-z1);
5607  db = (z2-z1)*(dx3-dx1)-(z3-z1)*(dx2-dx1);
5608  dc = (dx2-dx1)*(dy3-dy1)-(dx3-dx1)*(dy2-dy1);
5609  dd = -da*dx1-db*dy1-dc*z1;
5610  }
5611  sx1 = x2;
5612  sy1 = y2;
5613  sx2 = x3;
5614  sy2 = y3;
5615  sx3 = x4;
5616  sy3 = y4;
5617  if (sx2<sx1) {
5618  sx4 = sx1;
5619  sy4 = sy1;
5620  sx1 = sx2;
5621  sy1 = sy2;
5622  sx2 = sx4;
5623  sy2 = sy4;
5624  }
5625  if (sx3<sx1) {
5626  sx4 = sx1;
5627  sy4 = sy1;
5628  sx1 = sx3;
5629  sy1 = sy3;
5630  sx3 = sx4;
5631  sy3 = sy4;
5632  }
5633  if (sy2<sy3) {
5634  sx4 = sx2;
5635  sy4 = sy2;
5636  sx2 = sx3;
5637  sy2 = sy3;
5638  sx3 = sx4;
5639  sy3 = sy4;
5640  }
5641  pom1 = sy2-sy1;
5642  pom2 = sx2-sx1;
5643  sdx1 = 0;
5644  sdx2 = 0;
5645  sdx3 = 0;
5646  if (pom2!=0) sdx1 = pom1/pom2;
5647  pom1 = sy1;
5648  pom2 = sx1;
5649  sdy1 = pom1-sdx1*pom2;
5650  pom1 = sy3-sy1;
5651  pom2 = sx3-sx1;
5652  if (pom2!=0) sdx2 = pom1/pom2;
5653  pom1 = sy1;
5654  pom2 = sx1;
5655  sdy2 = pom1-sdx2*pom2;
5656  pom1 = sy3-sy2;
5657  pom2 = sx3-sx2;
5658  if (pom2!=0) sdx3 = pom1/pom2;
5659  pom1 = sy2;
5660  pom2 = sx2;
5661  sdy3 = pom1-sdx3*pom2;
5662  if (sx2<sx3) {
5663  if (sx1!=sx2) {
5664  for (sx4=sx1;sx4<=sx2;sx4++) {
5665  pom1 = sx4;
5666  sdy4 = sdx1*pom1+sdy1;
5667  sy4 = (Int_t)sdy4;
5668  if (sx3!=sx1) {
5669  sdy4 = sdx2*pom1+sdy2;
5670  sy5 = (Int_t)sdy4;
5671  y5 = fEnvelope[sx4];
5672  if (sy4<sy5) {
5673  pom1 = sy4;
5674  sy4 = sy5;
5675  sy5 = (Int_t)pom1;
5676  }
5677  if ((sy4<=y5)||(sy5<y5)) {
5678  sy4 = (Int_t)TMath::Min(sy4,(Int_t)y5);
5679  sy5 = (Int_t)TMath::Min(sy5,(Int_t)y5);
5680  if (fShading==kNotShaded) {
5681  box->PaintBox(gPad->PixeltoX(sx4),gPad->PixeltoY(sy4)+1,gPad->PixeltoX(sx4+1),gPad->PixeltoY(sy5-1)+1);
5682  } else {
5683  for (il=sy5;il<=sy4+1;il++) {
5684  dx1 = sx4;
5685  if(il<=sy4) dy1 = il;
5686  else dy1 = sy4;
5687  if (dc!=0) v = (-dd-da*dx1-db*dy1)/dc;
5688  else v =(iv2+iv3+iv4)/3;
5689  iv = (Int_t)v;
5690  ColorModel(iv,ui1,ui2,ui3);
5692  box->PaintBox(gPad->PixeltoX(sx4),gPad->PixeltoY(il)+1,gPad->PixeltoX(sx4+1),gPad->PixeltoY(il-1)+1);
5693  }
5694  }
5695  }
5696  }
5697  }
5698  }
5699  if (sx2!=sx3) {
5700  for (sx4=sx2;sx4<=sx3;sx4++) {
5701  pom1 = sx4;
5702  sdy4 = sdx3*pom1+sdy3;
5703  sy4 = (Int_t)sdy4;
5704  if (sx3!=sx1) {
5705  sdy4 = sdx2*pom1+sdy2;
5706  sy5 = (Int_t)sdy4;
5707  y5 = fEnvelope[sx4];
5708  if (sy4<sy5) {
5709  pom1 = sy4;
5710  sy4 = sy5;
5711  sy5 = (Int_t)pom1;
5712  }
5713  if ((sy4<=y5)||(sy5<y5)) {
5714  sy4 = (Int_t)TMath::Min(sy4,(Int_t)y5);
5715  sy5 = (Int_t)TMath::Min(sy5,(Int_t)y5);
5716  if (fShading==kNotShaded) {
5717  box->PaintBox(gPad->PixeltoX(sx4),gPad->PixeltoY(sy4)+1,gPad->PixeltoX(sx4+1),gPad->PixeltoY(sy5-1)+1);
5718  } else {
5719  for (il=sy5;il<=sy4+1;il++) {
5720  dx1 = sx4;
5721  if(il<=sy4) dy1 = il;
5722  else dy1 = sy4;
5723  if (dc!=0) v = (-dd-da*dx1-db*dy1)/dc;
5724  else v =(iv2+iv3+iv4)/3;
5725  iv = (Int_t)v;
5726  ColorModel(iv,ui1,ui2,ui3);
5728  box->PaintBox(gPad->PixeltoX(sx4),gPad->PixeltoY(il)+1,gPad->PixeltoX(sx4+1),gPad->PixeltoY(il-1)+1);
5729  }
5730  }
5731  }
5732  }
5733  }
5734  }
5735  } else {
5736  if (sx3!=sx1) {
5737  for (sx4=sx1;sx4<=sx3;sx4++) {
5738  pom1 = sx4;
5739  sdy4 = sdx2*pom1+sdy2;
5740  sy4 = (Int_t)sdy4;
5741  if (sx2!=sx1) {
5742  sdy4 = sdx1*pom1+sdy1;
5743  sy5 = (Int_t)sdy4;
5744  y5 = fEnvelope[sx4];
5745  if (sy4<sy5) {
5746  pom1 = sy4;
5747  sy4 = sy5;
5748  sy5 = (Int_t)pom1;
5749  }
5750  if ((sy4<=y5)||(sy5<y5)) {
5751  sy4 = (Int_t)TMath::Min(sy4,(Int_t)y5);
5752  sy5 = (Int_t)TMath::Min(sy5,(Int_t)y5);
5753  if (fShading==kNotShaded) {
5754  box->PaintBox(gPad->PixeltoX(sx4),gPad->PixeltoY(sy4)+1,gPad->PixeltoX(sx4+1),gPad->PixeltoY(sy5-1)+1);
5755  } else {
5756  for (il=sy5;il<=sy4+1;il++) {
5757  dx1 = sx4;
5758  if(il<=sy4) dy1 = il;
5759  else dy1 = sy4;
5760  if (dc!=0) v = (-dd-da*dx1-db*dy1)/dc;
5761  else v =(iv2+iv3+iv4)/3;
5762  iv = (Int_t)v;
5763  ColorModel(iv,ui1,ui2,ui3);
5765  box->PaintBox(gPad->PixeltoX(sx4),gPad->PixeltoY(il)+1,gPad->PixeltoX(sx4+1),gPad->PixeltoY(il-1)+1);
5766  }
5767  }
5768  }
5769  }
5770  }
5771  }
5772  if (sx2!=sx3) {
5773  for (sx4=sx3;sx4<=sx2;sx4++) {
5774  pom1 = sx4;
5775  sdy4 = sdx3*pom1+sdy3;
5776  sy4 = (Int_t)sdy4;
5777  if (sx2!=sx1) {
5778  sdy4 = sdx1*pom1+sdy1;
5779  sy5 = (Int_t)sdy4;
5780  y5 = fEnvelope[sx4];
5781  if (sy4<sy5) {
5782  pom1 = sy4;
5783  sy4 = sy5;
5784  sy5 = (Int_t)pom1;
5785  }
5786  if ((sy4<=y5)||(sy5<y5)) {
5787  sy4 = (Int_t)TMath::Min(sy4,(Int_t)y5);
5788  sy5 = (Int_t)TMath::Min(sy5,(Int_t)y5);
5789  if (fShading==kNotShaded) {
5790  box->PaintBox(gPad->PixeltoX(sx4),gPad->PixeltoY(sy4)+1,gPad->PixeltoX(sx4+1),gPad->PixeltoY(sy5-1)+1);
5791  } else {
5792  for (il=sy5;il<=sy4+1;il++) {
5793  dx1 = sx4;
5794  if(il<=sy4) dy1 = il;
5795  else dy1 = sy4;
5796  if (dc!=0) v = (-dd-da*dx1-db*dy1)/dc;
5797  else v =(iv2+iv3+iv4)/3;
5798  iv = (Int_t)v;
5799  ColorModel(iv,ui1,ui2,ui3);
5801  box->PaintBox(gPad->PixeltoX(sx4),gPad->PixeltoY(il)+1,gPad->PixeltoX(sx4+1),gPad->PixeltoY(il-1)+1);
5802  }
5803  }
5804  }
5805  }
5806  }
5807  }
5808  }
5809  }
5810  break;
5811  case kDisplayModeTriangles:
5813  if ((q1!=q2||smer!=0)&&flag==1) {
5814  s1 = q1+1;
5815  t1 = q2;
5816  s2 = q1;
5817  t2 = q2;
5818  s3 = q1;
5819  t3 = q2+1;
5820  s4 = q1+1;
5821  t4 = q2+1;
5822  }
5823  if (turni==1) {
5824  i1 = (Int_t)TMath::Min(w1,s1);
5825  i2 = (Int_t)TMath::Min(w1,s2);
5826  i3 = (Int_t)TMath::Min(w1,s3);
5827  i4 = (Int_t)TMath::Min(w1,s4);
5828  } else {
5829  i1 = (Int_t)TMath::Max(w1-s1,0);
5830  i2 = (Int_t)TMath::Max(w1-s2,0);
5831  i3 = (Int_t)TMath::Max(w1-s3,0);
5832  i4 = (Int_t)TMath::Max(w1-s4,0);
5833  }
5834  if (turnj==1) {
5835  j1 = (Int_t)TMath::Min(w2,t1);
5836  j2 = (Int_t)TMath::Min(w2,t2);
5837  j3 = (Int_t)TMath::Min(w2,t3);
5838  j4 = (Int_t)TMath::Min(w2,t4);
5839  } else {
5840  j1 = (Int_t)TMath::Max(w2-t1,0);
5841  j2 = (Int_t)TMath::Max(w2-t2,0);
5842  j3 = (Int_t)TMath::Max(w2-t3,0);
5843  j4 = (Int_t)TMath::Max(w2-t4,0);
5844  }
5845  Transform(i1,j1,0);
5846  x1 = fXt;
5847  y1 = fYt;
5848  Transform(i2,j2,0);
5849  x2 = fXt;
5850  y2 = fYt;
5851  Transform(i3,j3,0);
5852  x3 = fXt;
5853  y3 = fYt;
5854  Transform(i4,j4,0);
5855  x4 = fXt;
5856  y4 = fYt;
5857  if ((q1!=q2||smer!=0)&&flag==1) {
5858  Envelope(x1,y1,x2,y2);
5859  if (fLine!=0) {
5860  if (fLine==1) {
5861  fXe = x2;
5862  fYe = y2;
5863  }
5864  line->PaintLine(gPad->PixeltoX(fXs),gPad->PixeltoY(fYs)+1,gPad->PixeltoX(fXe),gPad->PixeltoY(fYe)+1);
5865  }
5866  Envelope(x2,y2,x3,y3);
5867  if (fLine!=0) {
5868  if (fLine==1) {
5869  fXe = x3;
5870  fYe = y3;
5871  }
5872  line->PaintLine(gPad->PixeltoX(fXs),gPad->PixeltoY(fYs)+1,gPad->PixeltoX(fXe),gPad->PixeltoY(fYe)+1);
5873  }
5874  Envelope(x2,y2,x4,y4);
5875  if (fLine!=0) {
5876  if (fLine==1) {
5877  fXe = x4;
5878  fYe = y4;
5879  }
5880  line->PaintLine(gPad->PixeltoX(fXs),gPad->PixeltoY(fYs)+1,gPad->PixeltoX(fXe),gPad->PixeltoY(fYe)+1);
5881  }
5882  Envelope(x1,y1,x4,y4);
5883  if (fLine!=0) {
5884  if (fLine==1) {
5885  fXe = x4;
5886  fYe = y4;
5887  }
5888  line->PaintLine(gPad->PixeltoX(fXs),gPad->PixeltoY(fYs)+1,gPad->PixeltoX(fXe),gPad->PixeltoY(fYe)+1);
5889  }
5890  Envelope(x3,y3,x4,y4);
5891  if (fLine!=0) {
5892  if (fLine==1) {
5893  fXe = x4;
5894  fYe = y4;
5895  }
5896  line->PaintLine(gPad->PixeltoX(fXs),gPad->PixeltoY(fYs)+1,gPad->PixeltoX(fXe),gPad->PixeltoY(fYe)+1);
5897  }
5898  }
5899  } else {
5900  if ((q1!=q2||smer!=0)&&flag==1) {
5901  s1 = q1+1;
5902  t1 = q2;
5903  s2 = q1;
5904  t2 = q2;
5905  s3 = q1;
5906  t3 = q2+1;
5907  s4 = q1+1;
5908  t4 = q2+1;
5909  if (fShading==kShaded) {
5910  sr1 = s1;
5911  tr1 = (Int_t)TMath::Max(t1-1,0);
5912  sr2 = s2;
5913  tr2 = (Int_t)TMath::Max(t2-1,0);
5914  sr3 = (Int_t)TMath::Max(s2-1,0);
5915  tr3 = t2;
5916  sr4 = (Int_t)TMath::Max(s3-1,0);
5917  tr4 = t3;
5918  sr5 = s3;
5919  tr5 = t3+1;
5920  sr6 = s4;
5921  tr6 = t4+1;
5922  sr7 = s4+1;
5923  tr7 = t4;
5924  sr8 = s1+1;
5925  tr8 = t1;
5926  }
5927  if (turni==1) {
5928  i1 = s1;
5929  i2 = s2;
5930  i3 = s3;
5931  i4 = s4;
5932  } else {
5933  i1 = (Int_t)TMath::Max(w1-s1,0);
5934  i2 = (Int_t)TMath::Max(w1-s2,0);
5935  i3 = (Int_t)TMath::Max(w1-s3,0);
5936  i4 = (Int_t)TMath::Max(w1-s4,0);
5937  if (fShading==kShaded) {
5938  sr1 = (Int_t)TMath::Max(w1-sr1,0);
5939  sr2 = (Int_t)TMath::Max(w1-sr2,0);
5940  sr3 = (Int_t)TMath::Max(w1-sr3,0);
5941  sr4 = (Int_t)TMath::Max(w1-sr4,0);
5942  sr5 = (Int_t)TMath::Max(w1-sr5,0);
5943  sr6 = (Int_t)TMath::Max(w1-sr6,0);
5944  sr7 = (Int_t)TMath::Max(w1-sr7,0);
5945  sr8 = (Int_t)TMath::Max(w1-sr8,0);
5946  }
5947  }
5948  if (turnj==1) {
5949  j1 = t1;
5950  j2 = t2;
5951  j3 = t3;
5952  j4 = t4;
5953  } else {
5954  j1 = (Int_t)TMath::Max(w2-t1,0);
5955  j2 = (Int_t)TMath::Max(w2-t2,0);
5956  j3 = (Int_t)TMath::Max(w2-t3,0);
5957  j4 = (Int_t)TMath::Max(w2-t4,0);
5958  if (fShading==kShaded) {
5959  tr1 = (Int_t)TMath::Max(w2-tr1,0);
5960  tr2 = (Int_t)TMath::Max(w2-tr2,0);
5961  tr3 = (Int_t)TMath::Max(w2-tr3,0);
5962  tr4 = (Int_t)TMath::Max(w2-tr4,0);
5963  tr5 = (Int_t)TMath::Max(w2-tr5,0);
5964  tr6 = (Int_t)TMath::Max(w2-tr6,0);
5965  tr7 = (Int_t)TMath::Max(w2-tr7,0);
5966  tr8 = (Int_t)TMath::Max(w2-tr8,0);
5967  }
5968  }
5969  Transform(i1,j1,0);
5970  x1 = fXt;
5971  y1 = fYt;
5972  dx1 = fDxspline;
5973  dy1 = fDyspline;
5974  z1 = fZ;
5975  Transform(i2,j2,0);
5976  x2 = fXt;
5977  y2 = fYt;
5978  dx2 = fDxspline;
5979  dy2 = fDyspline;
5980  z2 = fZ;
5981  Transform(i3,j3,0);
5982  x3 = fXt;
5983  y3 = fYt;
5984  dx3 = fDxspline;
5985  dy3 = fDyspline;
5986  z3 = fZ;
5987  Transform(i4,j4,0);
5988  x4 = fXt;
5989  y4 = fYt;
5990  dx4 = fDxspline;
5991  dy4 = fDyspline;
5992  z4 = fZ;
5993  Envelope(x1,y1,x2,y2);
5994  Envelope(x2,y2,x3,y3);
5995  xtaz = (dx1+dx2+dx4)/3;
5996  ytaz = (dy1+dy2+dy4)/3;
5997  ztaz = (z1+z2+z4)/3;
5998  v = ColorCalculation(dx1,dy1,z1,dx2,dy2,z2,dx4,dy4,z4);
5999  if (fShading==kShaded) {
6000  if (fShadow==kShadowsNotPainted) {
6001  if (sr1<0||sr1>w1||tr1<0||tr1>w2) Transform(sr1,tr1,-1);
6002  else Transform(sr1,tr1,0);
6003  dxr1 = fDxspline;
6004  dyr1 = fDyspline;
6005  zr1 = fZ;
6006  if (sr8<0||sr8>w1||tr8<0||tr8>w2) Transform(sr8,tr8,-1);
6007  else Transform(sr8,tr8,0);
6008  dxr2 = fDxspline;
6009  dyr2 = fDyspline;
6010  zr2 = fZ;
6011  v = v+ColorCalculation(dxr1,dyr1,zr1,dx2,dy2,z2,dx1,dy1,z1);
6012  v = v+ColorCalculation(dxr1,dyr1,zr1,dx1,dy1,z1,dxr2,dyr2,zr2);
6013  v = v+ColorCalculation(dxr2,dyr2,zr2,dx1,dy1,z1,dx4,dy4,z4);
6014  v1 = v/4;
6015  if (sr3<0||sr3>w1||tr3<0||tr3>w2) Transform(sr3,tr3,-1);
6016  else Transform(sr3,tr3,0);
6017  dxr1 = fDxspline;
6018  dyr1 = fDyspline;
6019  zr1 = fZ;
6020  if (sr2<0||sr2>w1||tr2<0||tr2>w2) Transform(sr2,tr2,-1);
6021  else Transform(sr2,tr2,0);
6022  dxr2 = fDxspline;
6023  dyr2 = fDyspline;
6024  zr2 = fZ;
6025  v = ColorCalculation(dx1,dy1,z1,dx2,dy2,z2,dx3,dy3,z3);
6026  v = v+ColorCalculation(dx2,dy2,z2,dxr1,dyr1,zr1,dx3,dy3,z3);
6027  v = v+ColorCalculation(dx2,dy2,z2,dxr2,dyr2,zr2,dxr1,dyr1,zr1);
6028  v = v+ColorCalculation(dxr2,dyr2,zr2,dx2,dy2,z2,dx1,dy1,z1);
6029  v2 = v/4;
6030  if (sr5<0||sr5>w1||tr5<0||tr5>w2) Transform(sr5,tr5,-1);
6031  else Transform(sr5,tr5,0);
6032  dxr1 = fDxspline;
6033  dyr1 = fDyspline;
6034  zr1 = fZ;
6035  if (sr4<0||sr4>w1||tr4<0||tr4>w2) Transform(sr4,tr4,-1);
6036  else Transform(sr4,tr4,0);
6037  dxr2 = fDxspline;
6038  dyr2 = fDyspline;
6039  zr2 = fZ;
6040  v = ColorCalculation(dx2,dy2,z2,dx3,dy3,z3,dx4,dy4,z4);
6041  v = v+ColorCalculation(dx4,dy4,z4,dx3,dy3,z3,dxr1,dyr1,zr1);
6042  v = v+ColorCalculation(dx3,dy3,z3,dxr2,dyr2,zr2,dxr1,dyr1,zr1);
6043  v = v+ColorCalculation(dx2,dy2,z2,dxr2,dyr2,zr2,dx3,dy3,z3);
6044  v3 = v/4;
6045  if (sr7<0||sr7>w1||tr7<0||tr7>w2) Transform(sr7,tr7,-1);
6046  else Transform(sr7,tr7,0);
6047  dxr1 = fDxspline;
6048  dyr1 = fDyspline;
6049  zr1 = fZ;
6050  if (sr6<0||sr6>w1||tr6<0||tr6>w2) Transform(sr6,tr6,-1);
6051  else Transform(sr6,tr6,0);
6052  dxr2 = fDxspline;
6053  dyr2 = fDyspline;
6054  zr2 = fZ;
6055  v = ColorCalculation(dx1,dy1,z1,dx3,dy3,z3,dx4,dy4,z4);
6056  v = v+ColorCalculation(dx4,dy4,z4,dx3,dy3,z3,dxr2,dyr2,zr2);
6057  v = v+ColorCalculation(dx4,dy4,z4,dxr2,dyr2,zr2,dxr1,dyr1,zr1);
6058  v = v+ColorCalculation(dx1,dy1,z1,dx4,dy4,z4,dxr1,dyr1,zr1);
6059  v4 = v/4;
6060  } else {
6061  spriz = ShadowColorCalculation(xtaz,ytaz,ztaz,shad_noise);
6062  v = v+spriz;
6063  v = v/2;
6064  if (sr1<0||sr1>w1||tr1<0||tr1>w2) Transform(sr1,tr1,-1);
6065  else Transform(sr1,tr1,0);
6066  dxr1 = fDxspline;
6067  dyr1 = fDyspline;
6068  zr1 = fZ;
6069  if (sr8<0||sr8>w1||tr8<0||tr8>w2) Transform(sr8,tr8,-1);
6070  else Transform(sr8,tr8,0);
6071  dxr2 = fDxspline;
6072  dyr2 = fDyspline;
6073  zr2 = fZ;
6074  da = (dxr1+dx2+dx1)/3;
6075  db = (dyr1+dy2+dy1)/3;
6076  dc = (zr1+z2+z1)/3;
6077  spriz = ShadowColorCalculation(da,db,dc,shad_noise);
6078  v = v+(ColorCalculation(dxr1,dyr1,zr1,dx2,dy2,z2,dx1,dy1,z1)+spriz)/2;
6079  da = (dxr1+dxr2+dx1)/3;
6080  db = (dyr1+dyr2+dy1)/3;
6081  dc = (zr1+zr2+z1)/3;
6082  spriz = ShadowColorCalculation(da,db,dc,shad_noise);
6083  v = v+(ColorCalculation(dxr1,dyr1,zr1,dx1,dy1,z1,dxr2,dyr2,zr2)+spriz)/2;
6084  da = (dxr2+dx1+dx4)/3;
6085  db = (dyr2+dy1+dy4)/3;
6086  dc = (zr2+z1+z4)/3;
6087  spriz = ShadowColorCalculation(da,db,dc,shad_noise);
6088  v = v+(ColorCalculation(dxr2,dyr2,zr2,dx1,dy1,z1,dx4,dy4,z4)+spriz)/2;
6089  v1 = v/4;
6090  if (sr3<0||sr3>w1||tr3<0||tr3>w2) Transform(sr3,tr3,-1);
6091  else Transform(sr3,tr3,0);
6092  dxr1 = fDxspline;
6093  dyr1 = fDyspline;
6094  zr1 = fZ;
6095  if (sr2<0||sr2>w1||tr2<0||tr2>w2) Transform(sr2,tr2,-1);
6096  else Transform(sr2,tr2,0);
6097  dxr2 = fDxspline;
6098  dyr2 = fDyspline;
6099  zr2 = fZ;
6100  da = (dx1+dx2+dx3)/3;
6101  db = (dy1+dy2+dy3)/3;
6102  dc = (z1+z2+z3)/3;
6103  spriz = ShadowColorCalculation(da,db,dc,shad_noise);
6104  v = (ColorCalculation(dx1,dy1,z1,dx2,dy2,z2,dx3,dy3,z3)+spriz)/2;
6105  da = (dx2+dxr1+dx3)/3;
6106  db = (dy2+dyr1+dy3)/3;
6107  dc = (z2+zr1+z3)/3;
6108  spriz = ShadowColorCalculation(da,db,dc,shad_noise);
6109  v = v+(ColorCalculation(dx2,dy2,z2,dxr1,dyr1,zr1,dx3,dy3,z3)+spriz)/2;
6110  da = (dx2+dxr2+dxr1)/3;
6111  db = (dy2+dyr2+dyr1)/3;
6112  dc = (z2+zr2+zr1)/3;
6113  spriz = ShadowColorCalculation(da,db,dc,shad_noise);
6114  v = v+(ColorCalculation(dx2,dy2,z2,dxr2,dyr2,zr2,dxr1,dyr1,zr1)+spriz)/2;
6115  da = (dxr2+dx2+dx1)/3;
6116  db = (dyr2+dy2+dy1)/3;
6117  dc = (zr2+z2+z1)/3;
6118  spriz = ShadowColorCalculation(da,db,dc,shad_noise);
6119  v = v+(ColorCalculation(dxr2,dyr2,zr2,dx2,dy2,z2,dx1,dy1,z1)+spriz)/2;
6120  v2 = v/4;
6121  if (sr5<0||sr5>w1||tr5<0||tr5>w2) Transform(sr5,tr5,-1);
6122  else Transform(sr5,tr5,0);
6123  dxr1 = fDxspline;
6124  dyr1 = fDyspline;
6125  zr1 = fZ;
6126  if (sr4<0||sr4>w1||tr4<0||tr4>w2) Transform(sr4,tr4,-1);
6127  else Transform(sr4,tr4,0);
6128  dxr2 = fDxspline;
6129  dyr2 = fDyspline;
6130  zr2 = fZ;
6131  da = (dx2+dx3+dx4)/3;
6132  db = (dy2+dy3+dy4)/3;
6133  dc = (z2+z3+z4)/3;
6134  spriz = ShadowColorCalculation(da,db,dc,shad_noise);
6135  v = (ColorCalculation(dx2,dy2,z2,dx3,dy3,z3,dx4,dy4,z4)+spriz)/2;
6136  da = (dx4+dx3+dxr1)/3;
6137  db = (dy4+dy3+dyr1)/3;
6138  dc = (z4+z3+zr1)/3;
6139  spriz = ShadowColorCalculation(da,db,dc,shad_noise);
6140  v = v+(ColorCalculation(dx4,dy4,z4,dx3,dy3,z3,dxr1,dyr1,zr1)+spriz)/2;
6141  da = (dx3+dxr2+dxr1)/3;
6142  db = (dy3+dyr2+dyr1)/3;
6143  dc = (z3+zr2+zr1)/3;
6144  spriz = ShadowColorCalculation(da,db,dc,shad_noise);
6145  v = v+(ColorCalculation(dx3,dy3,z3,dxr2,dyr2,zr2,dxr1,dyr1,zr1)+spriz)/2;
6146  da = (dx2+dxr2+dx3)/3;
6147  db = (dy2+dyr2+dy3)/3;
6148  dc = (z2+zr2+z3)/3;
6149  spriz = ShadowColorCalculation(da,db,dc,shad_noise);
6150  v = v+(ColorCalculation(dx2,dy2,z2,dxr2,dyr2,zr2,dx3,dy3,z3)+spriz)/2;
6151  v3 = v/4;
6152  if (sr7<0||sr7>w1||tr7<0||tr7>w2) Transform(sr7,tr7,-1);
6153  else Transform(sr7,tr7,0);
6154  dxr1 = fDxspline;
6155  dyr1 = fDyspline;
6156  zr1 = fZ;
6157  if (sr6<0||sr6>w1||tr6<0||tr6>w2) Transform(sr6,tr6,-1);
6158  else Transform(sr6,tr6,0);
6159  dxr2 = fDxspline;
6160  dyr2 = fDyspline;
6161  zr2 = fZ;
6162  da = (dx1+dx3+dx4)/3;
6163  db = (dy1+dy3+dy4)/3;
6164  dc = (z1+z3+z4)/3;
6165  spriz = ShadowColorCalculation(da,db,dc,shad_noise);
6166  v = (ColorCalculation(dx1,dy1,z1,dx3,dy3,z3,dx4,dy4,z4)+spriz)/2;
6167  da = (dx4+dx3+dxr2)/3;
6168  db = (dy4+dy3+dyr2)/3;
6169  dc = (z4+z3+zr2)/3;
6170  spriz = ShadowColorCalculation(da,db,dc,shad_noise);
6171  v = v+(ColorCalculation(dx4,dy4,z4,dx3,dy3,z3,dxr2,dyr2,zr2)+spriz)/2;
6172  da = (dx4+dxr2+dxr1)/3;
6173  db = (dy4+dyr2+dyr1)/3;
6174  dc = (z4+zr2+zr1)/3;
6175  spriz = ShadowColorCalculation(da,db,dc,shad_noise);
6176  v = v+(ColorCalculation(dx4,dy4,z4,dxr2,dyr2,zr2,dxr1,dyr1,zr1)+spriz)/2;
6177  da = (dx1+dx4+dxr1)/3;
6178  db = (dy1+dy4+dyr1)/3;
6179  dc = (z1+z4+zr1)/3;
6180  spriz = ShadowColorCalculation(da,db,dc,shad_noise);
6181  v = v+(ColorCalculation(dx1,dy1,z1,dx4,dy4,z4,dxr1,dyr1,zr1)+spriz)/2;
6182  v4 = v/4;
6183  }
6184  }
6185  spriz = 0;
6186  if (fShadow==kShadowsNotPainted) {
6187  if (fShading==kNotShaded) {
6188  v = v*fLevels+0.5;
6189  iv = fLevels-(Int_t)v;
6190  } else {
6191  v1 = v1*fLevels;
6192  iv1 = fLevels-(Int_t)v1;
6193  v2 = v2*fLevels;
6194  iv2 = fLevels-(Int_t)v2;
6195  v4 = v4*fLevels;
6196  iv4 = fLevels-(Int_t)v4;
6197  }
6198  } else {
6199  spriz = ShadowColorCalculation(xtaz,ytaz,ztaz,shad_noise);
6200  if (fShading==kNotShaded) {
6201  v = v*fLevels/2.0;
6202  iv = fLevels-(Int_t)(v+0.5);
6203  } else {
6204  v1 = v1*fLevels;
6205  iv1 = fLevels-(Int_t)v1;
6206  v2 = v2*fLevels;
6207  iv2 = fLevels-(Int_t)v2;
6208  v4 = v4*fLevels;
6209  iv4 = fLevels-(Int_t)v4;
6210  }
6211  }
6212  if (fShading==kNotShaded) {
6213  ColorModel(iv,ui1,ui2,ui3);
6215  } else {
6216  dx1 = x1;
6217  dy1 = y1;
6218  dx2 = x2;
6219  dy2 = y2;
6220  dx3 = x4;
6221  dy3 = y4;
6222  z1 = iv1;
6223  z2 = iv2;
6224  z3 = iv4;
6225  da = (dy2-dy1)*(z3-z1)-(dy3-dy1)*(z2-z1);
6226  db = (z2-z1)*(dx3-dx1)-(z3-z1)*(dx2-dx1);
6227  dc = (dx2-dx1)*(dy3-dy1)-(dx3-dx1)*(dy2-dy1);
6228  dd = -da*dx1-db*dy1-dc*z1;
6229  }
6230  sx1 = x1;
6231  sy1 = y1;
6232  sx2 = x2;
6233  sy2 = y2;
6234  if (sx2<sx1) {
6235  sx4 = sx1;
6236  sy4 = sy1;
6237  sx1 = sx2;
6238  sy1 = sy2;
6239  sx2 = sx4;
6240  sy2 = sy4;
6241  }
6242  sdx1 = 0;
6243  pom1 = sy2-sy1;
6244  pom2 = sx2-sx1;
6245  if (pom2!=0) sdx1 = pom1/pom2;
6246  pom1 = sy1;
6247  pom2 = sx1;
6248  sdy1 = pom1-sdx1*pom2;
6249  for (sx4=sx1,sx5=sx1,sy5=sy1;sx4<=sx2;sx4++) {
6250  pom1 = sx4;
6251  sdy4 = sdx1*pom1+sdy1;
6252  sy4 = (Int_t)sdy4;
6253  if (sy4<=fEnvelope[sx4]) {
6254  fEnvelope[sx4] = sy4;
6255  if (fShading==kNotShaded) {
6256  line->PaintLine(gPad->PixeltoX(sx4),gPad->PixeltoY(sy4)+1,gPad->PixeltoX(sx5),gPad->PixeltoY(sy5)+1);
6257  } else {
6258  dx1 = sx4;
6259  dy1 = sy4;
6260  if (dc!=0) v = (-dd-da*dx1-db*dy1)/dc;
6261  else v = (iv1+iv2+iv4)/3;
6262  iv = (Int_t)v;
6263  ColorModel(iv,ui1,ui2,ui3);
6265  line->PaintLine(gPad->PixeltoX(sx4),gPad->PixeltoY(sy4)+1,gPad->PixeltoX(sx5),gPad->PixeltoY(sy5)+1);
6266  }
6267  sy5 = sy4;
6268  } else {
6269  sy4 = fEnvelope[sx4];
6270  if (fShading==kNotShaded&&sy5<=fEnvelope[sx5]) {
6271  line->PaintLine(gPad->PixeltoX(sx4),gPad->PixeltoY(sy4)+1,gPad->PixeltoX(sx5),gPad->PixeltoY(sy5)+1);
6272  } else if (sy5<=fEnvelope[sx5]) {
6273  dx1 = sx4;
6274  dy1 = sy4;
6275  if (dc!=0) v = (-dd-da*dx1-db*dy1)/dc;
6276  else v = (iv1+iv2+iv4)/3;
6277  iv = (Int_t)v;
6278  ColorModel(iv,ui1,ui2,ui3);
6280  line->PaintLine(gPad->PixeltoX(sx4),gPad->PixeltoY(sy4)+1,gPad->PixeltoX(sx5),gPad->PixeltoY(sy5)+1);
6281  }
6282  sy5 = fEnvelope[sx4];
6283  }
6284  sx5 = sx4;
6285  }
6286  sx1 = x1;
6287  sy1 = y1;
6288  sx3 = x4;
6289  sy3 = y4;
6290  if (sx3<sx1) {
6291  sx4 = sx1;
6292  sy4 = sy1;
6293  sx1 = sx3;
6294  sy1 = sy3;
6295  sx3 = sx4;
6296  sy3 = sy4;
6297  }
6298  pom1 = sy3-sy1;
6299  pom2 = sx3-sx1;
6300  if (pom2!=0) sdx2 = pom1/pom2;
6301  pom1 = sy1;
6302  pom2 = sx1;
6303  sdy2 = pom1-sdx2*pom2;
6304  sx1p = sx1;
6305  sy1p = sy1;
6306  sx3p = sx3;
6307  sdx2p = sdx2;
6308  sdy2p = sdy2;
6309  dap = da;
6310  dbp = db;
6311  dcp = dc;
6312  ddp = dd;
6313  uip = fNewColorIndex;
6314  xtaz = (dx3+dx2+dx4)/3;
6315  ytaz = (dy3+dy2+dy4)/3;
6316  ztaz = (z3+z2+z4)/3;
6317  if (fShading==kNotShaded) v = ColorCalculation(dx2,dy2,z2,dx3,dy3,z3,dx4,dy4,z4);
6318  spriz = 0;
6319  if (fShadow==kShadowsNotPainted) {
6320  if (fShading==kNotShaded) {
6321  v = v*fLevels;
6322  iv = fLevels-(Int_t)v;
6323  } else {
6324  v3 = v3*fLevels;
6325  iv3 = fLevels-(Int_t)v3;
6326  }
6327  } else {
6328  spriz = ShadowColorCalculation(xtaz,ytaz,ztaz,shad_noise);
6329  if (fShading==kNotShaded) {
6330  v = v*fLevels/2;
6331  iv = fLevels-(Int_t)v;
6332  iv = (Int_t)(iv-fLevels*spriz/2);
6333  } else {
6334  v3 = v3*fLevels;
6335  iv3 = fLevels-(Int_t)v3;
6336  }
6337  }
6338  if (fShading==kNotShaded) {
6339  ColorModel(iv,ui1,ui2,ui3);
6341  } else {
6342  dx1 = x2;
6343  dy1 = y2;
6344  dx2 = x3;
6345  dy2 = y3;
6346  dx3 = x4;
6347  dy3 = y4;
6348  z1 = iv2;
6349  z2 = iv3;
6350  z3 = iv4;
6351  da = (dy2-dy1)*(z3-z1)-(dy3-dy1)*(z2-z1);
6352  db = (z2-z1)*(dx3-dx1)-(z3-z1)*(dx2-dx1);
6353  dc = (dx2-dx1)*(dy3-dy1)-(dx3-dx1)*(dy2-dy1);
6354  dd = -da*dx1-db*dy1-dc*z1;
6355  }
6356  sx1 = x2;
6357  sy1 = y2;
6358  sx2 = x3;
6359  sy2 = y3;
6360  if (sx2<sx1) {
6361  sx4 = sx1;
6362  sy4 = sy1;
6363  sx1 = sx2;
6364  sy1 = sy2;
6365  sx2 = sx4;
6366  sy2 = sy4;
6367  }
6368  pom1 = sy2-sy1;
6369  pom2 = sx2-sx1;
6370  sdx1 = 0;
6371  if (pom2!=0) sdx1 = pom1/pom2;
6372  pom1 = sy1;
6373  pom2 = sx1;
6374  sdy1 = pom1-sdx1*pom2;
6375  for (sx4=sx1,sx5=sx1,sy5=sy1;sx4<=sx2;sx4++) {
6376  pom1 = sx4;
6377  sdy4 = sdx1*pom1+sdy1;
6378  sy4 = (Int_t)sdy4;
6379  if (sy4<=fEnvelope[sx4]) {
6380  fEnvelope[sx4] = sy4;
6381  if (fShading==kNotShaded) {
6382  line->PaintLine(gPad->PixeltoX(sx4),gPad->PixeltoY(sy4)+1,gPad->PixeltoX(sx5),gPad->PixeltoY(sy5)+1);
6383  } else {
6384  dx1 = sx4;
6385  dy1 = sy4;
6386  if (dc!=0) v = (-dd-da*dx1-db*dy1)/dc;
6387  else v = (iv1+iv2+iv4)/3;
6388  iv = (Int_t)v;
6389  ColorModel(iv,ui1,ui2,ui3);
6391  line->PaintLine(gPad->PixeltoX(sx4),gPad->PixeltoY(sy4)+1,gPad->PixeltoX(sx5),gPad->PixeltoY(sy5)+1);
6392  }
6393  sy5 = sy4;
6394  } else {
6395  sy4 = fEnvelope[sx4];
6396  if (fShading==kNotShaded&&sy5<=fEnvelope[sx5]) {
6397  line->PaintLine(gPad->PixeltoX(sx4),gPad->PixeltoY(sy4)+1,gPad->PixeltoX(sx5),gPad->PixeltoY(sy5)+1);
6398  } else if (sy5<=fEnvelope[sx5]) {
6399  dx1 = sx4;
6400  dy1 = sy4;
6401  if (dc!=0) v = (-dd-da*dx1-db*dy1)/dc;
6402  else v = (iv1+iv2+iv4)/3;
6403  iv = (Int_t)v;
6404  ColorModel(iv,ui1,ui2,ui3);
6406  line->PaintLine(gPad->PixeltoX(sx4),gPad->PixeltoY(sy4)+1,gPad->PixeltoX(sx5),gPad->PixeltoY(sy5)+1);
6407  }
6408  sy5 = fEnvelope[sx4];
6409  }
6410  sx5 = sx4;
6411  }
6412  sx1 = x2;
6413  sy1 = y2;
6414  sx2 = x4;
6415  sy2 = y4;
6416  if (sx2<sx1) {
6417  sx4 = sx1;
6418  sy4 = sy1;
6419  sx1 = sx2;
6420  sy1 = sy2;
6421  sx2 = sx4;
6422  sy2 = sy4;
6423  }
6424  pom1 = sy2-sy1;
6425  pom2 = sx2-sx1;
6426  sdx1 = 0;
6427  if (pom2!=0) sdx1 = pom1/pom2;
6428  pom1 = sy1;
6429  pom2 = sx1;
6430  sdy1 = pom1-sdx1*pom2;
6431  for (sx4=sx1,sx5=sx1,sy5=sy1;sx4<=sx2;sx4++) {
6432  pom1 = sx4;
6433  sdy4 = sdx1*pom1+sdy1;
6434  sy4 = (Int_t)sdy4;
6435  if (sy4<=fEnvelope[sx4]) {
6436  fEnvelope[sx4] = sy4;
6437  if (fShading==kNotShaded) {
6438  line->PaintLine(gPad->PixeltoX(sx4),gPad->PixeltoY(sy4)+1,gPad->PixeltoX(sx5),gPad->PixeltoY(sy5)+1);
6439  } else {
6440  dx1 = sx4;
6441  dy1 = sy4;
6442  if (dc!=0) v = (-dd-da*dx1-db*dy1)/dc;
6443  else v = (iv1+iv2+iv4)/3;
6444  iv = (Int_t)v;
6445  ColorModel(iv,ui1,ui2,ui3);
6447  line->PaintLine(gPad->PixeltoX(sx4),gPad->PixeltoY(sy4)+1,gPad->PixeltoX(sx5),gPad->PixeltoY(sy5)+1);
6448  }
6449  sy5 = sy4;
6450  } else {
6451  sy4 = fEnvelope[sx4];
6452  if (fShading==kNotShaded&&sy5<=fEnvelope[sx5]) {
6453  line->PaintLine(gPad->PixeltoX(sx4),gPad->PixeltoY(sy4)+1,gPad->PixeltoX(sx5),gPad->PixeltoY(sy5)+1);
6454  } else if (sy5<=fEnvelope[sx5]) {
6455  dx1 = sx4;
6456  dy1 = sy4;
6457  if (dc!=0) v = (-dd-da*dx1-db*dy1)/dc;
6458  else v = (iv1+iv2+iv4)/3;
6459  iv = (Int_t)v;
6460  ColorModel(iv,ui1,ui2,ui3);
6462  line->PaintLine(gPad->PixeltoX(sx4),gPad->PixeltoY(sy4)+1,gPad->PixeltoX(sx5),gPad->PixeltoY(sy5)+1);
6463  }
6464  sy5 = fEnvelope[sx4];
6465  }
6466  sx5 = sx4;
6467  }
6468  for (sx4=sx1p,sx5=sx1p,sy5=sy1p;sx4<=sx3p;sx4++) {
6469  pom1 = sx4;
6470  sdy4 = sdx2p*pom1+sdy2p;
6471  sy4 = (Int_t)sdy4;
6472  if (sy4<=fEnvelope[sx4]) {
6473  fEnvelope[sx4] = sy4;
6474  if (fShading==kNotShaded) {
6475  line->SetLineColor(uip);
6476  line->PaintLine(gPad->PixeltoX(sx4),gPad->PixeltoY(sy4)+1,gPad->PixeltoX(sx5),gPad->PixeltoY(sy5)+1);
6477  } else {
6478  dx1 = sx4;
6479  dy1 = sy4;
6480  if (dcp!=0) v = (-ddp-dap*dx1-dbp*dy1)/dcp;
6481  else v = (iv1+iv2+iv4)/3;
6482  iv = (Int_t)v;
6483  ColorModel(iv,ui1,ui2,ui3);
6485  line->PaintLine(gPad->PixeltoX(sx4),gPad->PixeltoY(sy4)+1,gPad->PixeltoX(sx5),gPad->PixeltoY(sy5)+1);
6486  }
6487  sy5 = sy4;
6488  } else {
6489  sy4 = fEnvelope[sx4];
6490  if (fShading==kNotShaded&&sy5<=fEnvelope[sx5]) {
6491  line->SetLineColor(uip);
6492  line->PaintLine(gPad->PixeltoX(sx4),gPad->PixeltoY(sy4)+1,gPad->PixeltoX(sx5),gPad->PixeltoY(sy5)+1);
6493  } else if (sy5<=fEnvelope[sx5]) {
6494  dx1 = sx4;
6495  dy1 = sy4;
6496  if (dcp!=0) v = (-ddp-dap*dx1-dbp*dy1)/dcp;
6497  else v = (iv1+iv2+iv4)/3;
6498  iv = (Int_t)v;
6499  ColorModel(iv,ui1,ui2,ui3);
6501  line->PaintLine(gPad->PixeltoX(sx4),gPad->PixeltoY(sy4)+1,gPad->PixeltoX(sx5),gPad->PixeltoY(sy5)+1);
6502  }
6503  sy5 = fEnvelope[sx4];
6504  }
6505  sx5 = sx4;
6506  }
6507  sx2 = x3;
6508  sy2 = y3;
6509  sx3 = x4;
6510  sy3 = y4;
6511  if (sx3<sx2) {
6512  sx4 = sx2;
6513  sy4 = sy2;
6514  sx2 = sx3;
6515  sy2 = sy3;
6516  sx3 = sx4;
6517  sy3 = sy4;
6518  }
6519  sdx2 = 0;
6520  pom1 = sy3-sy2;
6521  pom2 = sx3-sx2;
6522  if (pom2!=0) sdx2 = pom1/pom2;
6523  pom1 = sy2;
6524  pom2 = sx2;
6525  sdy2 = pom1-sdx2*pom2;
6526  for (sx4=sx2,sx5=sx2,sy5=sy2;sx4<=sx3;sx4++) {
6527  pom1 = sx4;
6528  sdy4 = sdx2*pom1+sdy2;
6529  sy4 = (Int_t)sdy4;
6530  if (sy4<=fEnvelope[sx4]) {
6531  fEnvelope[sx4] = sy4;
6532  if (fShading==kNotShaded) {
6533  line->PaintLine(gPad->PixeltoX(sx4),gPad->PixeltoY(sy4)+1,gPad->PixeltoX(sx5),gPad->PixeltoY(sy5)+1);
6534  } else {
6535  dx1 = sx4;
6536  dy1 = sy4;
6537  if (dc!=0) v = (-dd-da*dx1-db*dy1)/dc;
6538  else v = (iv1+iv2+iv4)/3;
6539  iv = (Int_t)v;
6540  ColorModel(iv,ui1,ui2,ui3);
6542  line->PaintLine(gPad->PixeltoX(sx4),gPad->PixeltoY(sy4)+1,gPad->PixeltoX(sx5),gPad->PixeltoY(sy5)+1);
6543  }
6544  sy5 = sy4;
6545  } else {
6546  sy4 = fEnvelope[sx4];
6547  if (fShading==kNotShaded&&sy5<=fEnvelope[sx5]) {
6548  line->PaintLine(gPad->PixeltoX(sx4),gPad->PixeltoY(sy4)+1,gPad->PixeltoX(sx5),gPad->PixeltoY(sy5)+1);
6549  } else if (sy5<=fEnvelope[sx5]) {
6550  dx1 = sx4;
6551  dy1 = sy4;
6552  if (dc!=0) v = (-dd-da*dx1-db*dy1)/dc;
6553  else v = (iv1+iv2+iv4)/3;
6554  iv = (Int_t)v;
6555  ColorModel(iv,ui1,ui2,ui3);
6557  line->PaintLine(gPad->PixeltoX(sx4),gPad->PixeltoY(sy4)+1,gPad->PixeltoX(sx5),gPad->PixeltoY(sy5)+1);
6558  }
6559  sy5 = fEnvelope[sx4];
6560  }
6561  sx5 = sx4;
6562  }
6563  }
6564  }
6565  break;
6566  }
6567  if (flag==1) {
6568  x = x1;
6569  y = y1;
6570  x1 = x2;
6571  y1 = y2;
6572  x2 = x;
6573  y2 = y;
6574  x = x1d;
6575  y = y1d;
6576  x1d = x2d;
6577  y1d = y2d;
6578  x2d = x;
6579  y2d = y;
6580  if (smer==0) q1 += 1;
6581  else q2 += 1;
6582  } else {
6583  x1 = x2;
6584  y1 = y2;
6585  x1d = x2d;
6586  y1d = y2d;
6587  }
6588  } while ((q1!=qv||(q2!=(qv-1) && q2!=w2)||smer!=0||flag!=1) &&
6589  ((q1!=(qv-1) && q1!=w1)||q2!=qv||smer!=1||flag!=1) &&
6590  uhl!=1);
6591  if (qv<=w2&&qv<=w1) {
6592  if (uhl==0) {
6593  if (smer==0) {
6594  smer = 1;
6595  q1 = 0;
6596  flag = 0;
6597  q2 = qv;
6598  xp1 = x1;
6599  yp1 = y1;
6600  goto l2;
6601  } else {
6602  smer = 0;
6603  uhl = 1;
6604  q1 = qv;
6605  q2 = qv-1;
6606  xp2 = x1;
6607  yp2 = y1;
6608  x1 = xp1;
6609  y1 = yp1;
6610  flag = 1;
6611  goto l2;
6612  }
6613  } else {
6614  if (smer==0) {
6615  smer = 1;
6616  x1 = xp2;
6617  y1 = yp2;
6618  q1 = qv-1;
6619  q2 = qv;
6620  flag = 1;
6621  goto l2;
6622  }
6623  }
6624  }
6625  q2 = 0;
6626  qv += 1;
6627  q1 = qv;
6628  if (q1>w1) {
6629  q2 = qv;
6630  q1 = 0;
6631  smer = 1;
6632  flag = 0;
6633  uhl = 0;
6634  if (q2<=w2) goto l2;
6635  }
6636  } while (q1<=w1&&q2<=w2);
6639  line->SetLineWidth(1);
6640  for (i=fBx1;i<=fBx2;i++) fEnvelope[i] = fBy2;
6641  turni = 0;
6642  turnj = 0;
6643  Transform(w1,0,0);
6644  x1 = fXt;
6645  Transform(0,0,0);
6646  x2 = fXt;
6647  Transform(0,w2,0);
6648  x3 = fXt;
6649  if (x2>=x1) turnj = 1;
6650  if (x3>=x2) turni = 1;
6651  q1 = 1;
6652  q2 = 0;
6653  qv = 1;
6654  do {
6655  uhl = 0;
6656  smer = 0;
6657  flag = 0;
6658 lc2:
6659  if (turni==1) {
6660  i = q1;
6661  } else {
6662  i = w1-q1;
6663  }
6664  if (turnj==1) {
6665  j = q2;
6666  } else {
6667  j = w2-q2;
6668  }
6669  Transform(i,j,0);
6670  x1 = fXt;
6671  y1 = fYt;
6672  Transform(i,j,-1);
6673  x1d = fXt;
6674  y1d = fYt;
6675  do {
6676  if (flag==0) {
6677  flag = 1;
6678  if (smer==0) q1 -= 1;
6679  else q2 -= 1;
6680  } else {
6681  flag = 0;
6682  if (smer==0) q2 += 1;
6683  else q1 += 1;
6684  }
6685  if (turni==1) {
6686  i = q1;
6687  } else {
6688  i = w1-q1;
6689  }
6690  if (turnj==1) {
6691  j = q2;
6692  } else {
6693  j = w2-q2;
6694  }
6695  Transform(i,j,0);
6696  x2 = fXt;
6697  y2 = fYt;
6698  if (flag==1) {
6699  x = x1;
6700  y = y1;
6701  x1 = x2;
6702  y1 = y2;
6703  x2 = x;
6704  y2 = y;
6705  }
6706  Envelope(x1,y1,x2,y2);
6708  if (fLine!=0) {
6709  if (fLine==1) {
6710  fXe = x2;
6711  fYe = y2;
6712  }
6714  line->PaintLine(gPad->PixeltoX(fXs),gPad->PixeltoY(fYs)+1,gPad->PixeltoX(fXe),gPad->PixeltoY(fYe)+1);
6715  }
6716  }
6718  if (y1<=fEnvelope[x1]) {
6720  }
6721  }
6722  if (flag==1) {
6723  x = x1;
6724  y = y1;
6725  x1 = x2;
6726  y1 = y2;
6727  x2 = x;
6728  y2 = y;
6729  x = x1d;
6730  y = y1d;
6731  x1d = x2d;
6732  y1d = y2d;
6733  x2d = x;
6734  y2d = y;
6735  if (smer==0) q1 += 1;
6736  else q2 += 1;
6737  } else {
6738  x1 = x2;
6739  y1 = y2;
6740  x1d = x2d;
6741  y1d = y2d;
6742  }
6743  } while ((q1!=qv||(q2!=(qv-1)&&q2!=w2)||smer!=0||flag!=1) &&
6744  ((q1!=(qv-1)&&q1!=w1)||q2!=qv||smer!=1||flag!=1) &&
6745  uhl!=1);
6746  if (qv<=w2&&qv<=w1) {
6747  if (uhl==0) {
6748  if (smer==0) {
6749  smer = 1;
6750  q1 = 0;
6751  flag = 0;
6752  q2 = qv;
6753  xp1 = x1;
6754  yp1 = y1;
6755  goto lc2;
6756  } else {
6757  smer = 0;
6758  uhl = 1;
6759  q1 = qv;
6760  q2 = qv-1;
6761  xp2 = x1;
6762  yp2 = y1;
6763  x1 = xp1;
6764  y1 = yp1;
6765  flag = 1;
6766  goto lc2;
6767  }
6768  } else {
6769  if (smer==0) {
6770  smer = 1;
6771  x1 = xp2;
6772  y1 = yp2;
6773  q1 = qv-1;
6774  q2 = qv;
6775  flag = 1;
6776  goto lc2;
6777  }
6778  }
6779  }
6780  q2 = 0;
6781  qv += 1;
6782  q1 = qv;
6783  if (q1>w1) {
6784  q2 = qv;
6785  q1 = 0;
6786  smer = 1;
6787  flag = 0;
6788  uhl = 0;
6789  if (q2<=w2) goto lc2;
6790  }
6791  } while (q1<=w1&&q2<=w2);
6792  }
6793 
6794  // Paint axis.
6795  static char chopt[10] = "";
6796  if (fViewAngle==0) {
6797  axis->PaintAxis(p101x, p101y, p111x, p111y, bmin, bmax, ndivx, "");
6798  axis->PaintAxis(p011x, p011y, p111x, p111y, bmin, bmax, ndivx, "");
6799  if(fAlpha+fBeta<90)
6800  axis->PaintAxis(p110x, p110y, p111x, p111y, bmin, bmax, ndivx, "");
6801  ndivx = fH2->GetXaxis()->GetNdivisions();
6802  bmin = fH2->GetXaxis()->GetXmin();
6803  bmax = fH2->GetXaxis()->GetXmax();
6804  xaxis->SetLabelOffset(xaxis->GetLabelOffset()-xaxis->GetTickSize());
6805  chopt[0] = 0; strlcat(chopt, "SDH-",10);
6806  if (ndivx < 0) {
6807  strlcat(chopt, "N",10);
6808  ndivx = -ndivx;
6809  }
6810  xaxis->PaintAxis(p010x, p010y, p110x, p110y, bmin, bmax, ndivx, chopt);
6811  ndivy = fH2->GetYaxis()->GetNdivisions();
6812  bmin = fH2->GetYaxis()->GetXmin();
6813  bmax = fH2->GetYaxis()->GetXmax();
6814  yaxis->SetLabelOffset(yaxis->GetLabelOffset()+yaxis->GetTickSize());
6815  chopt[0] = 0; strlcat(chopt, "SDH+",10);
6816  if (ndivy < 0) {
6817  strlcat(chopt, "N",10);
6818  ndivy = -ndivy;
6819  }
6820  yaxis->PaintAxis(p100x, p100y, p110x, p110y, bmin, bmax, ndivy, chopt);
6821  if(fAlpha+fBeta<90){
6822  ndivz = 510;
6823  bmin = fZmin;
6824  bmax = fZmax;
6825  zaxis->SetLabelOffset(zaxis->GetLabelOffset()-zaxis->GetTickSize());
6826  if (fZscale==kZScaleLog) {
6827  ndivz = 510;
6828  if (bmin <= 0) bmin=0.001*bmax;
6829  zaxis->PaintAxis(p010x, p010y, p011x, p011y, bmin, bmax, ndivz, "G+");
6830  } else if (fZscale==kZScaleSqrt) {
6831  TF1 *f1=new TF1("f1","sqrt(x)",bmin,bmax);
6832  TGaxis *a1 = new TGaxis(p010x, p010y, p011x, p011y, "f1", ndivz, "SDH+");
6833  a1->SetLabelOffset(a1->GetLabelOffset()-a1->GetTickSize());
6834  a1->Paint();
6835  delete f1;
6836  delete a1;
6837  } else {
6838  chopt[0] = 0; strlcat(chopt, "SDH+",10);
6839  if (ndivz < 0) {
6840  strlcat(chopt, "N",10);
6841  ndivz = -ndivz;
6842  }
6843  zaxis->PaintAxis(p010x, p010y, p011x, p011y, bmin, bmax, ndivz, chopt);
6844  }
6845  }
6846  } else if (fViewAngle==90) {
6847  axis->PaintAxis(p001x, p001y, p101x, p101y, bmin, bmax, ndivx, "");
6848  axis->PaintAxis(p111x, p111y, p101x, p101y, bmin, bmax, ndivx, "");
6849  if(fAlpha+fBeta<90)
6850  axis->PaintAxis(p100x, p100y, p101x, p101y, bmin, bmax, ndivx, "");
6851  ndivx = fH2->GetXaxis()->GetNdivisions();
6852  bmin = fH2->GetXaxis()->GetXmin();
6853  bmax = fH2->GetXaxis()->GetXmax();
6854  xaxis->SetLabelOffset(xaxis->GetLabelOffset()+xaxis->GetTickSize());
6855  chopt[0] = 0; strlcat(chopt, "SDH+",10);
6856  if (ndivx < 0) {
6857  strlcat(chopt, "N",10);
6858  ndivx = -ndivx;
6859  }
6860  xaxis->PaintAxis(p000x, p000y, p100x, p100y, bmin, bmax, ndivx, chopt);
6861  ndivy = fH2->GetYaxis()->GetNdivisions();
6862  bmin = fH2->GetYaxis()->GetXmin();
6863  bmax = fH2->GetYaxis()->GetXmax();
6864  yaxis->SetLabelOffset(yaxis->GetLabelOffset()+yaxis->GetTickSize());
6865  chopt[0] = 0; strlcat(chopt, "SDH+",10);
6866  if (ndivy < 0) {
6867  strlcat(chopt, "N",10);
6868  ndivy = -ndivy;
6869  }
6870  yaxis->PaintAxis(p100x, p100y, p110x, p110y, bmin, bmax, ndivy, chopt);
6871  if(fAlpha+fBeta<90){
6872  ndivz = 510;
6873  bmin = fZmin;
6874  bmax = fZmax;
6875  zaxis->SetLabelOffset(zaxis->GetLabelOffset()-zaxis->GetTickSize());
6876  if (fZscale==kZScaleLog) {
6877  ndivz = 510;
6878  if (bmin <= 0) bmin=0.001*bmax;
6879  zaxis->PaintAxis(p110x, p110y, p111x, p111y, bmin, bmax, ndivz, "G+");
6880  } else if (fZscale==kZScaleSqrt) {
6881  TF1 *f1=new TF1("f1","sqrt(x)",bmin,bmax);
6882  TGaxis *a1 = new TGaxis(p110x, p110y, p111x, p111y, "f1", ndivz, "SDH+");
6883  a1->SetLabelOffset(a1->GetLabelOffset()-a1->GetTickSize());
6884  a1->Paint();
6885  delete f1;
6886  delete a1;
6887  } else {
6888  chopt[0] = 0; strlcat(chopt, "SDH+",10);
6889  if (ndivz < 0) {
6890  strlcat(chopt, "N",10);
6891  ndivz = -ndivz;
6892  }
6893  zaxis->PaintAxis(p110x, p110y, p111x, p111y, bmin, bmax, ndivz, chopt);
6894  }
6895  }
6896  } else if (fViewAngle==180) {
6897  axis->PaintAxis(p011x, p011y, p001x, p001y, bmin, bmax, ndivx, "");
6898  axis->PaintAxis(p101x, p101y, p001x, p001y, bmin, bmax, ndivx, "");
6899  if(fAlpha+fBeta<90)
6900  axis->PaintAxis(p000x, p000y, p001x, p001y, bmin, bmax, ndivx, "");
6901  ndivx = fH2->GetXaxis()->GetNdivisions();
6902  bmin = fH2->GetXaxis()->GetXmin();
6903  bmax = fH2->GetXaxis()->GetXmax();
6904  xaxis->SetLabelOffset(xaxis->GetLabelOffset()+xaxis->GetTickSize());
6905  chopt[0] = 0; strlcat(chopt, "SDH+",10);
6906  if (ndivx < 0) {
6907  strlcat(chopt, "N",10);
6908  ndivx = -ndivx;
6909  }
6910  xaxis->PaintAxis(p000x, p000y, p100x, p100y, bmin, bmax, ndivx, chopt);
6911  ndivy = fH2->GetYaxis()->GetNdivisions();
6912  bmin = fH2->GetYaxis()->GetXmin();
6913  bmax = fH2->GetYaxis()->GetXmax();
6914  yaxis->SetLabelOffset(yaxis->GetLabelOffset()-yaxis->GetTickSize());
6915  chopt[0] = 0; strlcat(chopt, "SDH-",10);
6916  if (ndivy < 0) {
6917  strlcat(chopt, "N",10);
6918  ndivy = -ndivy;
6919  }
6920  yaxis->PaintAxis(p000x, p000y, p010x, p010y, bmin, bmax, ndivy, chopt);
6921  if(fAlpha+fBeta<90){
6922  ndivz = 510;
6923  bmin = fZmin;
6924  bmax = fZmax;
6925  zaxis->SetLabelOffset(zaxis->GetLabelOffset()-zaxis->GetTickSize());
6926  if (fZscale==kZScaleLog) {
6927  ndivz=510;
6928  if (bmin <= 0) bmin=0.001*bmax;
6929  zaxis->PaintAxis(p100x, p100y, p101x, p101y, bmin, bmax, ndivz, "G+");
6930  } else if (fZscale==kZScaleSqrt) {
6931  TF1 *f1=new TF1("f1","sqrt(x)",bmin,bmax);
6932  TGaxis *a1 = new TGaxis(p100x, p100y, p101x, p101y, "f1", ndivz, "SDH+");
6933  a1->SetLabelOffset(a1->GetLabelOffset()-a1->GetTickSize());
6934  a1->Paint();
6935  delete f1;
6936  delete a1;
6937  } else {
6938  chopt[0] = 0; strlcat(chopt, "SDH+",10);
6939  if (ndivz < 0) {
6940  strlcat(chopt, "N",10);
6941  ndivz = -ndivz;
6942  }
6943  zaxis->PaintAxis(p100x, p100y, p101x, p101y, bmin, bmax, ndivz, chopt);
6944  }
6945  }
6946  } else if (fViewAngle==270) {
6947  axis->PaintAxis(p111x, p111y, p011x, p011y, bmin, bmax, ndivx, "");
6948  axis->PaintAxis(p001x, p001y, p011x, p011y, bmin, bmax, ndivx, "");
6949  if(fAlpha+fBeta<90)
6950  axis->PaintAxis(p010x, p010y, p011x, p011y, bmin, bmax, ndivx, "");
6951  ndivx = fH2->GetXaxis()->GetNdivisions();
6952  bmin = fH2->GetXaxis()->GetXmin();
6953  bmax = fH2->GetXaxis()->GetXmax();
6954  xaxis->SetLabelOffset(xaxis->GetLabelOffset()-xaxis->GetTickSize());
6955  chopt[0] = 0; strlcat(chopt, "SDH-",10);
6956  if (ndivx < 0) {
6957  strlcat(chopt, "N",10);
6958  ndivx = -ndivx;
6959  }
6960  xaxis->PaintAxis(p010x, p010y, p110x, p110y, bmin, bmax, ndivx, chopt);
6961  ndivy = fH2->GetYaxis()->GetNdivisions();
6962  bmin = fH2->GetYaxis()->GetXmin();
6963  bmax = fH2->GetYaxis()->GetXmax();
6964  yaxis->SetLabelOffset(yaxis->GetLabelOffset()-yaxis->GetTickSize());
6965  chopt[0] = 0; strlcat(chopt, "SDH-",10);
6966  if (ndivy < 0) {
6967  strlcat(chopt, "N",10);
6968  ndivy = -ndivy;
6969  }
6970  yaxis->PaintAxis(p000x, p000y, p010x, p010y, bmin, bmax, ndivy, chopt);
6971  if(fAlpha+fBeta<90){
6972  ndivz = 510;
6973  bmin = fZmin;
6974  bmax = fZmax;
6975  zaxis->SetLabelOffset(zaxis->GetLabelOffset()-zaxis->GetTickSize());
6976  if (fZscale==kZScaleLog) {
6977  ndivz = 510;
6978  if (bmin <= 0) bmin=0.001*bmax;
6979  zaxis->PaintAxis(p000x, p000y, p001x, p001y, bmin, bmax, ndivz, "G+");
6980  } else if (fZscale==kZScaleSqrt) {
6981  TF1 *f1=new TF1("f1","sqrt(x)",bmin,bmax);
6982  TGaxis *a1 = new TGaxis(p000x, p000y, p001x, p001y, "f1", ndivz, "SDH+");
6983  a1->SetLabelOffset(a1->GetLabelOffset()-a1->GetTickSize());
6984  a1->Paint();
6985  delete f1;
6986  delete a1;
6987  } else {
6988  chopt[0] = 0; strlcat(chopt, "SDH+",10);
6989  if (ndivz < 0) {
6990  strlcat(chopt, "N",10);
6991  ndivz = -ndivz;
6992  }
6993  zaxis->PaintAxis(p000x, p000y, p001x, p001y, bmin, bmax, ndivz, "SDH+");
6994  }
6995  }
6996  }
6997 
6998  // End.
6999  delete axis;
7000  delete xaxis;
7001  delete yaxis;
7002  delete zaxis;
7003 }
7004 
7005 
7006 ////////////////////////////////////////////////////////////////////////////////
7007 /// Sets display group mode and display mode:
7008 /// -modeGroup - the following group modes can be set: simple modes-kPicture2ModeGroupSimple, modes with shading according to light-kPicture2ModeGroupLight, modes with shading according to channels counts-kPicture2ModeGroupHeight, modes of combination of shading according to light and to channels counts-kPicture2ModeGroupLightHeight
7009 /// -displayMode - posible display modes are: points, grid, contours, bars, x_lines, y_lines, bars_x, bars_y, needles, surface, triangles
7010 
7011 void TSpectrum2Painter::SetDisplayMode(Int_t modeGroup,Int_t displayMode)
7012 {
7013  if (modeGroup>=kModeGroupSimple&&modeGroup<=kModeGroupLightHeight) {
7014  if (displayMode>=kDisplayModePoints&&displayMode<=kDisplayModeTriangles) {
7015  fModeGroup = modeGroup;
7016  fDisplayMode = displayMode;
7017  }
7018  }
7019 }
7020 
7021 
7022 ////////////////////////////////////////////////////////////////////////////////
7023 /// Sets pen attributes:
7024 /// -color - color of spectrum
7025 /// -style - style of pen (solid, dash, dot, dash-dot)
7026 /// -width - width of pen in pixels
7027 
7029 {
7030  if (color>=0 && style >=kPenStyleSolid && style <= kPenStyleDashDot && width > 0) {
7031  fPenColor = color;
7032  fPenDash = style;
7033  fPenWidth = width;
7034  }
7035 }
7036 
7037 
7038 ////////////////////////////////////////////////////////////////////////////////
7039 /// Sets nodes in both directions:
7040 /// -nodesx, nodesy, only the bins at the nodes points are displayed
7041 
7043 {
7044  if (nodesx>1&&nodesy>1) {
7045  fNodesx = nodesx;
7046  fNodesy = nodesy;
7047  }
7048 }
7049 
7050 
7051 ////////////////////////////////////////////////////////////////////////////////
7052 /// Sets angles of the view:
7053 /// -alpha - angles of display,alpha+beta must be less or equal to 90, alpha- angle between base line of Canvas and right lower edge of picture base plane
7054 /// -beta - angle between base line of Canvas and left lower edge of picture base plane
7055 /// -view - rotation angle of the view, it can be 0, 90, 180, 270 degrees
7056 
7058 {
7059  if (alpha>=0&&alpha<=90&&beta>=0&&beta<=90&&alpha+beta<=90) {
7060  fAlpha = alpha;
7061  fBeta = beta;
7062  }
7063  view = view/90;
7064  if (view>=0&&view<=3) fViewAngle = view*90;
7065 }
7066 
7067 
7068 ////////////////////////////////////////////////////////////////////////////////
7069 /// Sets z-axis scale:
7070 /// -scale - linear, sqrt or log
7071 
7073 {
7074  if (scale>=kZScaleLinear&&scale<=kZScaleSqrt) {
7075  fZscale = scale;
7076  }
7077 }
7078 
7079 
7080 ////////////////////////////////////////////////////////////////////////////////
7081 /// Sets shading color algorithm:
7082 /// -colorAlgorithm - applies only for rainbowed display modes
7083 /// (rgb smooth alorithm, rgb modulo color component, cmy smooth alorithm,
7084 /// cmy modulo color component, cie smooth alorithm,
7085 /// cie modulo color component, yiq smooth alorithm,
7086 /// yiq modulo color component, hsv smooth alorithm,
7087 /// hsv modulo color component, it does not apply for simple display modes
7088 /// algorithm group
7089 
7091 {
7093  if (colorAlgorithm>=kColorAlgRgbSmooth&&colorAlgorithm<=kColorAlgHvsModulo) fColorAlg = colorAlgorithm;
7094  }
7095 }
7096 
7097 
7098 ////////////////////////////////////////////////////////////////////////////////
7099 /// Sets color increments between two color levels for r, g, b components:
7100 /// -r, g, b - color increments between two color levels
7101 
7103 {
7104  if (r>=0&&r<=255&&g>=0&&g<=255&&b>=0&&b<=255) {
7105  fRainbow1Step = r;
7106  fRainbow2Step = g;
7107  fRainbow3Step = b;
7108  }
7109 }
7110 
7111 
7112 ////////////////////////////////////////////////////////////////////////////////
7113 /// Sets position of fictive light source in 3D space:
7114 /// -x, y, z
7115 
7117 {
7118  if (x>=0&&y>=0&&z>=0) {
7119  fXlight = x;
7120  fYlight = y;
7121  fZlight = z;
7122  }
7123 }
7124 
7125 
7126 ////////////////////////////////////////////////////////////////////////////////
7127 /// Sets on/off shading and shadow switches:
7128 /// -shading - determines whether the picture will shaded, smoothed (no shading, shading), for rainbowed display modes only
7129 /// -shadow - determines whether shadow will be drawn, for rainbowed display modes with shading according to light
7130 
7132 {
7134  if (shading==kNotShaded||shading==kShaded) fShading = shading;
7135  if (shadow==kShadowsNotPainted||shadow==kShadowsPainted) fShadow = shadow;
7136  }
7137 }
7138 
7139 
7140 ////////////////////////////////////////////////////////////////////////////////
7141 /// Sets on/off Bezier smoothing:
7142 /// -bezier - determines Bezier interpolation (applies only for simple
7143 /// display modes group for grid, x_lines, y_lines display modes)
7144 
7146 {
7149  if (bezier==kBezierInterpol||bezier==kNoBezierInterpol) fBezier = bezier;
7150  }
7151 }
7152 
7153 
7154 ////////////////////////////////////////////////////////////////////////////////
7155 /// Sets width between horizontal slices:
7156 /// -width - width between contours, applies only for contours display mode
7157 
7159 {
7160  if (width>=1) fContWidth = width;
7161 }
7162 
7163 
7164 ////////////////////////////////////////////////////////////////////////////////
7165 /// Sets weight between shading according to fictive light source and according to channels counts:
7166 /// -weight - weight between shading according to fictive light source and according to channels counts, applies only for kPicture2ModeGroupLightHeight modes group
7167 
7169 {
7171  if (weight>=0&&weight<=1) fLHweight = weight;
7172  }
7173 }
7174 
7175 
7176 ////////////////////////////////////////////////////////////////////////////////
7177 /// Sets enables/disables drawing of channel marks and sets their attributes:
7178 /// -enable - decides whether the channel marks are shown or not
7179 /// -color - color of channel marks
7180 /// -width - width of channel marks in pixels
7181 /// -height - height of channel marks in pixels
7182 /// -style - style of channel marks (dot, cross, star, rectangle, X, diamond, triangle)
7183 
7185 {
7186  if (enable==kChannelMarksNotDrawn||enable==kChannelMarksDrawn) {
7187  if (enable==kChannelMarksDrawn) {
7190  fChanmarkColor = color;
7191  if (width>=4) {
7192  fChanmarkWidth = width;
7193  }
7194  else fChanmarkWidth = 4;
7195  if (height>=4) {
7196  fChanmarkHeight = height;
7197  }
7198  else fChanmarkHeight = 4;
7199  }
7200  }
7201  fChanmarkEnDis = enable;
7202  }
7203 }
7204 
7205 
7206 ////////////////////////////////////////////////////////////////////////////////
7207 /// This function sets enables/disables drawing of channel grid and sets its color:
7208 /// -enable - decides whether the channel grid is shown or not
7209 /// -color - color of channel grid
7210 
7212 {
7213  if (enable==kChannelGridNotDrawn||enable==kChannelGridDrawn) {
7214  if (enable==kChannelGridDrawn) {
7215  fChanlineColor=color;
7216  }
7217  fChanlineEnDis=enable;
7218  }
7219 }
7220 
7221 
7222 ////////////////////////////////////////////////////////////////////////////////
7223 /// Gets display group mode and display mode:
7224 /// -modeGroup - the following group modes might have been set: simple modes-kPicture2ModeGroupSimple, modes with shading according to light-kPicture2ModeGroupLight, modes with shading according to channels counts-kPicture2ModeGroupHeight, modes of combination of shading according to light and to channels counts-kPicture2ModeGroupLightHeight
7225 /// -displayMode - display modes that might have been set: points, grid, contours, bars, x_lines, y_lines, bars_x, bars_y, needles, surface, triangles
7226 
7227 void TSpectrum2Painter::GetDisplayMode(Int_t &modeGroup,Int_t &displayMode)
7228 {
7229  modeGroup = fModeGroup;
7230  displayMode = fDisplayMode;
7231 }
7232 
7233 
7234 ////////////////////////////////////////////////////////////////////////////////
7235 /// Gets pen attributes:
7236 /// -color - color of spectrum
7237 /// -style - style of pen (solid, dash, dot, dash-dot)
7238 /// -width - width of pen in pixels
7239 
7241 {
7242  color = fPenColor;
7243  style = fPenDash;
7244  width = fPenWidth;
7245 }
7246 
7247 
7248 ////////////////////////////////////////////////////////////////////////////////
7249 /// Gets nodes in both directions:
7250 /// -nodesx, nodesy, only the bins at the nodes points are displayed
7251 
7253 {
7254  nodesx = fNodesx;
7255  nodesy = fNodesy;
7256 }
7257 
7258 
7259 ////////////////////////////////////////////////////////////////////////////////
7260 /// Gets angles of the view:
7261 /// -alpha - angle between base line of Canvas and right lower edge of picture base plane
7262 /// -beta - angle between base line of Canvas and left lower edge of picture base plane
7263 /// -view - rotation angle of the view, it can be 0, 90, 180, 270 degrees
7264 
7266 {
7267  alpha = fAlpha;
7268  beta = fBeta;
7269  view = fViewAngle;
7270 }
7271 
7272 
7273 ////////////////////////////////////////////////////////////////////////////////
7274 /// Gets z-axis scale:
7275 /// -scale - it can be linear, sqrt or log
7276 
7278 {
7279  scale = fZscale;
7280 }
7281 
7282 
7283 ////////////////////////////////////////////////////////////////////////////////
7284 /// Gets shading color algorithm:
7285 /// -colorAlgorithm - rgb smooth alorithm, rgb modulo color component, cmy smooth alorithm, cmy modulo color component, cie smooth alorithm, cie modulo color component, yiq smooth alorithm, yiq modulo color component, hsv smooth alorithm, hsv modulo algorithm
7286 
7288 {
7289  colorAlgorithm = fColorAlg;
7290 }
7291 
7292 
7293 ////////////////////////////////////////////////////////////////////////////////
7294 /// Gets color increments between two color levels for r, g, b components:
7295 /// -r, g, b - color increments between two color levels
7296 
7298 {
7299  r = fRainbow1Step;
7300  g = fRainbow2Step;
7301  b = fRainbow3Step;
7302 }
7303 
7304 
7305 ////////////////////////////////////////////////////////////////////////////////
7306 /// Gets position of fictive light source in 3D space:
7307 /// -x, y, z
7308 
7310 {
7311  x = fXlight;
7312  y = fYlight;
7313  z = fZlight;
7314 }
7315 
7316 
7317 ////////////////////////////////////////////////////////////////////////////////
7318 /// Gets shading and shadow switches:
7319 /// -shading - determines whether the picture will shaded, smoothed (no shading, shading), for rainbowed display modes only
7320 /// -shadow - determines whether shadow will be drawn, for rainbowed display modes with shading according to light
7321 
7323 {
7324  shading = fShading;
7325  shadow = fShadow;
7326 }
7327 
7328 
7329 ////////////////////////////////////////////////////////////////////////////////
7330 /// Gets Bezier smoothing switch:
7331 /// -bezier - determines Bezier interpolation (applies only for simple display modes group for grid, x_lines, y_lines display modes)
7332 
7334 {
7335  bezier = fBezier;
7336 }
7337 
7338 
7339 ////////////////////////////////////////////////////////////////////////////////
7340 /// Gets width between horizontal slices:
7341 /// -width - width between contours, applies only for contours display mode
7342 
7344 {
7345  width = fContWidth;
7346 }
7347 
7348 
7349 ////////////////////////////////////////////////////////////////////////////////
7350 /// Gets weight between shading according to fictive light source and according to channels counts:
7351 /// -weight - weight between shading according to fictive light source and according to channels counts, applies only for kPicture2ModeGroupLightHeight modes group
7352 
7354 {
7355  weight = fLHweight;
7356 }
7357 
7358 
7359 ////////////////////////////////////////////////////////////////////////////////
7360 /// Gets drawing attributes for channel marks:
7361 /// -enable - decides whether the channel marks are shown or not
7362 /// -color - color of channel marks
7363 /// -width - width of channel marks in pixels
7364 /// -height - height of channel marks in pixels
7365 /// -style - style of channel marks (dot, cross, star, rectangle, X, diamond, triangle)
7366 
7367 void TSpectrum2Painter::GetChanMarks(Int_t &enable,Int_t &color,Int_t &width,Int_t &height,Int_t &style)
7368 {
7369  style = fChanmarkStyle,width=fChanmarkWidth,height=fChanmarkHeight,color=fChanmarkColor;
7370  enable = fChanmarkEnDis;
7371 }
7372 
7373 
7374 ////////////////////////////////////////////////////////////////////////////////
7375 /// This function gets attributes for drawing channel:
7376 /// -enable - decides whether the channel grid is shown or not
7377 /// -color - color of channel grid
7378 
7380 {
7381  color = fChanlineColor;
7382  enable = fChanlineEnDis;
7383 }
7384 
7385 
7386 ////////////////////////////////////////////////////////////////////////////////
7387 /// This function allows to set all the possible options available in
7388 /// TSpectrum2Painter and paint "h2".
7389 ///
7390 /// TSpectrum2Painter offers a large set of options/attributes. In the
7391 /// "option" parameter each of them can be set to specific values via
7392 /// "operators" in the option itself. for instance on can do:
7393 ///
7394 /// h2->Draw("SPEC a(30,30,0)");
7395 ///
7396 /// to draw h2 with TSpectrum2Painter using all the default attributes except
7397 /// the viewing angles. The operators' names are case unsensitive (one can use
7398 /// "a" or "A"). Operators parameters are seperated by ",". The operators can
7399 /// be put is any order in the option. Operators must be serparated by " ".
7400 /// No " " characters should be put in an operator. This help page describes
7401 /// all the available operators.
7402 ///
7403 /// * * *
7404 ///
7405 /// The way "h2" will be painted is controled with 2 parameters the "Display
7406 /// modes groups" and the "Display Modes".
7407 ///
7408 /// "Display modes groups" can take the following values:
7409 ///
7410 /// 0 = Simple - it covers simple display modes using one color only
7411 /// 1 = Light - in this group the shading is carried out according to
7412 /// the position of the fictive light source
7413 /// 2 = Height - in this group the shading is carried out according to
7414 /// the channel contents
7415 /// 3 = LightHeight - combination of two previous shading algorithms. One
7416 /// can control the weight between both algorithms.
7417 ///
7418 /// "Display modes" can take the following values:
7419 ///
7420 /// 1 = Points.
7421 /// 2 = Grid.
7422 /// 3 = Contours.
7423 /// 4 = Bars.
7424 /// 5 = LinesX.
7425 /// 6 = LinesY.
7426 /// 7 = BarsX.
7427 /// 8 = BarsY.
7428 /// 9 = Needles.
7429 /// 10 = Surface.
7430 /// 11 = Triangles.
7431 ///
7432 /// Using this function these parameters can be set using the "dm" operator
7433 /// in the option. Example:
7434 ///
7435 /// h2->Draw("SPEC dm(1,2)");
7436 ///
7437 /// will paint the 2D histogram h2 using the "Light Display mode group" and
7438 /// the "Grid Display mode". The following table summarizes all the possible
7439 /// combinations of the "Display modes groups" and the "Display modes".
7440 ///
7441 /// +--------+-------+--------+--------------+
7442 /// | Simple | Light | Height | Light-Height |
7443 /// +-----------+--------+-------+--------+--------------+
7444 /// | Points | X | X | X | X |
7445 /// +-----------+--------+-------+--------+--------------+
7446 /// | Grid | X | X | X | X |
7447 /// +-----------+--------+-------+--------+--------------+
7448 /// | Contours | X | - | X | - |
7449 /// +-----------+--------+-------+--------+--------------+
7450 /// | Bars | X | - | X | - |
7451 /// +-----------+--------+-------+--------+--------------+
7452 /// | LinesX | X | X | X | X |
7453 /// +-----------+--------+-------+--------+--------------+
7454 /// | LinesY | X | X | X | X |
7455 /// +-----------+--------+-------+--------+--------------+
7456 /// | BarsX | X | - | X | - |
7457 /// +-----------+--------+-------+--------+--------------+
7458 /// | BarsY | X | - | X | - |
7459 /// +-----------+--------+-------+--------+--------------+
7460 /// | Needles | X | - | - | - |
7461 /// +-----------+--------+-------+--------+--------------+
7462 /// | Surface | - | X | X | X |
7463 /// +-----------+--------+-------+--------+--------------+
7464 /// | Triangles | X | X | X | X |
7465 /// +-----------+--------+-------+--------+--------------+
7466 ///
7467 /// * * *
7468 ///
7469 /// The Pen Attributes can be changed using pa(color, style, width). Example:
7470 ///
7471 /// h2->Draw("SPEC dm(1,2) pa(2,1,2)");
7472 ///
7473 /// sets the line color to 2, line type to 1 and line width to2. Note that if
7474 /// pa() is not specified, the histogram "h2" line attributes are used. Note
7475 /// also that operators for SPEC option can be cummulated and specified in
7476 /// any order.
7477 ///
7478 /// * * *
7479 ///
7480 /// The buffer size can be change with bf(size). Example:
7481 ///
7482 /// h2->Draw("SPEC bf(8000)");
7483 ///
7484 /// The spectrum painter needs a buffer to paint the spectrum. By default the
7485 /// buffer size is set to 1600. In most cases this buffer size is enough. But
7486 /// if the canvas size is very big, for instance 8000x5000 this buffer size is
7487 /// too small. An error message is issued telling to use the option bf().
7488 ///
7489 /// * * *
7490 ///
7491 /// The number of nodes can be change with n(nodesx, nodesy). Example:
7492 ///
7493 /// h2->Draw("SPEC n(40,40)");
7494 ///
7495 /// Sometimes the displayed region is rather large. When displaying all
7496 /// channels pictures become very dense and complicated. It is very difficult
7497 /// to understand the overall shape of data. "n(nx,ny)" allows to change the
7498 /// density of displayed channels. Only the channels coinciding with given
7499 /// nodes are displayed.
7500 ///
7501 /// * * *
7502 ///
7503 /// The visualization angles can be changed with a(alpha, beta, view).
7504 /// Example:
7505 ///
7506 /// h2->Draw("SPEC n(40,40) dm(0,1) a(30,30,0)");
7507 ///
7508 /// Alpha defines the angle between bottom horizontal screen line and the
7509 /// displayed space on the right side of the picture and beta on the left
7510 /// side, respectively. One can rotate the 3-d space around vertical axis
7511 /// going through the center of it employing the view parameter. Allowed
7512 /// values are 0, 90, 180 and 270 degrees.
7513 ///
7514 /// * * *
7515 ///
7516 /// zs(scale) changes the scale of the Z-axis Possible values are:
7517 ///
7518 /// 0 = Linear (default)
7519 /// 1 = Log
7520 /// 2 = Sqrt
7521 ///
7522 /// If gPad->SetLogz() has been set, log scale on Z-axis is set automatically.
7523 /// No need to use the zs() operator. Note that the X and Y axis are always
7524 /// linear.
7525 ///
7526 /// * * *
7527 ///
7528 /// ci(r,g,b), were r,g and b are floats defines the colors increments.
7529 /// For sophisticated shading (Light, Height and LightHeight Display Modes
7530 /// Groups) the color palette starts from the basic pen color (see pa()
7531 /// function). There is a predefined number of color levels (256). Color in
7532 /// every level is calculated by adding the increments of the r, g, b
7533 /// components to the previous level. Using this function one can change the
7534 /// color increments between two neighboring color levels. The function does
7535 /// not apply dor the Simple Display Modes Group. The default values are:
7536 /// (1,1,1).
7537 ///
7538 /// * * *
7539 ///
7540 /// ca(color_algorithm) allows to choose the Color Algorithm.
7541 /// To define the colors one can employ one of the following color algorithms
7542 /// (RGB, CMY, CIE, YIQ, HVS models). When the level of a component reaches
7543 /// the limit value one can choose either smooth transition (by decreasing
7544 /// the limit value) or a sharp modulo transition (continuing with 0 value).
7545 /// This makes possible to realize various visual effects. One can choose from
7546 /// the following set of the algorithms:
7547 ///
7548 /// 0 = RGB Smooth
7549 /// 1 = RGB Modulo
7550 /// 2 = CMY Smooth
7551 /// 3 = CMY Modulo
7552 /// 4 = CIE Smooth
7553 /// 5 = CIE Modulo
7554 /// 6 = YIQ Smooth
7555 /// 7 = YIQ Modulo
7556 /// 8 = HVS Smooth
7557 /// 9 = HVS Modulo
7558 ///
7559 /// This function does not apply on Simple display modes group. Default
7560 /// value is 0. Example:
7561 ///
7562 /// h2->Draw("SPEC c1(4) dm(0,1) a(30,30,0)");
7563 ///
7564 /// choose CMY Modulo to paint the "h2" histogram.
7565 ///
7566 /// * * *
7567 ///
7568 /// lp(x,y,z) set the light position.
7569 /// In Light and LightHeight display modes groups the color palette is
7570 /// calculated according to the fictive light source position in 3-d space.
7571 /// Using this function one can change the position of the source and thus
7572 /// to achieve various graphical effects. This function does not apply for
7573 /// Simple and Height display modes groups. Default is:
7574 /// lp(1000,1000,100).
7575 ///
7576 /// * * *
7577 ///
7578 /// s(shading,shadow) allows to set the shading.
7579 /// The picture's surface is composed of triangles. If desired the edges of
7580 /// the neighboring triangles can be smoothed (shaded). If desired the
7581 /// display of the shadow can be painted as well. The function does not apply
7582 /// for Simple display modes group. The possible values for shading are:
7583 ///
7584 /// 0 = Not Shaded
7585 /// 1 = Shaded
7586 ///
7587 /// The possible values for shadow are:
7588 ///
7589 /// 0 = Shadows are not painted
7590 /// 1 = Shadows are painted
7591 ///
7592 /// Default values: s(1,0)
7593 ///
7594 /// * * *
7595 ///
7596 /// b(bezier) set the Bezier smoothing.
7597 /// For Simple display modes group and for Grid, LinesX and LinesY display
7598 /// modes one can smooth data using Bezier smoothing algorithm. The function
7599 /// does not apply for other display modes groups and display modes. Possible
7600 /// values are:
7601 ///
7602 /// 0 = No bezier smoothing
7603 /// 1 = Bezier smoothing
7604 ///
7605 /// Default value is: b(0)
7606 ///
7607 /// * * *
7608 ///
7609 /// cw(width) set the contour width.
7610 /// This function applies only for the Contours display mode. One can change
7611 /// the width between horizontal slices and thus their density.
7612 /// Default value: cw(50)
7613 ///
7614 /// * * *
7615 ///
7616 /// lhw(weight) set the light height weight.
7617 /// For LightHeight display modes group one can change the weight between
7618 /// both shading algorithms. The function does not apply for other display
7619 /// modes groups. Default value is lhw(0.5).
7620 ///
7621 /// * * *
7622 ///
7623 /// cm(enable,color,width,height,style) allows to draw a marker on each node.
7624 /// In addition to the surface drawn using any above given algorithm one can
7625 /// display channel marks. One can control the color as well as the width,
7626 /// height (in pixels) and the style of the marks. The parameter enable can
7627 /// be set to
7628 ///
7629 /// 0 = Channel marks are not drawn
7630 /// 1 = Channel marks drawn
7631 ///
7632 /// The possible styles can be chosen from the set:
7633 ///
7634 /// 1 = Dot
7635 /// 2 = Cross
7636 /// 3 = Star
7637 /// 4 = Rectangle
7638 /// 5 = X
7639 /// 6 = Diamond
7640 /// 7 = Triangle.
7641 ///
7642 /// * * *
7643 ///
7644 /// cg(enable,color) channel grid.
7645 /// In addition to the surface drawn using any above given algorithm one can
7646 /// display grid using the color parameter. The parameter enable can be set
7647 /// to:
7648 ///
7649 /// 0 = Grid not drawn
7650 /// 1 = Grid drawn
7651 ///
7652 /// * * *
7653 ///
7654 /// See example in $ROOTSYS/tutorials/spectrum/spectrumpainter.C
7655 
7657 {
7658  /*
7659  <img src="gif/spectrumpainter.gif">
7660  */
7661 
7662  TString opt = option;
7663 
7664  TSpectrum2Painter sp(h2, bs);
7665 
7666  if (gPad->GetLogz()) sp.SetZScale(kZScaleLog);
7667  sp.SetPenAttr(h2->GetLineColor(), h2->GetLineStyle(), h2->GetLineWidth());
7668 
7669  TString token;
7670  Int_t i1, i2, i3, i4, i5;
7671  Double_t f1, f2, f3;
7672  Ssiz_t from = 4;
7673 
7674  // Decode the paint options.
7675  while (opt.Tokenize(token, from, "[ (]")) {
7676 
7677  // Display Mode
7678  if (token=="dm") {
7679  opt.Tokenize(token, from, ","); i1 = token.Atoi();
7680  if (i1<0 || i1>3) {
7681  printf("PaintSpectrum: Display modes groups should be in the [0,3] range\n");
7682  i1 = 0;
7683  }
7684  opt.Tokenize(token, from, ")"); i2 = token.Atoi();
7685  if (i2<1 || i2>11) {
7686  printf("PaintSpectrum: Display modes should be in the [1,11] range\n");
7687  i2 = 1;
7688  }
7689  sp.SetDisplayMode(i1, i2);
7690 
7691  // Pen Attributes
7692  } else if (token=="pa") {
7693  opt.Tokenize(token, from, ","); i1 = token.Atoi();
7694  opt.Tokenize(token, from, ","); i2 = token.Atoi();
7695  opt.Tokenize(token, from, ")"); i3 = token.Atoi();
7696  sp.SetPenAttr(i1, i2, i3);
7697 
7698  // Nodes
7699  } else if (token=="n") {
7700  opt.Tokenize(token, from, ","); i1 = token.Atoi();
7701  opt.Tokenize(token, from, ")"); i2 = token.Atoi();
7702  sp.SetNodes(i1, i2);
7703 
7704  // Color Algorithm
7705  } else if (token=="ca") {
7706  opt.Tokenize(token, from, ")"); i1 = token.Atoi();
7707  if (i1<0 || i1>9) {
7708  printf("PaintSpectrum: Color Algorithm should be in the [0,9] range\n");
7709  i1 = 1;
7710  }
7711  sp.SetColorAlgorithm(i1);
7712 
7713  // Z Scale
7714  } else if (token=="zs") {
7715  opt.Tokenize(token, from, ")"); i1 = token.Atoi();
7716  if (i1<0 || i1>2) {
7717  printf("PaintSpectrum: Z-Scale should be in the [0,2] range\n");
7718  i1 = 0;
7719  }
7720  sp.SetZScale(i1);
7721 
7722  // Color Increment
7723  } else if (token=="ci") {
7724  opt.Tokenize(token, from, ","); f1 = token.Atof();
7725  opt.Tokenize(token, from, ","); f2 = token.Atof();
7726  opt.Tokenize(token, from, ")"); f3 = token.Atof();
7727  sp.SetColorIncrements(f1, f2, f3);
7728 
7729  // Light Height Weight
7730  } else if (token=="lhw") {
7731  opt.Tokenize(token, from, ")"); f1 = token.Atof();
7732  sp.SetLightHeightWeight(f1);
7733 
7734  // Light Position
7735  } else if (token=="lp") {
7736  opt.Tokenize(token, from, ","); i1 = token.Atoi();
7737  opt.Tokenize(token, from, ","); i2 = token.Atoi();
7738  opt.Tokenize(token, from, ")"); i3 = token.Atoi();
7739  sp.SetLightPosition(i1, i2, i3);
7740 
7741  // Contour Width
7742  } else if (token=="cw") {
7743  opt.Tokenize(token, from, ")"); i1 = token.Atoi();
7744  sp.SetContourWidth(i1);
7745 
7746  // Bezier
7747  } else if (token=="b") {
7748  opt.Tokenize(token, from, ")"); i1 = token.Atoi();
7749  if (i1<0 || i1>1) {
7750  printf("PaintSpectrum: Bezier should be in the [0,1] range\n");
7751  i1 = 0;
7752  }
7753  sp.SetBezier(i1);
7754 
7755  // Shading
7756  } else if (token=="s") {
7757  opt.Tokenize(token, from, ","); i1 = token.Atoi();
7758  if (i1<0 || i1>1) {
7759  printf("PaintSpectrum: Shading should be in the [0,1] range\n");
7760  i1 = 0;
7761  }
7762  opt.Tokenize(token, from, ")"); i2 = token.Atoi();
7763  if (i2<0 || i2>1) {
7764  printf("PaintSpectrum: Shadow should be in the [0,1] range\n");
7765  i2 = 0;
7766  }
7767  sp.SetShading(i1, i2);
7768 
7769  // Channel Marks
7770  } else if (token=="cm") {
7771  opt.Tokenize(token, from, ","); i1 = token.Atoi();
7772  opt.Tokenize(token, from, ","); i2 = token.Atoi();
7773  opt.Tokenize(token, from, ","); i3 = token.Atoi();
7774  opt.Tokenize(token, from, ","); i4 = token.Atoi();
7775  opt.Tokenize(token, from, ")"); i5 = token.Atoi();
7776  sp.SetChanMarks(i1, i2, i3, i4, i5);
7777 
7778  // Channel Grid
7779  } else if (token=="cg") {
7780  opt.Tokenize(token, from, ","); i1 = token.Atoi();
7781  opt.Tokenize(token, from, ")"); i2 = token.Atoi();
7782  sp.SetChanGrid(i1, i2);
7783 
7784  // Angles
7785  } else if (token=="a" || token=="a=") {
7786  opt.Tokenize(token, from, ","); i1 = token.Atoi();
7787  opt.Tokenize(token, from, ","); i2 = token.Atoi();
7788  opt.Tokenize(token, from, ")"); i3 = token.Atoi();
7789  sp.SetAngles(i1, i2, i3);
7790 
7791  // Buffer size
7792  } else if (token=="bf") {
7793  // Nothing to do here, The option "bf" has been handle before.
7794  // But it is a valid option.
7795  opt.Tokenize(token, from, ")");
7796 
7797  // Unknown option
7798  } else {
7799  if (!token.IsNull()) {
7800  printf("Unknown option \"%s\"\n",token.Data());
7801  return;
7802  }
7803  }
7804  }
7805 
7806  sp.Paint("");
7807 }
void SetDisplayMode(Int_t modeGroup, Int_t displayMode)
Sets display group mode and display mode: -modeGroup - the following group modes can be set: simple m...
void GetDisplayMode(Int_t &modeGroup, Int_t &displayMode)
Gets display group mode and display mode: -modeGroup - the following group modes might have been set:...
virtual void SetLineWidth(Width_t lwidth)
Definition: TAttLine.h:57
void SetAngles(Int_t alpha, Int_t beta, Int_t view)
Sets angles of the view: -alpha - angles of display,alpha+beta must be less or equal to 90...
virtual Double_t GetMaximum(Double_t maxval=FLT_MAX) const
Return maximum value smaller than maxval of bins in the range, unless the value has been overridden b...
Definition: TH1.cxx:7927
Double_t BezierBlend(Int_t i, Double_t bezf)
This function calculates Bezier approximation.
float xmin
Definition: THbookFile.cxx:93
void CopyEnvelope(Double_t xr, Double_t xs, Double_t yr, Double_t ys)
Copies envelope vector, which ensures hidden surface removal for the contours display mode...
Int_t GetFirst() const
Return first bin on the axis i.e.
Definition: TAxis.cxx:429
void SetBezier(Int_t bezier)
Sets on/off Bezier smoothing: -bezier - determines Bezier interpolation (applies only for simple disp...
Float_t GetRed() const
Definition: TColor.h:60
void SetShading(Int_t shading, Int_t shadow)
Sets on/off shading and shadow switches: -shading - determines whether the picture will shaded...
void Envelope(Int_t x1, Int_t y1, Int_t x2, Int_t y2)
Ensures hidden surface removal.
TLine * line
const double pi
const char Option_t
Definition: RtypesCore.h:62
Definition: Rtypes.h:61
float ymin
Definition: THbookFile.cxx:93
Create a Box.
Definition: TBox.h:44
TH1 * h
Definition: legend2.C:5
Definition: Rtypes.h:60
void GetColorAlgorithm(Int_t &colorAlgorithm)
Gets shading color algorithm: -colorAlgorithm - rgb smooth alorithm, rgb modulo color component...
static void Optimize(Double_t A1, Double_t A2, Int_t nold, Double_t &BinLow, Double_t &BinHigh, Int_t &nbins, Double_t &BWID, Option_t *option="")
static function to compute reasonable axis limits
Double_t ColorCalculation(Double_t dx1, Double_t dy1, Double_t z1, Double_t dx2, Double_t dy2, Double_t z2, Double_t dx3, Double_t dy3, Double_t z3)
Calculates and returns color value for the surface triangle given by function parameters: -dx1...
#define gROOT
Definition: TROOT.h:352
virtual void SetTheta(Double_t theta=0)
Definition: TEllipse.h:87
Basic string class.
Definition: TString.h:137
TString as(SEXP s)
Definition: RExports.h:85
virtual void SetPhimax(Double_t phi=360)
Definition: TEllipse.h:84
Short_t Min(Short_t a, Short_t b)
Definition: TMathBase.h:170
int Int_t
Definition: RtypesCore.h:41
TArc * a
Definition: textangle.C:12
void SetPenAttr(Int_t color, Int_t style, Int_t width)
Sets pen attributes: -color - color of spectrum -style - style of pen (solid, dash, dot, dash-dot) -width - width of pen in pixels.
virtual void SetFillStyle(Style_t fstyle)
Definition: TAttFill.h:52
int nbins[3]
Int_t fNewColorIndex
buffers&#39; size
void box(Int_t pat, Double_t x1, Double_t y1, Double_t x2, Double_t y2)
Definition: fillpatterns.C:1
TLatex * t1
Definition: textangle.C:20
virtual void SetR1(Double_t r1)
Definition: TEllipse.h:85
Float_t GetBlue() const
Definition: TColor.h:62
Short_t Abs(Short_t d)
Definition: TMathBase.h:110
virtual Width_t GetLineWidth() const
Definition: TAttLine.h:49
double cos(double)
double beta(double x, double y)
Calculates the beta function.
virtual void Paint(Option_t *option="")
Paint this ellipse with its current attributes.
Definition: TEllipse.cxx:519
static void PaintSpectrum(TH2 *h2, Option_t *option="", Int_t bs=1600)
This function allows to set all the possible options available in TSpectrum2Painter and paint "h2"...
virtual Style_t GetLineStyle() const
Definition: TAttLine.h:48
double sqrt(double)
Double_t GetXmin() const
Definition: TAxis.h:137
static const double x2[5]
Double_t x[n]
Definition: legend1.C:17
void GetAngles(Int_t &alpha, Int_t &beta, Int_t &view)
Gets angles of the view: -alpha - angle between base line of Canvas and right lower edge of picture b...
void ColorModel(unsigned ui, unsigned ui1, unsigned ui2, unsigned ui3)
This function calculates color for one palette entry given by function parameter ui.
Float_t GetGreen() const
Definition: TColor.h:61
The TNamed class is the base class for all named ROOT classes.
Definition: TNamed.h:33
static double p2(double t, double a, double b, double c)
static const double x4[22]
void GetNodes(Int_t &nodesx, Int_t &nodesy)
Gets nodes in both directions: -nodesx, nodesy, only the bins at the nodes points are displayed...
void EnvelopeBars(Int_t x1, Int_t y1, Int_t x2, Int_t y2)
Ensures hidden surfuce removal for Bars, BarsX and BarsY display modes.
void SetContourWidth(Int_t width)
Sets width between horizontal slices: -width - width between contours, applies only for contours disp...
double sin(double)
virtual void ResetAttLine(Option_t *option="")
Reset this line attributes to default values.
Definition: TAttLine.cxx:247
void GetLightHeightWeight(Double_t &weight)
Gets weight between shading according to fictive light source and according to channels counts: -weig...
void SetChanMarks(Int_t enable, Int_t color, Int_t width, Int_t height, Int_t style)
Sets enables/disables drawing of channel marks and sets their attributes: -enable - decides whether t...
virtual Int_t GetNdivisions() const
Definition: TAttAxis.h:50
virtual void PaintLine(Double_t x1, Double_t y1, Double_t x2, Double_t y2)
Draw this line with new coordinates.
Definition: TLine.cxx:380
virtual void SetLineColor(Color_t lcolor)
Definition: TAttLine.h:54
void GetContourWidth(Int_t &width)
Gets width between horizontal slices: -width - width between contours, applies only for contours disp...
virtual void SetY1(Double_t y1)
Definition: TEllipse.h:89
float ymax
Definition: THbookFile.cxx:93
void BezierSmoothing(Double_t bezf)
Calculates screen coordinates of the smoothed point.
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:705
ROOT::R::TRInterface & r
Definition: Object.C:4
Int_t GetLast() const
Return last bin on the axis i.e.
Definition: TAxis.cxx:440
Service class for 2-Dim histogram classes.
Definition: TH2.h:36
SVector< double, 2 > v
Definition: Dict.h:5
virtual void SetFillColor(Color_t fcolor)
Definition: TAttFill.h:50
virtual void SetX1(Double_t x1)
Definition: TEllipse.h:88
void Transform(Int_t it, Int_t jt, Int_t zmt)
Reads out the value from histogram and calculates screen coordinates.
virtual ~TSpectrum2Painter()
TSpectrum2Painter destructor.
void GetShading(Int_t &shading, Int_t &shadow)
Gets shading and shadow switches: -shading - determines whether the picture will shaded, smoothed (no shading, shading), for rainbowed display modes only -shadow - determines whether shadow will be drawn, for rainbowed display modes with shading according to light.
void GetPenAttr(Int_t &color, Int_t &style, Int_t &width)
Gets pen attributes: -color - color of spectrum -style - style of pen (solid, dash, dot, dash-dot) -width - width of pen in pixels.
void GetColorIncrements(Double_t &r, Double_t &g, Double_t &b)
Gets color increments between two color levels for r, g, b components: -r, g, b - color increments be...
virtual void SetR2(Double_t r2)
Definition: TEllipse.h:86
A simple line.
Definition: TLine.h:41
short Short_t
Definition: RtypesCore.h:35
void GetChanGrid(Int_t &enable, Int_t &color)
This function gets attributes for drawing channel: -enable - decides whether the channel grid is show...
The axis painter class.
Definition: TGaxis.h:39
TAxis * GetYaxis()
Definition: TH1.h:320
float xmax
Definition: THbookFile.cxx:93
static double p1(double t, double a, double b)
double asin(double)
virtual void PaintBox(Double_t x1, Double_t y1, Double_t x2, Double_t y2, Option_t *option="")
Draw this box with new coordinates.
Definition: TBox.cxx:627
void DrawMarker(Int_t x, Int_t y, Int_t w, Int_t h, Int_t type)
Draws channel mark at the screen coordinates x, y.
void GetChanMarks(Int_t &enable, Int_t &color, Int_t &width, Int_t &height, Int_t &style)
Gets drawing attributes for channel marks: -enable - decides whether the channel marks are shown or n...
virtual Double_t GetMinimum(Double_t minval=-FLT_MAX) const
Return minimum value larger than minval of bins in the range, unless the value has been overridden by...
Definition: TH1.cxx:8012
virtual Color_t GetLineColor() const
Definition: TAttLine.h:47
virtual void SetPhimin(Double_t phi=0)
Definition: TEllipse.h:83
void GetLightPosition(Int_t &x, Int_t &y, Int_t &z)
Gets position of fictive light source in 3D space: -x, y, z.
int Ssiz_t
Definition: RtypesCore.h:63
TObjArray * Tokenize(const TString &delim) const
This function is used to isolate sequential tokens in a TString.
Definition: TString.cxx:2240
void SetLabelOffset(Float_t labeloffset)
Definition: TGaxis.h:117
static const double x1[5]
#define ClassImp(name)
Definition: Rtypes.h:279
double f(double x)
double Double_t
Definition: RtypesCore.h:55
int type
Definition: TGX11.cxx:120
Double_t ShadowColorCalculation(Double_t xtaz, Double_t ytaz, Double_t ztaz, Double_t shad_noise)
Determines whether the center of the triangle in 3-d space given by function parameters: -xtaz...
TCanvas * style()
Definition: style.C:1
Double_t y[n]
Definition: legend1.C:17
The color creation and management class.
Definition: TColor.h:23
void SetChanGrid(Int_t enable, Int_t color)
This function sets enables/disables drawing of channel grid and sets its color: -enable - decides whe...
Draw Ellipses.
Definition: TEllipse.h:44
virtual void SetLineStyle(Style_t lstyle)
Definition: TAttLine.h:56
Bool_t IsNull() const
Definition: TString.h:387
void GetBezier(Int_t &bezier)
Gets Bezier smoothing switch: -bezier - determines Bezier interpolation (applies only for simple disp...
void SetLightHeightWeight(Double_t weight)
Sets weight between shading according to fictive light source and according to channels counts: -weig...
void Paint(Option_t *option)
Paints histogram according to preset parameters.
void SetColorIncrements(Double_t r, Double_t g, Double_t b)
Sets color increments between two color levels for r, g, b components: -r, g, b - color increments be...
void SetNodes(Int_t nodesx, Int_t nodesy)
Sets nodes in both directions: -nodesx, nodesy, only the bins at the nodes points are displayed...
virtual void Paint(Option_t *chopt="")
Draw this axis with its current attributes.
Definition: TGaxis.cxx:684
double f2(const double *x)
void SetLightPosition(Int_t x, Int_t y, Int_t z)
Sets position of fictive light source in 3D space: -x, y, z.
Short_t Max(Short_t a, Short_t b)
Definition: TMathBase.h:202
1-Dim function class
Definition: TF1.h:149
void SetColorAlgorithm(Int_t colorAlgorithm)
Sets shading color algorithm: -colorAlgorithm - applies only for rainbowed display modes (rgb smooth ...
TF1 * f1
Definition: legend1.C:11
Float_t GetLabelOffset() const
Definition: TGaxis.h:92
virtual Double_t GetBinContent(Int_t bin) const
Return content of bin number bin.
Definition: TH2.h:90
#define gPad
Definition: TVirtualPad.h:288
Int_t Atoi() const
Return integer value of string.
Definition: TString.cxx:1964
Double_t Atof() const
Return floating-point value contained in string.
Definition: TString.cxx:2030
Definition: Rtypes.h:61
double exp(double)
void Slice(Double_t xr, Double_t yr, Double_t xs, Double_t ys, TLine *line)
Calculates screen coordinates of the line given by two nodes for contours display mode...
void GetZScale(Int_t &scale)
Gets z-axis scale: -scale - it can be linear, sqrt or log.
Float_t GetTickSize() const
Definition: TGaxis.h:103
Double_t GetXmax() const
Definition: TAxis.h:138
double log(double)
TAxis * GetXaxis()
Definition: TH1.h:319
Int_t BezC(Int_t i)
This function is called from BezierBlend function.
void SetZScale(Int_t scale)
Sets z-axis scale: -scale - linear, sqrt or log.
static const double x3[11]
const char * Data() const
Definition: TString.h:349