This macro is testing the "compacting" algorithm in TPadPainter.
It reduces the number of polygon's vertices using actual pixel coordinates.
It's not really useful, but just to test that the resulting polygon is still reasonable. Initial number of points is 1000000, after "compression" it's 523904 (with default canvas size, before you tried to resize it) - so almost half of vertices were removed but you can still see the reasonable shape. If you resize a canvas to a smaller size, the number of vertices after compression can be something like 5000 and even less. It's easy to 'fool' this algorithm though in this particular case (ellipse is a kind of fringe case, you can easily have a sequence of almost unique vertices (at a pixel level).
#include <cassert>
#include <vector>
public:
private:
enum {
};
std::vector<Double_t> fXs;
std::vector<Double_t> fYs;
};
:
TNamed(
"polygon_compression_test1",
"polygon_compression_test1")
{
}
{
}
for (
unsigned i = 0; i <
nVertices - 1; ++i) {
}
}
void PolyTest1::Paint(
const Option_t * )
{
gPad->PaintFillArea((
Int_t)fXs.size(), &fXs[0], &fYs[0]);
gPad->PaintPolyLine((
Int_t)fXs.size(), &fXs[0], &fYs[0]);
}
{
}
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
void Warning(const char *location, const char *msgfmt,...)
Use this function in warning situations.
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 angle
R__EXTERN TRandom * gRandom
Fill Area Attributes class.
virtual void Modify()
Change current fill area attributes if necessary.
virtual void Modify()
Change current line attributes if necessary.
The TNamed class is the base class for all named ROOT classes.
Double_t Rndm() override
Machine independent random number generator.
Short_t Min(Short_t a, Short_t b)
Returns the smallest of a and b.
Double_t Cos(Double_t)
Returns the cosine of an angle of x radians.
Double_t Sin(Double_t)
Returns the sine of an angle of x radians.
constexpr Double_t TwoPi()
- Author
- Timur Pocheptsov
Definition in file polytest1.C.