Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members  

Utils.h

Go to the documentation of this file.
00001 
00048 #ifndef _AMIRE_COMMON_UTILS_H
00049 #define _AMIRE_COMMON_UTILS_H
00050 
00051 #include <amire/common/Defines.h>
00052 #include <amire/common/Vector.h>
00053 
00054 #include <float.h>
00055 
00056 namespace amire {
00057   namespace common {
00061     unsigned char *loadTGA (char *filename, int &width, int &height, int &format);
00062 
00066     void AMIRE_IMPORT_API setCapability(GLenum capability, GLboolean enabled, GLboolean *backupCapability);
00067 
00071     void AMIRE_IMPORT_API setCapability(GLenum capability, GLboolean enabled);
00072 
00076     void AMIRE_IMPORT_API drawBackgroundImage(const unsigned char *imageData, int imageDataFormat, int bytesPerPixel, int imageWidth, int imageHeight, int viewPortX, int viewPortY, int viewPortWidth, int viewPortHeight, bool mirrorHorizonal, bool mirrorVertical);
00077 
00081     void AMIRE_IMPORT_API drawArrow(GLUquadric *quadric, double arrowLength, double pikeLength, double arrowRadius, double pikeRadius);
00082 
00086     void AMIRE_IMPORT_API drawArrow(double arrowLength, double pikeLength, double arrowRadius, double pikeRadius);
00087 
00091     void AMIRE_IMPORT_API drawArrow(const Vector &source, const Vector &destination, double arrowLength = 1.0, double pikeLength = 0.3, double arrowRadius = 0.03, double pikeRadius = 0.09, bool scaleWholeArrow = false);
00092 
00096     void AMIRE_IMPORT_API drawCoordinateSystem(GLUquadric *quadric, double arrowLength, double pikeLength, double arrowRadius, double pikeRadius);
00097 
00101     void AMIRE_IMPORT_API drawCoordinateSystem(double arrowLength, double pikeLength, double arrowRadius, double pikeRadius);
00102 
00106     void AMIRE_IMPORT_API drawCoordinateSystem(double size);
00107 
00111     void AMIRE_IMPORT_API drawCoordinateSystem();
00112 
00116     bool AMIRE_IMPORT_API epsilonEqual(double value1, double value2, double epsilon = DBL_EPSILON);
00117 
00121     bool AMIRE_IMPORT_API epsilonEqual(float value1, float value2, float epsilon = FLT_EPSILON);
00122 
00126     bool AMIRE_IMPORT_API epsilonEqual(int value1, int value2, int epsilon = 0);
00127 
00131     bool AMIRE_IMPORT_API isBase2(int value, int &nextValue);
00132 
00136     bool AMIRE_IMPORT_API isBaseN(int base, int value, int &nextValue);
00137 
00141     int AMIRE_IMPORT_API binSearch(void **list, int listLength, void *param, int (*compare)(void *, void*));
00142 
00146     void AMIRE_IMPORT_API calculateBillboardMatrix(double *dest, const double *source);
00147 
00151     void AMIRE_IMPORT_API calculateBillboardMatrix(float *dest, const float *source);
00152 
00156     void AMIRE_IMPORT_API extractCoordinateSystem(const double *matrix, double *position, double *forward, double *up, double *side);
00157 
00161     void AMIRE_IMPORT_API extractCoordinateSystem(const float *matrix, float *position, float *forward, float *up, float *side);
00162 
00166     void AMIRE_IMPORT_API extractCoordinateSystem(const double *matrix, float *position, float *forward, float *up, float *side);
00167 
00171     void AMIRE_IMPORT_API extractCoordinateSystem(const float *matrix, double *position, double *forward, double *up, double *side);
00172 
00176     void AMIRE_IMPORT_API createOrientationMatrix(const double *forward, const double *up, double *orientation);
00177 
00181     void AMIRE_IMPORT_API createOrientationMatrix(const float *forward, const float *up, float *orientation);
00182 
00186     void AMIRE_IMPORT_API createOrientationMatrix(const double *forward, const double *up, float *orientation);
00187 
00191     void AMIRE_IMPORT_API createOrientationMatrix(const float *forward, const float *up, double *orientation);
00192 
00196     double AMIRE_IMPORT_API randScale();
00197 
00201     double AMIRE_IMPORT_API randRange(double firstLimit, double secondLimit);
00202 
00206     void AMIRE_IMPORT_API checkAndReportGlError(const std::string &label);
00207 
00211     void AMIRE_IMPORT_API integerToString(int value, std::string &destination);
00212 
00216     void AMIRE_IMPORT_API longToString(long value, std::string &destination);
00217 
00221     void AMIRE_IMPORT_API floatToString(float value, std::string &destination, int digitsAfterComma);
00222 
00226     void AMIRE_IMPORT_API doubleToString(double value, std::string &destination, int digitsAfterComma);
00227 
00231     void AMIRE_IMPORT_API dumpGLSettings(std::ostream &out);
00232 
00236     void AMIRE_IMPORT_API drawQuader(double width, double height, double depth);
00237 
00238     class BoundingSphere;
00239     class AABoundingBox;
00240     class OrientedBoundingBox;
00241     class BoundingVolume;
00242 
00246     void AMIRE_IMPORT_API drawBoundingVolume(const BoundingSphere *sphere, double scale);
00247 
00251     void AMIRE_IMPORT_API drawBoundingVolume(const AABoundingBox *box, double scale);
00252 
00256     void AMIRE_IMPORT_API drawBoundingVolume(const OrientedBoundingBox *box, double scale);
00257 
00261     void AMIRE_IMPORT_API drawBoundingVolume(const BoundingVolume *volume, double scale);
00262 
00263 /*
00264     AMIRE_EXPORT_API inline std::string &operator+=(std::string &first, const std::string &second) {
00265       return first.append(second);
00266     }
00267 
00268     AMIRE_EXPORT_API inline std::string &operator+=(std::string &first, char *second) {
00269       return first.append(second);
00270     }
00271 
00272     AMIRE_EXPORT_API inline std::string &operator+=(std::string &first, char second) {
00273       first.push_back(second);
00274       return first;
00275     }
00276 */
00277 
00281     AMIRE_EXPORT_API inline std::string &operator+=(std::string &first, int value) {
00282       std::string second;
00283       integerToString(value, second);
00284       return first.append(second);
00285     }
00286 
00290     AMIRE_EXPORT_API inline std::string &operator+=(std::string &first, long value) {
00291       std::string second;
00292       longToString(value, second);
00293       return first.append(second);
00294     }
00295 
00299     AMIRE_EXPORT_API inline std::string &operator+=(std::string &first, float value) {
00300       std::string second;
00301       floatToString(value, second, 3);
00302       return first.append(second);
00303     }
00304 
00308     AMIRE_EXPORT_API inline std::string &operator+=(std::string &first, double value) {
00309       std::string second;
00310       doubleToString(value, second, 3);
00311       return first.append(second);
00312     }
00313 
00317     AMIRE_EXPORT_API inline std::string operator+(const std::string &first, const std::string &second) {
00318       return std::string(first).append(second);
00319     }
00320 
00324     AMIRE_EXPORT_API inline std::string operator+(const std::string &first, char *second) {
00325       return std::string(first).append(second);
00326     }
00327 
00331     AMIRE_EXPORT_API inline std::string operator+(const std::string &first, char second) {
00332       std::string result(first);
00333       result.push_back(second);
00334       return result;
00335     }
00336 
00340     AMIRE_EXPORT_API inline std::string operator+(const std::string &first, int value) {
00341       std::string result(first);
00342       result += value;
00343       return result;
00344     }
00345 
00349     AMIRE_EXPORT_API inline std::string operator+(const std::string &first, long value) {
00350       std::string result(first);
00351       result += value;
00352       return result;
00353     }
00354 
00358     AMIRE_EXPORT_API inline std::string operator+(const std::string &first, float value) {
00359       std::string result(first);
00360       result += value;
00361       return result;
00362     }
00363 
00367     AMIRE_EXPORT_API inline std::string operator+(const std::string &first, double value) {
00368       std::string result(first);
00369       result += value;
00370       return result;
00371     }
00372 
00376     AMIRE_EXPORT_API inline std::string operator+(char *first, const std::string &second) {
00377       return std::string(first).append(second);
00378     }
00379 
00383     AMIRE_EXPORT_API inline std::string operator+(char value, const std::string &second) {
00384       std::string result;
00385       result.push_back(value);
00386       return result.append(second);
00387     }
00388 
00392     AMIRE_EXPORT_API inline std::string operator+(int value, const std::string &second) {
00393       std::string result;
00394       result += value;
00395       result.append(second);
00396       return result;
00397     }
00398 
00402     AMIRE_EXPORT_API inline std::string operator+(long value, const std::string &second) {
00403       std::string result;
00404       result += value;
00405       result.append(second);
00406       return result;
00407     }
00408 
00412     AMIRE_EXPORT_API inline std::string operator+(float value, const std::string &second) {
00413       std::string result;
00414       result += value;
00415       result.append(second);
00416       return result;
00417     }
00418 
00422     AMIRE_EXPORT_API inline std::string operator+(double value, const std::string &second) {
00423       std::string result;
00424       result += value;
00425       result.append(second);
00426       return result;
00427     }
00428 
00429 // TODO
00430 //    AMIRE_EXPORT_API std::string &operator-=(std::string &first, const std::string &second);
00431 //    AMIRE_EXPORT_API std::string &operator-(const std::string &first, const std::string &second);
00432   }
00433 }
00434 #endif

Generated on Tue May 20 17:23:54 2003 for AMIRE-Framework by doxygen1.3