MCPcopy Create free account
hub / github.com/brenocq/implot3d / NiceNum

Function NiceNum

implot3d.cpp:1360–1383  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1358//------------------------------------------------------------------------------
1359
1360double NiceNum(double x, bool round) {
1361 double f;
1362 double nf;
1363 int expv = (int)floor(ImLog10(x));
1364 f = x / ImPow(10.0, (double)expv);
1365 if (round)
1366 if (f < 1.5)
1367 nf = 1;
1368 else if (f < 3)
1369 nf = 2;
1370 else if (f < 7)
1371 nf = 5;
1372 else
1373 nf = 10;
1374 else if (f <= 1)
1375 nf = 1;
1376 else if (f <= 2)
1377 nf = 2;
1378 else if (f <= 5)
1379 nf = 5;
1380 else
1381 nf = 10;
1382 return nf * ImPow(10.0, expv);
1383}
1384
1385void Locator_Default(ImPlot3DTicker& ticker, const ImPlot3DRange& range, float pixels, ImPlot3DFormatter formatter, void* formatter_data) {
1386 if (range.Min == range.Max)

Callers 1

Locator_DefaultFunction · 0.85

Calls 1

ImLog10Function · 0.85

Tested by

no test coverage detected