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