29 double fX[3] = {0, 0, 0};
30 double fY[3] = {0, 0, 0};
35 TTriangle(
const char *
name,
const char *title =
"") : TNamed(
name, title) {}
37 void SetPoints(
double x1,
double y1,
double x2,
double y2,
double x3,
double y3)
56 gPad->PaintFillAreaNDC(3, fX, fY, opt);
58 gPad->PaintPolyLineNDC(3, fX, fY, opt);
64void triangle(
bool ignore_jsmodule =
false)
66 if (ignore_jsmodule) {
67 printf(
"Custom JS module will NOT be provided for TTriangle class\n");
68 printf(
"No interactive features will be available\n");
69 printf(
"TTriangle::Paint() method will be used for object painting - also in web case\n");
72 printf(
"Please run this script in compiled mode by running \".x triangle.cxx+\"\n");
73 printf(
"Requires to properly generate dictionary for TTriangle class\n");
77 std::string fdir = __FILE__;
78 auto pos = fdir.find(
"triangle.cxx");
79 if (pos != std::string::npos)
82 fdir =
gROOT->GetTutorialsDir() + std::string(
"/visualisation/webcanv/");
96 auto tr1 =
new TTriangle(
"tr1",
"first triangle");
97 tr1->SetPoints(0.4, 0.5, 0.8, 0.3, 0.8, 0.7);
98 tr1->SetLineColor(
kRed);
100 tr1->SetFillColor(
kBlue);
102 auto tr2 =
new TTriangle(
"tr2",
"second triangle");
103 tr2->SetPoints(0.2, 0.2, 0.2, 0.6, 0.5, 0.4);
104 tr2->SetLineColor(
kGreen);
108 auto tr3 =
new TTriangle(
"tr3",
"third triangle");
109 tr3->SetPoints(0.4, 0.8, 0.6, 0.8, 0.5, 0.2);
110 tr3->SetLineColor(
kCyan);
113 auto c1 =
new TCanvas(
"c1",
"Triangles");
const char Option_t
Option string (const char).
#define ClassDefOverride(name, id)
static void AddServerLocation(const std::string &server_prefix, const std::string &files_path)
Configure server location which can be used for loading of custom scripts or files When THttpServer i...
The TNamed class is the base class for all named ROOT classes.
virtual void Paint(Option_t *option="")
This method must be overridden if a class wants to paint itself.
static void AddCustomClass(const std::string &clname, bool with_derived=false)
Assign custom class.
static void SetCustomScripts(const std::string &src)
Configures custom script for canvas.