main.cpp

changeset 18
a6732098fed8
parent 13
3955ff2a7d72
child 23
69a91c1ff583
equal deleted inserted replaced
17:5606eebd0b90 18:a6732098fed8
1 #include <QApplication> 1 #include <QApplication>
2 #include "gui.h" 2 #include "gui.h"
3 #include "io.h" 3 #include "io.h"
4 #include "bbox.h" 4 #include "bbox.h"
5 #include "misc.h"
5 6
6 vector<OpenFile*> g_LoadedFiles; 7 vector<OpenFile*> g_LoadedFiles;
7 OpenFile* g_CurrentFile = NULL; 8 OpenFile* g_CurrentFile = NULL;
8 LDForgeWindow* g_qWindow = NULL; 9 LDForgeWindow* g_qWindow = NULL;
9 bbox g_BBox; 10 bbox g_BBox;
28 mid.y = (y + other.y); 29 mid.y = (y + other.y);
29 mid.z = (z + other.z); 30 mid.z = (z + other.z);
30 return mid; 31 return mid;
31 } 32 }
32 33
33 static str getCoordinateRep (double fCoord) { 34 str vertex::getStringRep (const bool bMangled) {
34 str zRep = str::mkfmt ("%.3f", fCoord); 35 const char* sFormat = (bMangled) ? "(%s, %s, %s)" : "%s %s %s";
35 36
36 // Remove trailing zeroes 37 return str::mkfmt (sFormat,
37 while (zRep[~zRep - 1] == '0') 38 ftoa (x).chars(),
38 zRep -= 1; 39 ftoa (y).chars(),
39 40 ftoa (z).chars());
40 // If there was only zeroes in the decimal place, remove
41 // the decimal point now.
42 if (zRep[~zRep - 1] == '.')
43 zRep -= 1;
44
45 return zRep;
46 }
47
48 str vertex::getStringRep () {
49 return str::mkfmt ("(%s, %s, %s)",
50 getCoordinateRep (x).chars(),
51 getCoordinateRep (y).chars(),
52 getCoordinateRep (z).chars());
53 } 41 }
54 42
55 // ============================================================================= 43 // =============================================================================
56 // void logVA (logtype_e, const char*, va_list) [static] 44 // void logVA (logtype_e, const char*, va_list) [static]
57 // 45 //

mercurial