33TH2F *last_histo =
nullptr;
35void mygenerate(
double factor,
double cen_x,
double cen_y)
37 printf(
"Regenerating...\n");
42 last_histo->
SetBins(last_histo->
GetNbinsX(), cen_x - factor * dx / 2, cen_x + factor * dx / 2,
43 last_histo->
GetNbinsY(), cen_y - factor * dy / 2, cen_y + factor * dy / 2);
49 last_histo =
new TH2F(
"h2",
"Mandelbrot [move mouse and press z to zoom, u to unzoom, r to reset]", 200, -2, 2,
53 const int max_iter = 50;
54 for (
int bx = 1; bx <= last_histo->
GetNbinsX(); bx++)
55 for (
int by = 1; by <= last_histo->
GetNbinsY(); by++) {
70 last_histo->
Draw(
"colz");
79 int event =
gPad->GetEvent();
80 int px =
gPad->GetEventX();
81 int py =
gPad->GetEventY();
84 double xd =
gPad->AbsPixeltoX(px);
85 double yd =
gPad->AbsPixeltoY(py);
86 float x =
gPad->PadtoX(xd);
87 float y =
gPad->PadtoY(yd);
101 mygenerate(1. / Z, last_x, last_y);
104 mygenerate(Z, last_x, last_y);
107 mygenerate(-1, last_x, last_y);
117 new TCanvas(
"canvas",
"View Mandelbrot set");
119 mygenerate(-1, 0, 0);
122 gPad->AddExec(
"myexec",
"myexec()");
R__EXTERN TStyle * gStyle
virtual Double_t GetBinCenter(Int_t bin) const
Return center of bin.
virtual Int_t GetNbinsY() const
virtual Int_t GetNbinsX() const
void Draw(Option_t *option="") override
Draw this histogram with options.
virtual void SetContour(Int_t nlevels, const Double_t *levels=nullptr)
Set the number and values of contour levels.
virtual void SetBins(Int_t nx, Double_t xmin, Double_t xmax)
Redefine x axis parameters.
virtual void SetStats(Bool_t stats=kTRUE)
Set statistics option on/off.
2-D histogram with a float per channel (see TH1 documentation)
void Reset(Option_t *option="") override
Reset this histogram: contents, errors, etc.
Int_t Fill(Double_t) override
Invalid Fill method.
void SetPadGridX(Bool_t gridx)
void SetPadGridY(Bool_t gridy)