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 // |