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