33 PolyTest1(
unsigned nVertices);
36 void Reset(
unsigned nVertices);
40 kNPointsDefault = 10000
43 std::vector<Double_t> fXs;
44 std::vector<Double_t> fYs;
48 PolyTest1::PolyTest1(
unsigned nVertices)
49 :
TNamed(
"polygon_compression_test1",
"polygon_compression_test1")
62 if (nVertices < kNPointsDefault) {
63 Warning(
"Reset",
"resetting nVertices parameter to %u",
unsigned(kNPointsDefault));
64 nVertices = kNPointsDefault;
67 fXs.resize(nVertices);
68 fYs.resize(nVertices);
70 Double_t xMin = 0., xMax = 0., yMin = 0., yMax = 0.;
71 gPad->GetRange(xMin, yMin, xMax, yMax);
72 assert(xMax - xMin > 0 && yMax - yMin > 0 &&
"Reset, invalid canvas' ranges");
74 const Double_t xCentre = xMin + 0.5 * (xMax - xMin);
75 const Double_t yCentre = yMin + 0.5 * (yMax - yMin);
80 for (
unsigned i = 0; i < nVertices - 1; ++i) {
82 fXs[i] = xCentre + currR *
TMath::Cos(angle * i);
83 fYs[i] = yCentre + currR *
TMath::Sin(angle * i);
86 fXs[nVertices - 1] = fXs[0];
87 fYs[nVertices - 1] = fYs[0];
91 void PolyTest1::Paint(
const Option_t * )
96 gPad->PaintFillArea((
Int_t)fXs.size(), &fXs[0], &fYs[0]);
99 gPad->PaintPolyLine((
Int_t)fXs.size(), &fXs[0], &fYs[0]);
107 PolyTest1 * polygon =
new PolyTest1(1000000);
108 polygon->SetLineColor(
kBlue);
109 polygon->SetFillColor(
kRed);
110 polygon->SetLineWidth(1);
virtual Double_t Rndm(Int_t i=0)
Machine independent random number generator.
TVirtualPad * cd(Int_t subpadnumber=0)
Set current canvas & pad.
Short_t Min(Short_t a, Short_t b)
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.
void Reset(Detail::TBranchProxy *x)
void Warning(const char *location, const char *msgfmt,...)
R__EXTERN TRandom * gRandom
virtual void Paint(Option_t *option="")
This method must be overridden if a class wants to paint itself.