47const char *kRuler =
"Ill1 OQ08 //\\\\ ..";
52const char *kFonts[] = {
"LiberationSerif-Regular",
"LiberationMono-Regular",
"verdana",
53 "georgia",
"comic",
"comicbd",
56const int kNFonts =
sizeof(kFonts) /
sizeof(
char *);
59const float kSizes[] = {0.005f, 0.008f, 0.012f, 0.018f, 0.024f, 0.033f, 0.045f, 0.060f};
60const int kNSizes =
sizeof(kSizes) /
sizeof(
float);
62const double kWorldLim = 100.0;
64std::map<std::string, REveElement *> gPanels;
77 t->SetDrawFrame(
false);
78 holder->AddElement(t);
84static void AddBBoxAnchor(
REveElement *holder,
double lim)
87 const double v[8][3] = {{-1, -1, -1}, {-1, 1, -1}, {1, 1, -1}, {1, -1, -1},
88 {-1, -1, 1}, {-1, 1, 1}, {1, 1, 1}, {1, -1, 1}};
89 for (
int i = 0; i < 8; ++i)
90 b->SetVertex(i, lim *
v[i][0], lim *
v[i][1], lim *
v[i][2]);
92 b->SetMainTransparency(90);
93 holder->AddElement(
b);
100 for (
int i = 0; i < kNSizes; ++i) {
102 auto t = MakeText(
h,
Form(
"A_%02d_size_%.3f", i, s),
Form(
"%.3f %s", s, kRuler),
"LiberationSerif-Regular", 1, s,
105 y -= 2.2 * s + 0.012;
113 for (
int i = 0; i < kNFonts; ++i) {
114 auto t = MakeText(
h,
Form(
"B_%02d_%s", i, kFonts[i]),
Form(
"%s %s", kRuler, kFonts[i]), kFonts[i], 1, 0.018f,
124 AddBBoxAnchor(
h, kWorldLim);
125 float y = -kWorldLim + 10.0;
126 for (
int i = 0; i < kNSizes; ++i) {
127 float s = 200.0 * kSizes[i];
128 auto t = MakeText(
h,
Form(
"C_%02d_size_%.1f", i, s),
Form(
"%.1f %s", s, kRuler),
"LiberationSerif-Regular", 0, s,
130 t->RefMainTrans().SetPos(-kWorldLim,
y, 0.0);
138 AddBBoxAnchor(
h, kWorldLim);
140 const int angles[] = {0, 20, 40, 60, 75};
141 for (
int i = 0; i < 5; ++i) {
142 auto t = MakeText(
h,
Form(
"D_rotY_%02d", angles[i]),
Form(
"Y%02d %s", angles[i], kRuler),
143 "LiberationSerif-Regular", 0, 8.0f,
kGreen + 3);
144 auto &tr = t->RefMainTrans();
145 tr.SetPos(-kWorldLim, 20.0 * i + 10.0, 0.0);
146 tr.SetRotByAngles(0.0, angles[i] * d2r, 0.0);
148 for (
int i = 0; i < 5; ++i) {
149 auto t = MakeText(
h,
Form(
"D_rotX_%02d", angles[i]),
Form(
"X%02d %s", angles[i], kRuler),
150 "LiberationSerif-Regular", 0, 8.0f,
kMagenta + 2);
151 auto &tr = t->RefMainTrans();
152 tr.SetPos(-kWorldLim, -20.0 * i - 10.0, 0.0);
153 tr.SetRotByAngles(angles[i] * d2r, 0.0, 0.0);
162 AddBBoxAnchor(
h, kWorldLim);
163 for (
int i = 0; i < 5; ++i) {
164 double z = -kWorldLim + i * (2.0 * kWorldLim / 4.0);
165 auto t = MakeText(
h,
Form(
"E_%02d_z_%+.0f", i, z),
Form(
"z%+.0f %s", z, kRuler),
"LiberationSerif-Regular", 2,
167 t->RefMainTrans().SetPos(-kWorldLim, -kWorldLim + i * 45.0, z);
175void tg_only(
const char *panel =
"")
178 std::string want(panel);
179 for (
auto &[
name, el] : gPanels) {
180 bool on = want.empty() ||
name == want;
182 el->SetRnrChildren(
on);
191void texts_grid(
const char *panels =
"ABCDE")
193 std::string want(panels);
194 auto eveMng = REveManager::Create();
195 eveMng->AllowMultipleRemoteConnections(
false,
false);
200 for (
int i = 0; i < kNFonts; ++i)
201 REveText::AssertSdfFont(kFonts[i], rf + kFonts[i] +
".ttf");
205 auto *scScreen = eveMng->SpawnNewScene(
"Screen text",
"Panels A, B -- screen mode");
206 auto *scWorld = eveMng->SpawnNewScene(
"World text",
"Panels C, D -- world mode");
207 auto *scMixed = eveMng->SpawnNewScene(
"Mixed text",
"Panel E -- mixed mode");
211 {
"A",
"A_screen_size_ladder", scScreen, PanelA},
212 {
"B",
"B_screen_fonts", scScreen, PanelB},
213 {
"C",
"C_world_size_ladder", scWorld, PanelC},
214 {
"D",
"D_world_rotation_fan", scWorld, PanelD},
215 {
"E",
"E_mixed_depth_ladder", scMixed, PanelE},
218 for (
auto &
d : defs) {
219 if (want.find(
d.key) == std::string::npos)
223 d.scene->AddElement(
h);
229 auto *
v0 = (
REveViewer *)eveMng->GetViewers()->FirstChild();
230 v0->SetName(
"Perspective");
231 v0->SetCameraType(REveViewer::kCameraPerspXOY);
232 auto *
v1 = eveMng->SpawnNewViewer(
"Orthographic",
"Same scenes, ortho camera");
233 v1->SetCameraType(REveViewer::kCameraOrthoXOY);
235 for (
auto *
v : {
v0,
v1}) {
236 v->AddScene(scScreen);
237 v->AddScene(scWorld);
238 v->AddScene(scMixed);
239 v->SetAxesType(REveViewer::kAxesEdge);
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
short Color_t
Color number (short)
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void on
Option_t Option_t TPoint TPoint const char mode
char * Form(const char *fmt,...)
Formats a string in a circular formatting buffer.
3D box with arbitrary vertices (cuboid).
Base class for REveUtil visualization elements, providing hierarchy management, rendering control and...
RAII guard for locking Eve manager (ctor) and processing changes (dtor).
Eve representation of TGLScene.
Eve representation of a GL view.
static const TString & GetDataDir()
Get the data directory in the installation. Static utility function.
Namespace for ROOT features in testing.