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)
55 gPad->PaintFillAreaNDC(3, fX, fY, opt);
57 gPad->PaintPolyLineNDC(3, fX, fY, opt);
63void triangle(
bool ignore_jsmodule =
false)
65 if (ignore_jsmodule) {
66 printf(
"Custom JS module will NOT be provided for TTriangle class\n");
67 printf(
"No interactive features will be available\n");
68 printf(
"TTriangle::Paint() method will be used for object painting - also in web case\n");
71 printf(
"Please run this script in compiled mode by running \".x triangle.cxx+\"\n");
72 printf(
"Requires to properly generate dictionary for TTriangle class\n");
76 std::string fdir = __FILE__;
77 auto pos = fdir.find(
"triangle.cxx");
78 if (pos != std::string::npos)
81 fdir =
gROOT->GetTutorialsDir() + std::string(
"/webcanv/");
95 auto tr1 =
new TTriangle(
"tr1",
"first triangle");
96 tr1->SetPoints(0.4, 0.5, 0.8, 0.3, 0.8, 0.7);
97 tr1->SetLineColor(
kRed);
99 tr1->SetFillColor(
kBlue);
101 auto tr2 =
new TTriangle(
"tr2",
"second triangle");
102 tr2->SetPoints(0.2, 0.2, 0.2, 0.6, 0.5, 0.4);
103 tr2->SetLineColor(
kGreen);
107 auto tr3 =
new TTriangle(
"tr3",
"third triangle");
108 tr3->SetPoints(0.4, 0.8, 0.6, 0.8, 0.5, 0.2);
109 tr3->SetLineColor(
kCyan);
112 auto c1 =
new TCanvas(
"c1",
"Triangles");
#define ClassDefOverride(name, id)
Option_t Option_t TPoint TPoint const char x2
Option_t Option_t TPoint TPoint const char x1
Option_t Option_t TPoint TPoint const char y2
Option_t Option_t TPoint TPoint const char y1
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...
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.
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.