47const char *kRuler =
"Ill1 OQ08 //\\\\ ..";
53const char *kFonts[] = {
"LiberationSans-Regular",
"LiberationSans-Bold",
54 "LiberationSerif-Regular",
"LiberationSerif-Bold",
55 "LiberationMono-Regular",
"LiberationMono-Bold"};
57const int kNFonts =
sizeof(kFonts) /
sizeof(
char *);
60const float kSizes[] = {0.005f, 0.008f, 0.012f, 0.018f, 0.024f, 0.033f, 0.045f, 0.060f};
61const int kNSizes =
sizeof(kSizes) /
sizeof(
float);
63const double kWorldLim = 100.0;
65std::map<std::string, REveElement *> gPanels;
78 t->SetDrawFrame(
false);
79 holder->AddElement(t);
85static void AddBBoxAnchor(
REveElement *holder,
double lim)
88 const double v[8][3] = {{-1, -1, -1}, {-1, 1, -1}, {1, 1, -1}, {1, -1, -1},
89 {-1, -1, 1}, {-1, 1, 1}, {1, 1, 1}, {1, -1, 1}};
90 for (
int i = 0; i < 8; ++i)
91 b->SetVertex(i, lim *
v[i][0], lim *
v[i][1], lim *
v[i][2]);
93 b->SetMainTransparency(90);
94 holder->AddElement(
b);
101 for (
int i = 0; i < kNSizes; ++i) {
103 auto t = MakeText(
h,
Form(
"A_%02d_size_%.3f", i, s),
Form(
"%.3f %s", s, kRuler),
"LiberationSerif-Regular", 1, s,
106 y -= 2.2 * s + 0.012;
114 for (
int i = 0; i < kNFonts; ++i) {
115 auto t = MakeText(
h,
Form(
"B_%02d_%s", i, kFonts[i]),
Form(
"%s %s", kRuler, kFonts[i]), kFonts[i], 1, 0.018f,
125 AddBBoxAnchor(
h, kWorldLim);
126 float y = -kWorldLim + 10.0;
127 for (
int i = 0; i < kNSizes; ++i) {
128 float s = 200.0 * kSizes[i];
129 auto t = MakeText(
h,
Form(
"C_%02d_size_%.1f", i, s),
Form(
"%.1f %s", s, kRuler),
"LiberationSerif-Regular", 0, s,
131 t->RefMainTrans().SetPos(-kWorldLim,
y, 0.0);
139 AddBBoxAnchor(
h, kWorldLim);
141 const int angles[] = {0, 20, 40, 60, 75};
142 for (
int i = 0; i < 5; ++i) {
143 auto t = MakeText(
h,
Form(
"D_rotY_%02d", angles[i]),
Form(
"Y%02d %s", angles[i], kRuler),
144 "LiberationSerif-Regular", 0, 8.0f,
kGreen + 3);
145 auto &tr = t->RefMainTrans();
146 tr.SetPos(-kWorldLim, 20.0 * i + 10.0, 0.0);
147 tr.SetRotByAngles(0.0, angles[i] * d2r, 0.0);
149 for (
int i = 0; i < 5; ++i) {
150 auto t = MakeText(
h,
Form(
"D_rotX_%02d", angles[i]),
Form(
"X%02d %s", angles[i], kRuler),
151 "LiberationSerif-Regular", 0, 8.0f,
kMagenta + 2);
152 auto &tr = t->RefMainTrans();
153 tr.SetPos(-kWorldLim, -20.0 * i - 10.0, 0.0);
154 tr.SetRotByAngles(angles[i] * d2r, 0.0, 0.0);
163 AddBBoxAnchor(
h, kWorldLim);
164 for (
int i = 0; i < 5; ++i) {
165 double z = -kWorldLim + i * (2.0 * kWorldLim / 4.0);
166 auto t = MakeText(
h,
Form(
"E_%02d_z_%+.0f", i, z),
Form(
"z%+.0f %s", z, kRuler),
"LiberationSerif-Regular", 2,
168 t->RefMainTrans().SetPos(-kWorldLim, -kWorldLim + i * 45.0, z);
176void tg_only(
const char *panel =
"")
179 std::string want(panel);
180 for (
auto &[
name, el] : gPanels) {
181 bool on = want.empty() ||
name == want;
183 el->SetRnrChildren(
on);
192void texts_grid(
const char *panels =
"ABCDE")
194 std::string want(panels);
195 auto eveMng = REveManager::Create();
196 eveMng->AllowMultipleRemoteConnections(
false,
false);
202 for (
int i = 0; i < kNFonts; ++i)
203 REveText::AssertSdfFont(kFonts[i], rf + kFonts[i] +
".ttf");
207 auto *scScreen = eveMng->SpawnNewScene(
"Screen text",
"Panels A, B -- screen mode");
208 auto *scWorld = eveMng->SpawnNewScene(
"World text",
"Panels C, D -- world mode");
209 auto *scMixed = eveMng->SpawnNewScene(
"Mixed text",
"Panel E -- mixed mode");
213 {
"A",
"A_screen_size_ladder", scScreen, PanelA},
214 {
"B",
"B_screen_fonts", scScreen, PanelB},
215 {
"C",
"C_world_size_ladder", scWorld, PanelC},
216 {
"D",
"D_world_rotation_fan", scWorld, PanelD},
217 {
"E",
"E_mixed_depth_ladder", scMixed, PanelE},
220 for (
auto &
d : defs) {
221 if (want.find(
d.key) == std::string::npos)
225 d.scene->AddElement(
h);
231 auto *
v0 = (
REveViewer *)eveMng->GetViewers()->FirstChild();
232 v0->SetName(
"Perspective");
233 v0->SetCameraType(REveViewer::kCameraPerspXOY);
234 auto *
v1 = eveMng->SpawnNewViewer(
"Orthographic",
"Same scenes, ortho camera");
235 v1->SetCameraType(REveViewer::kCameraOrthoXOY);
237 for (
auto *
v : {
v0,
v1}) {
238 v->AddScene(scScreen);
239 v->AddScene(scWorld);
240 v->AddScene(scMixed);
241 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.