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