50 int limit =
sizeof(vertices) /
sizeof(
UVector3);
51 for (
int i = 0 ; i < limit; i++)
58 if (current.
x > max.
x) max.
x = current.
x;
59 if (current.
x < min.
x) min.
x = current.
x;
61 if (current.
y > max.
y) max.
y = current.
y;
62 if (current.
y < min.
y) min.
y = current.
y;
64 if (current.
z > max.
z) max.
z = current.
z;
65 if (current.
z < min.
z) min.
z = current.
z;
72 double number = (double) rand() / RAND_MAX;
73 double res = min + number * (max -
min);
79 ofstream
file(filename.c_str());
84 int size = vector.size();
86 for (
int i = 0; i < size; i++)
88 double value = vector[i];
89 file << value <<
"\n";
99 ofstream
file(filename.c_str());
103 int size = vector.size();
104 for (
int i = 0; i < size; i++)
106 int value = vector[i];
107 file << value <<
"\n";
116 ofstream
file(filename.c_str());
120 int size = vector.size();
122 for (
int i = 0; i < size; i++)
125 file << vec.
x <<
"\t" << vec.
y <<
"\t" << vec.
z <<
"\n";
134 std::stringstream ss;
141 std::stringstream ss;
148 std::streampos fsize = 0;
149 std::ifstream
file(filePath.c_str(), std::ios::binary);
151 fsize =
file.tellg();
152 file.seekg(0, std::ios::end);
153 fsize =
file.tellg() - fsize;
162 int sleng = haystack.length();
163 int nleng = needle.length();
165 if (sleng == 0 || nleng == 0)
168 for (
int i = 0, j = 0; i < sleng; j = 0, i++)
170 while (i + j < sleng && j < nleng && haystack[i + j] == needle[j])
178 const char* exceptionCode,
181 const char* description)
184 bool toBeAborted =
true;
185 static const std::string es_banner
186 =
"\n-------- EEEE ------- UException-START -------- EEEE -------\n";
187 static const std::string ee_banner
188 =
"\n-------- EEEE ------- UException-END --------- EEEE -------\n";
189 static const std::string ws_banner
190 =
"\n-------- WWWW ------- UException-START -------- WWWW -------\n";
191 static const std::string we_banner
192 =
"\n-------- WWWW -------- UException-END --------- WWWW -------\n";
193 std::ostringstream message;
194 message <<
"\n*** ExceptionHandler is not defined ***\n"
195 <<
"*** Exception : " << exceptionCode << std::endl
196 <<
" issued by : " << originOfException << std::endl
197 << description << std::endl;
201 std::cerr << es_banner << message.str() <<
"*** Fatal Exception ***"
202 << ee_banner << std::endl;
205 std::cerr << es_banner << message.str() <<
"*** Fatal Error In Argument ***"
206 << ee_banner << std::endl;
209 std::cerr << es_banner << message.str() <<
"*** Error ***" << level
210 << ee_banner << std::endl;
213 std::cerr << ws_banner << message.str() <<
"*** This is just a warning message ***"
214 << we_banner << std::endl;
218 std::cout << ws_banner << message.str()
219 <<
"*** This is just a message for your information. ***"
220 << we_banner << std::endl;
228 std::cerr << std::endl <<
"*** GException: Aborting execution ***" << std::endl;
int FileSize(const std::string &filePath)
void Set(double xx, double yy, double zz)
T max(const T t1, const T t2)
brief Return the largest of the two arguments
T min(const T t1, const T t2)
brief Return the smallest of the two arguments
int SaveVectorToExternalFile(const std::vector< double > &vector, const std::string &filename)
const XML_Char int const XML_Char * value
void Exception(const char *originOfException, const char *exceptionCode, ExceptionSeverity severity, int level, const char *description)
std::string ToString(int number)
int StrPos(const std::string &haystack, const std::string &needle)
double Random(double min=0.0, double max=1.0)
void TransformLimits(UVector3 &min, UVector3 &max, const UTransform3D &transformation)