38 std::vector<Double_t> fXs1;
39 std::vector<Double_t> fYs1;
42 std::vector<Double_t> fXs2;
43 std::vector<Double_t> fYs2;
47 PolyTest2::PolyTest2()
48 :
TNamed(
"polygon_compression_test2",
"polygon_compression_test2")
54 assert(
gPad != 0 &&
"PolyTest2, gPad is null");
58 Double_t xMin = 0., xMax = 0., yMin = 0., yMax = 0.;
59 gPad->GetRange(xMin, yMin, xMax, yMax);
60 assert(xMax - xMin > 0 && yMax - yMin > 0 &&
"PolyTest2, invalid canvas' ranges");
69 const unsigned nVertices = 3 + kNSawPoints;
73 fXs1.resize(nVertices);
74 fYs1.resize(nVertices);
79 const Double_t w1 = 0.2 * (xMax - xMin);
80 const Double_t saw1ToothSize = 0.1 * w1;
81 const Double_t yStep = (yMax - yMin) / (kNSawPoints - 1);
83 for (
unsigned i = 1; i <= kNSawPoints; ++i) {
85 fYs1[i] = yMin + yStep * (i - 1);
88 fXs1[nVertices - 2] = 0.;
89 fYs1[nVertices - 2] = yMax;
91 fXs1[nVertices - 1] = fXs1[0];
92 fYs1[nVertices - 1] = fYs1[0];
99 const Double_t x2Min = xMin + 0.25 * (xMax - xMin);
100 const Double_t h2 = 0.1 * (yMax - yMin);
102 const Double_t xStep = (xMax - x2Min) / (kNSawPoints - 1);
104 fXs2.resize(nVertices);
105 fYs2.resize(nVertices);
110 for (
unsigned i = 1; i <= kNSawPoints; ++i) {
111 fXs2[i] = x2Min + xStep * i;
115 fXs2[nVertices - 2] = xMax;
116 fYs2[nVertices - 2] = 0.;
117 fXs2[nVertices - 1] = fXs2[0];
118 fYs2[nVertices - 1] = fYs2[0];
123 void PolyTest2::Paint(
const Option_t * )
129 gPad->PaintFillArea((
Int_t)fXs1.size(), &fXs1[0], &fYs1[0]);
133 gPad->PaintPolyLine((
Int_t)fXs1.size(), &fXs1[0], &fYs1[0]);
137 gPad->PaintFillArea((
Int_t)fXs2.size(), &fXs2[0], &fYs2[0]);
141 gPad->PaintPolyLine((
Int_t)fXs2.size(), &fXs2[0], &fYs2[0]);
149 PolyTest2 * polygon =
new PolyTest2;
virtual Double_t Rndm(Int_t i=0)
Machine independent random number generator.
TVirtualPad * cd(Int_t subpadnumber=0)
Set current canvas & pad.
virtual void Modify()
Change current line attributes if necessary.
Fill Area Attributes class.
The TNamed class is the base class for all named ROOT classes.
virtual void Modify()
Change current fill area attributes if necessary.
R__EXTERN TRandom * gRandom
virtual void Paint(Option_t *option="")
This method must be overridden if a class wants to paint itself.