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