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