319 #error "GCC library must be compiled with C++ compilers" 322 #if !defined(_COUNTER_GCG_) 323 #define _COUNTER_GCG_ 1 327 #if _COUNTER_GCG_ == 1 329 #if defined(GCG_WINDOWS32) || defined(GCG_WINDOWS64) 332 #define GCG_API_FUNCTION extern __declspec(dllexport) 333 #define GCG_API_DATA extern __declspec(dllexport) 334 #define GCG_API_CLASS __declspec(dllexport) 335 #define GCG_API_TEMPLATE __declspec(dllexport) 338 #define GCG_API_FUNCTION extern 339 #define GCG_API_DATA extern 340 #define GCG_API_CLASS 341 #define GCG_API_TEMPLATE 346 #define GCG_API_FUNCTION extern __declspec(dllimport) 347 #define GCG_API_DATA extern __declspec(dllimport) 348 #define GCG_API_CLASS 349 #define GCG_API_TEMPLATE 352 #define GCG_API_FUNCTION extern 353 #define GCG_API_DATA extern 354 #define GCG_API_CLASS 355 #define GCG_API_TEMPLATE 363 #if defined(__GNUC__) || defined(MINGW) 369 typedef __int64 int64_t;
370 typedef unsigned __int64 uint64_t;
420 static inline int SQR(
int x) {
return x * x; }
430 static inline short SQR(
short x) {
return x * x; }
436 static inline long SQR(
long x) {
return x * x; }
442 static inline float SQR(
float x) {
return x * x; }
448 static inline double SQR(
double x) {
return x * x; }
456 #define MIN(a, b) ((a > b) ? (b) : (a)) 464 #define MAX(a, b) ((a < b) ? (b) : (a)) 472 #define ABS(a) (((a) < 0) ? -(a) : (a)) 481 #define SWAP(a, b) {(a) ^= (b); (b) ^= (a); (a) ^= (b);} 489 #define DEG2RAD(a) (((a) * M_PI) / 180.0) 497 #define RAD2DEG(a) (((a) * 180) / M_PI) 522 #define EPSILON 0.0000077 538 #define FEQUAL(a, b) (fabs((a)-(b)) < EPSILON) 546 #define M_PI 3.14159265358979323846 562 #define ISPOWEROF2(n) (!(n & (n-1))) 622 GCG_API_FUNCTION
bool gcgReport(
int code,
const char *format =
NULL, ...);
636 GCG_API_FUNCTION
int gcgGetReport(
int sizestring = 0,
char *extrastring =
NULL);
699 GCG_API_FUNCTION
void gcgOutputLog(
const char *format, ...);
712 #define GCG_REPORT_CODE(t, d, m) (((((int) d) & (int) 0xff) << 3) | ((((int) m) & (int) 0x3ff) << 11) | ((((int) t) & (int) 0x07) << 0)) 716 #define GCG_REPORT_TYPE(c) ((((int) c) >> 0) & (int) 0x07) // 3 bits 720 #define GCG_REPORT_DOMAIN(c) ((((int) c) >> 3) & (int) 0xff) // 8 bits 724 #define GCG_REPORT_MESSAGE(c) ((((int) c) >> 11) & (int) 0x3ff) // 10 bits 741 #define GCG_SUCCESS 0 // Must be zero 744 #define GCG_WARNING 2 746 #define GCG_INFORMATION 3 // Must be the greatest code 762 #define GCG_DOMAIN_MEMORY 8 // Must be the smallest code 763 #define GCG_DOMAIN_NETWORK 9 765 #define GCG_DOMAIN_FILE 10 767 #define GCG_DOMAIN_IMAGE 11 769 #define GCG_DOMAIN_CAMERA 12 771 #define GCG_DOMAIN_VIDEO 13 773 #define GCG_DOMAIN_THREAD 14 775 #define GCG_DOMAIN_GRAPHICS 15 777 #define GCG_DOMAIN_GEOMETRY 16 779 #define GCG_DOMAIN_ALGEBRA 17 781 #define GCG_DOMAIN_CONFIG 18 783 #define GCG_DOMAIN_DATASTRUCTURE 19 785 #define GCG_DOMAIN_SIGNAL 20 789 #define GCG_DOMAIN_USER 21 // Must be the greatest code 795 #define GCG_REPORT_ALL -1 805 #define GCG_NONE 0 // Must be the smallest code 806 #define GCG_ALLOCATIONERROR 1 808 #define GCG_INVALIDOBJECT 2 810 #define GCG_BADPARAMETERS 3 812 #define GCG_INITERROR 4 814 #define GCG_INTERNALERROR 5 816 #define GCG_TIMEOUT 6 818 #define GCG_IOERROR 7 820 #define GCG_FORMATMISMATCH 8 822 #define GCG_UNRECOGNIZEDFORMAT 9 824 #define GCG_UNSUPPORTEDFORMAT 10 826 #define GCG_UNSUPPORTEDOPERATION 11 828 #define GCG_INFORMATIONPROBLEM 12 830 #define GCG_READERROR 13 832 #define GCG_WRITEERROR 14 834 #define GCG_NOTCONNECTED 15 836 #define GCG_SOCKETERROR 16 838 #define GCG_SELECTERROR 17 840 #define GCG_CONNECTIONCLOSED 18 842 #define GCG_HOSTNOTFOUND 19 844 #define GCG_CONNECTERROR 20 846 #define GCG_SETSOCKETOPTERROR 21 848 #define GCG_BINDERROR 22 850 #define GCG_LISTENERROR 23 852 #define GCG_ACCEPTERROR 24 854 #define GCG_EXCEPTION 25 856 #define GCG_ACCEPTBADADDRESS 26 858 #define GCG_CONNECTIONREFUSED 27 860 #define GCG_CONNECTIONABORTED 28 862 #define GCG_WRITEBADADDRESS 29 864 #define GCG_READBADADDRESS 30 866 #define GCG_SENDSHUTDOWN 31 868 #define GCG_RECEIVESHUTDOWN 32 870 #define GCG_INVALIDSOCKET 33 872 #define GCG_STREAMCONTROLERROR 34 874 #define GCG_ALREADYRUNNING 35 876 #define GCG_CREATIONFAILED 36 878 #define GCG_MUTEXFAILURE 37 880 #define GCG_SEMAPHOREFAILURE 38 882 #define GCG_NOBUFFER 39 884 #define GCG_JOBNOTEXECUTED 40 886 #define GCG_INTERRUPTED 41 888 #define GCG_DISCONNECTED 42 890 #define GCG_STOPERROR 43 892 #define GCG_NOTRUNNING 44 894 #define GCG_EXITFAILURE 45 896 #define GCG_RELEASEERROR 46 898 #define GCG_LOCKERROR 47 900 #define GCG_OWNERSHIPERROR 48 902 #define GCG_REMOVALERROR 49 904 #define GCG_STOREFAILURE 50 906 #define GCG_OPENERROR 51 908 #define GCG_DECODEERROR 52 910 #define GCG_FUNCTIONCALLFAILED 53 912 #define GCG_GRAPHICSERROR 54 914 #define GCG_INCOMPATIBILITYERROR 55 916 #define GCG_CONFIGERROR 56 918 #define GCG_UNAVAILABLERESOURCE 57 920 #define GCG_STARTERROR 58 922 #define GCG_OUTOFBOUNDS 59 924 #define GCG_ENDOFSTREAM 60 926 #define GCG_OPERATIONFAILED 61 928 #define GCG_MEMORYLEAK 62 930 #define GCG_INSERTIONFAILED 63 932 #define GCG_ADAPTING 64 936 #define GCG_UNDEFINED 65 // Must be the greatest code 966 void *
operator new(
size_t size);
975 void *
operator new(
size_t size,
const std::nothrow_t&)
throw();
983 void *
operator new[](
size_t size);
992 void *
operator new[](
size_t size,
const std::nothrow_t&)
throw();
999 void operator delete(
void *p);
1006 void operator delete(
void *p,
const std::nothrow_t&)
throw();
1013 void operator delete[](
void *p);
1020 void operator delete[](
void *p,
const std::nothrow_t&)
throw();
1043 typedef float VECTOR2[2];
1044 typedef float VECTOR3[3];
1045 typedef float VECTOR4[4];
1047 typedef float MATRIX2[4];
1048 typedef float MATRIX3[9];
1049 typedef float MATRIX34[12];
1050 typedef float MATRIX4[16];
1052 typedef double VECTOR2d[2];
1053 typedef double VECTOR3d[3];
1054 typedef double VECTOR4d[4];
1056 typedef double MATRIX2d[4];
1057 typedef double MATRIX3d[9];
1058 typedef double MATRIX34d[12];
1059 typedef double MATRIX4d[16];
1067 #define gcgDOTVECTOR2(v1, v2) ((v1)[0] * (v2)[0] + (v1)[1] * (v2)[1]) 1068 #define gcgDOTIMEDVECTOR2(u, a, b) ((u)[0] * (a) + (u)[1] * (b)} 1069 #define gcgLENGTHVECTOR2(v) (sqrt(gcgDOTVECTOR2((v),(v)))) 1071 #define gcgDOTVECTOR3(v1, v2) ((v1)[0] * (v2)[0] + (v1)[1] * (v2)[1] + (v1)[2] * (v2)[2]) 1072 #define gcgDOTIMEDVECTOR3(u, a, b, c) ((u)[0] * (a) + (u)[1] * (b) + (u)[2] * (c)) 1073 #define gcgLENGTHVECTOR3(v) (sqrt(gcgDOTVECTOR3((v),(v)))) 1075 #define gcgDOTVECTOR4(v1, v2) ((v1)[0] * (v2)[0] + (v1)[1] * (v2)[1] + (v1)[2] * (v2)[2] + (v1)[3] * (v2)[3]) 1076 #define gcgDOTIMEDVECTOR4(u, a, b, c, d) ((u)[0] * (a) + (u)[1] * (b) + (u)[2] * (c) + (u)[3] * (d)) 1077 #define gcgLENGTHVECTOR4(v) (sqrt(gcgDOTVECTOR4((v),(v)))) 1079 #define gcgISEQUALVECTOR2(v1, v2) (fabs(v1[0] - v2[0]) > EPSILON && fabs((v1)[1] - (v2)[1]) > EPSILON) 1080 #define gcgISEQUALVECTOR3(v1, v2) (fabs(v1[0] - v2[0]) > EPSILON && fabs((v1)[1] - (v2)[1]) > EPSILON && fabs((v1)[2] - (v2)[2]) > EPSILON) 1081 #define gcgISEQUALVECTOR4(v1, v2) (fabs(v1[0] - v2[0]) > EPSILON && fabs((v1)[1] - (v2)[1]) > EPSILON && fabs((v1)[2] - (v2)[2]) > EPSILON && fabs((v1)[3] - (v2)[3]) > EPSILON) 1084 #define gcgDETERMINANT3x3_(m0, m1, m2, m3, m4, m5, m6, m7, m8) ((m0)*((m8)*(m4)-(m7)*(m5)) - (m3)*((m8)*(m1)-(m7)*(m2)) + (m6)*((m5)*(m1)-(m4)*(m2))) 1085 #define gcgDETERMINANT4x4_(m, det0, det4, det8, det12) \ 1086 ( (m)[0] * (det0 = gcgDETERMINANT3x3_((m)[5], (m)[6], (m)[7], (m)[9], (m)[10], (m)[11], (m)[13], (m)[14], (m)[15])) \ 1087 -(m)[4] * (det4 = gcgDETERMINANT3x3_((m)[1], (m)[2], (m)[3], (m)[9], (m)[10], (m)[11], (m)[13], (m)[14], (m)[15])) \ 1088 +(m)[8] * (det8 = gcgDETERMINANT3x3_((m)[1], (m)[2], (m)[3], (m)[5], (m)[6], (m)[7], (m)[13], (m)[14], (m)[15])) \ 1089 -(m)[12] * (det12= gcgDETERMINANT3x3_((m)[1], (m)[2], (m)[3], (m)[5], (m)[6], (m)[7], (m)[9], (m)[10], (m)[11])) ) 1091 #define gcgDETERMINANTMATRIX3(m) (gcgDETERMINANT3x3_((m)[0], (m)[1], (m)[2], (m)[3], (m)[4], (m)[5], (m)[6], (m)[7], (m)[8])) 1092 #define gcgDETERMINANTMATRIX4(m) \ 1093 ( (m)[0] * gcgDETERMINANT3x3_((m)[5], (m)[6], (m)[7], (m)[9], (m)[10], (m)[11], (m)[13], (m)[14], (m)[15]) \ 1094 -(m)[4] * gcgDETERMINANT3x3_((m)[1], (m)[2], (m)[3], (m)[9], (m)[10], (m)[11], (m)[13], (m)[14], (m)[15]) \ 1095 +(m)[8] * gcgDETERMINANT3x3_((m)[1], (m)[2], (m)[3], (m)[5], (m)[6], (m)[7], (m)[13], (m)[14], (m)[15]) \ 1096 -(m)[12] * gcgDETERMINANT3x3_((m)[1], (m)[2], (m)[3], (m)[5], (m)[6], (m)[7], (m)[9], (m)[10], (m)[11]) ) 1100 #define gcgZEROVECTOR2(v) { (v)[0] = (v)[1] = 0.0; } 1101 #define gcgZEROVECTOR3(v) { (v)[0] = (v)[1] = (v)[2] = 0.0; } 1102 #define gcgZEROVECTOR4(v) { (v)[0] = (v)[1] = (v)[2] = (v)[3] = 0.0; } 1104 #define gcgSETVECTOR2(dest, a, b) {(dest)[0] = a; (dest)[1] = b; } 1105 #define gcgSETVECTOR3(dest, a, b, c) {(dest)[0] = a; (dest)[1] = b; (dest)[2] = c; } 1106 #define gcgSETVECTOR4(dest, a, b, c, d) {(dest)[0] = a; (dest)[1] = b; (dest)[2] = c; (dest)[3]=d; } 1108 static inline void gcgCOPYVECTOR2(VECTOR2 dest, VECTOR2 src) {dest[0] = src[0]; dest[1] = src[1]; }
1109 static inline void gcgCOPYVECTOR2(VECTOR2d dest, VECTOR2d src) {dest[0] = src[0]; dest[1] = src[1]; }
1110 static inline void gcgCOPYVECTOR2(VECTOR2 dest, VECTOR2d src) {dest[0] = (float) src[0]; dest[1] = (float) src[1]; }
1111 static inline void gcgCOPYVECTOR2(VECTOR2d dest, VECTOR2 src) {dest[0] = src[0]; dest[1] = src[1]; }
1112 static inline void gcgCOPYVECTOR3(VECTOR3 dest, VECTOR3 src) { dest[0] = src[0]; dest[1] = src[1]; dest[2] = src[2]; }
1113 static inline void gcgCOPYVECTOR3(VECTOR3 dest, VECTOR3d src) { dest[0] = (float) src[0]; dest[1] = (float) src[1]; dest[2] = (float) src[2]; }
1114 static inline void gcgCOPYVECTOR3(VECTOR3d dest, VECTOR3 src) { dest[0] = src[0]; dest[1] = src[1]; dest[2] = src[2]; }
1115 static inline void gcgCOPYVECTOR3(VECTOR3d dest, VECTOR3d src) { dest[0] = src[0]; dest[1] = src[1]; dest[2] = src[2]; }
1116 static inline void gcgCOPYVECTOR4(VECTOR4 dest, VECTOR4 src) { dest[0] = src[0]; dest[1] = src[1]; dest[2] = src[2]; dest[3] = src[3];}
1117 static inline void gcgCOPYVECTOR4(VECTOR4 dest, VECTOR4d src) { dest[0] = (float) src[0]; dest[1] = (float) src[1]; dest[2] = (float) src[2]; dest[3] = (float) src[3];}
1118 static inline void gcgCOPYVECTOR4(VECTOR4d dest, VECTOR4 src) { dest[0] = src[0]; dest[1] = src[1]; dest[2] = src[2]; dest[3] = src[3];}
1119 static inline void gcgCOPYVECTOR4(VECTOR4d dest, VECTOR4d src) { dest[0] = src[0]; dest[1] = src[1]; dest[2] = src[2]; dest[3] = src[3];}
1121 static inline void gcgSCALEVECTOR2(VECTOR2 dest, VECTOR2 v,
float factor) { dest[0]=factor*v[0]; (dest)[1]=factor*v[1]; }
1122 static inline void gcgSCALEVECTOR2(VECTOR2d dest, VECTOR2d v,
double factor) { dest[0]=factor*v[0]; (dest)[1]=factor*v[1]; }
1123 static inline void gcgSCALEVECTOR3(VECTOR3 dest, VECTOR3 v,
float factor) {dest[0]=factor*v[0]; dest[1]=factor*v[1]; dest[2]=factor*v[2];}
1124 static inline void gcgSCALEVECTOR3(VECTOR3d dest, VECTOR3d v,
double factor) {dest[0]=factor*v[0]; dest[1]=factor*v[1]; dest[2]=factor*v[2];}
1125 static inline void gcgSCALEVECTOR4(VECTOR4 dest, VECTOR4 v,
float factor) {dest[0]=factor*v[0]; dest[1]=factor*v[1]; dest[2]=factor*v[2]; dest[3]=factor*v[3];}
1126 static inline void gcgSCALEVECTOR4(VECTOR4d dest, VECTOR4d v,
double factor) {dest[0]=factor*v[0]; dest[1]=factor*v[1]; dest[2]=factor*v[2]; dest[3]=factor*v[3];}
1128 #define gcgADDVECTOR2(dest,v1,v2) {(dest)[0]=(v1)[0]+(v2)[0]; (dest)[1]=(v1)[1]+(v2)[1]; } 1129 #define gcgADDVECTOR3(dest,v1,v2) {(dest)[0]=(v1)[0]+(v2)[0]; (dest)[1]=(v1)[1]+(v2)[1]; (dest)[2]=(v1)[2]+(v2)[2];} 1130 #define gcgADDVECTOR4(dest,v1,v2) {(dest)[0]=(v1)[0]+(v2)[0]; (dest)[1]=(v1)[1]+(v2)[1]; (dest)[2]=(v1)[2]+(v2)[2]; (dest)[3]=(v1)[3]+(v2)[3];} 1132 #define gcgSUBVECTOR2(dest, v1, v2) {(dest)[0]=(v1)[0]-(v2)[0]; (dest)[1]=(v1)[1]-(v2)[1]; } 1133 #define gcgSUBVECTOR3(dest, v1, v2) {(dest)[0]=(v1)[0]-(v2)[0]; (dest)[1]=(v1)[1]-(v2)[1]; (dest)[2]=(v1)[2]-(v2)[2];} 1134 #define gcgSUBVECTOR4(dest, v1, v2) {(dest)[0]=(v1)[0]-(v2)[0]; (dest)[1]=(v1)[1]-(v2)[1]; (dest)[2]=(v1)[2]-(v2)[2]; (dest)[3]=(v1)[3]-(v2)[3];} 1137 static inline void gcgNORMALIZEVECTOR2(VECTOR2 dest, VECTOR2 v) {
1138 register float factor = (float) (1.0 / gcgLENGTHVECTOR2((v)));
1139 gcgSCALEVECTOR2((dest), (v), factor);
1142 static inline void gcgNORMALIZEVECTOR2(VECTOR2d dest, VECTOR2d v) {
1143 register double factor = 1.0 / gcgLENGTHVECTOR2((v));
1144 gcgSCALEVECTOR2((dest), (v), factor);
1148 static inline void gcgNORMALIZEVECTOR3(VECTOR3 dest, VECTOR3 v) {
1149 register float factor = (float) (1.0 / gcgLENGTHVECTOR3((v)));
1150 gcgSCALEVECTOR3((dest), (v), factor);
1153 static inline void gcgNORMALIZEVECTOR3(VECTOR3d dest, VECTOR3d v) {
1154 register double factor = 1.0 / gcgLENGTHVECTOR3((v));
1155 gcgSCALEVECTOR3((dest), (v), factor);
1159 static inline void gcgNORMALIZEVECTOR4(VECTOR4 dest, VECTOR4 v) {
1160 register float factor = (float) (1.0 / gcgLENGTHVECTOR4((v)));
1161 gcgSCALEVECTOR4((dest), (v), factor);
1164 static inline void gcgNORMALIZEVECTOR4(VECTOR4d dest, VECTOR4d v) {
1165 register double factor = 1.0 / gcgLENGTHVECTOR4((v));
1166 gcgSCALEVECTOR4((dest), (v), factor);
1170 #define gcgCROSSVECTOR3(dest, v1, v2) { \ 1171 (dest)[0] = (v1)[1] * (v2)[2] - (v1)[2] * (v2)[1]; \ 1172 (dest)[1] = (v1)[2] * (v2)[0] - (v1)[0] * (v2)[2]; \ 1173 (dest)[2] = (v1)[0] * (v2)[1] - (v1)[1] * (v2)[0];} 1176 #define gcgVECTOR3TOTENSOR(t, v1, v2) { \ 1177 (t)[0] = (v1)[0]*(v2)[0]; (t)[1] = (v1)[0]*(v2)[1]; (t)[2] = (v1)[0]*(v2)[2]; \ 1178 (t)[3] = (v1)[1]*(v2)[0]; (t)[4] = (v1)[1]*(v2)[1]; (t)[5] = (v1)[1]*(v2)[2]; \ 1179 (t)[6] = (v1)[2]*(v2)[0]; (t)[7] = (v1)[2]*(v2)[1]; (t)[8] = (v1)[2]*(v2)[2]; } 1185 #define gcgSETMATRIX2(dest, a, b, c, d) { \ 1186 (dest)[ 0] = a; (dest)[ 1] = b; (dest)[ 2] = c; (dest)[ 3] = d; } 1188 #define gcgSETMATRIX3(dest, a, b, c, d, e, f, g, h, i) { \ 1189 (dest)[ 0] = a; (dest)[ 1] = b; (dest)[ 2] = c; \ 1190 (dest)[ 3] = d; (dest)[ 4] = e; (dest)[ 5] = f; \ 1191 (dest)[ 6] = g; (dest)[ 7] = h; (dest)[ 8] = i; } 1193 #define gcgSETMATRIX4(dest, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p) { \ 1194 (dest)[ 0] = a; (dest)[ 1] = b; (dest)[ 2] = c; (dest)[ 3] = d; \ 1195 (dest)[ 4] = e; (dest)[ 5] = f; (dest)[ 6] = g; (dest)[ 7] = h; \ 1196 (dest)[ 8] = i; (dest)[ 9] = j; (dest)[10] = k; (dest)[11] = l; \ 1197 (dest)[12] = m; (dest)[13] = n; (dest)[14] = o; (dest)[15] = p; } 1199 static inline void gcgCOPYMATRIX2(MATRIX2 dest, MATRIX2 m) {
1200 dest[ 0] = m[ 0]; dest[ 1] = m[ 1]; dest[ 2] = m[ 2]; dest[ 3] = m[ 3];
1203 static inline void gcgCOPYMATRIX2(MATRIX2d dest, MATRIX2d m) {
1204 dest[ 0] = m[ 0]; dest[ 1] = m[ 1]; dest[ 2] = m[ 2]; dest[ 3] = m[ 3];
1207 static inline void gcgCOPYMATRIX2(MATRIX2d dest, MATRIX2 m) {
1208 dest[ 0] = m[ 0]; dest[ 1] = m[ 1]; dest[ 2] = m[ 2]; dest[ 3] = m[ 3];
1211 static inline void gcgCOPYMATRIX2(MATRIX2 dest, MATRIX2d m) {
1212 dest[ 0] = (float) m[ 0]; dest[ 1] = (float) m[ 1]; dest[ 2] = (float) m[ 2]; dest[ 3] = (float) m[ 3];
1215 static inline void gcgCOPYMATRIX3(MATRIX3 dest, MATRIX3 m) {
1216 dest[ 0] = m[ 0]; dest[ 1] = m[ 1]; dest[ 2] = m[ 2];
1217 dest[ 3] = m[ 3]; dest[ 4] = m[ 4]; dest[ 5] = m[ 5];
1218 dest[ 6] = m[ 6]; dest[ 7] = m[ 7]; dest[ 8] = m[ 8];
1221 static inline void gcgCOPYMATRIX3(MATRIX3d dest, MATRIX3d m) {
1222 dest[ 0] = m[ 0]; dest[ 1] = m[ 1]; dest[ 2] = m[ 2];
1223 dest[ 3] = m[ 3]; dest[ 4] = m[ 4]; dest[ 5] = m[ 5];
1224 dest[ 6] = m[ 6]; dest[ 7] = m[ 7]; dest[ 8] = m[ 8];
1227 static inline void gcgCOPYMATRIX3(MATRIX3d dest, MATRIX3 m) {
1228 dest[ 0] = m[ 0]; dest[ 1] = m[ 1]; dest[ 2] = m[ 2];
1229 dest[ 3] = m[ 3]; dest[ 4] = m[ 4]; dest[ 5] = m[ 5];
1230 dest[ 6] = m[ 6]; dest[ 7] = m[ 7]; dest[ 8] = m[ 8];
1233 static inline void gcgCOPYMATRIX3(MATRIX3 dest, MATRIX3d m) {
1234 dest[ 0] = (float) m[ 0]; dest[ 1] = (float) m[ 1]; dest[ 2] = (float) m[ 2];
1235 dest[ 3] = (float) m[ 3]; dest[ 4] = (float) m[ 4]; dest[ 5] = (float) m[ 5];
1236 dest[ 6] = (float) m[ 6]; dest[ 7] = (float) m[ 7]; dest[ 8] = (float) m[ 8];
1240 static inline void gcgCOPYMATRIX4(MATRIX4 dest, MATRIX4 m) {
1241 dest[ 0] = m[ 0]; dest[ 1] = m[ 1]; dest[ 2] = m[ 2]; dest[ 3] = m[ 3];
1242 dest[ 4] = m[ 4]; dest[ 5] = m[ 5]; dest[ 6] = m[ 6]; dest[ 7] = m[ 7];
1243 dest[ 8] = m[ 8]; dest[ 9] = m[ 9]; dest[10] = m[10]; dest[11] = m[11];
1244 dest[12] = m[12]; dest[13] = m[13]; dest[14] = m[14]; dest[15] = m[15];
1247 static inline void gcgCOPYMATRIX4(MATRIX4d dest, MATRIX4 m) {
1248 dest[ 0] = m[ 0]; dest[ 1] = m[ 1]; dest[ 2] = m[ 2]; dest[ 3] = m[ 3];
1249 dest[ 4] = m[ 4]; dest[ 5] = m[ 5]; dest[ 6] = m[ 6]; dest[ 7] = m[ 7];
1250 dest[ 8] = m[ 8]; dest[ 9] = m[ 9]; dest[10] = m[10]; dest[11] = m[11];
1251 dest[12] = m[12]; dest[13] = m[13]; dest[14] = m[14]; dest[15] = m[15];
1254 static inline void gcgCOPYMATRIX4(MATRIX4d dest, MATRIX4d m) {
1255 dest[ 0] = m[ 0]; dest[ 1] = m[ 1]; dest[ 2] = m[ 2]; dest[ 3] = m[ 3];
1256 dest[ 4] = m[ 4]; dest[ 5] = m[ 5]; dest[ 6] = m[ 6]; dest[ 7] = m[ 7];
1257 dest[ 8] = m[ 8]; dest[ 9] = m[ 9]; dest[10] = m[10]; dest[11] = m[11];
1258 dest[12] = m[12]; dest[13] = m[13]; dest[14] = m[14]; dest[15] = m[15];
1261 static inline void gcgCOPYMATRIX4(MATRIX4 dest, MATRIX4d m) {
1262 dest[ 0] = (float) m[ 0]; dest[ 1] = (float) m[ 1]; dest[ 2] = (float) m[ 2]; dest[ 3] = (float) m[ 3];
1263 dest[ 4] = (float) m[ 4]; dest[ 5] = (float) m[ 5]; dest[ 6] = (float) m[ 6]; dest[ 7] = (float) m[ 7];
1264 dest[ 8] = (float) m[ 8]; dest[ 9] = (float) m[ 9]; dest[10] = (float) m[10]; dest[11] = (float) m[11];
1265 dest[12] = (float) m[12]; dest[13] = (float) m[13]; dest[14] = (float) m[14]; dest[15] = (float) m[15];
1268 #define gcgIDENTITYMATRIX2(matriz) { \ 1269 (matriz)[0] = (matriz)[3] = 1.f; \ 1270 (matriz)[1] = (matriz)[2] = 0.0f; } 1272 #define gcgIDENTITYMATRIX3(matriz) { \ 1273 (matriz)[0] = (matriz)[4] = (matriz)[8] = 1.f; \ 1274 (matriz)[1] = (matriz)[2] = (matriz)[3] = (matriz)[5] = (matriz)[6] = (matriz)[7] = 0.0f; } 1276 #define gcgIDENTITYMATRIX4(matriz) { \ 1277 (matriz)[0] = (matriz)[5] = (matriz)[10] = (matriz)[15] = 1.f; \ 1278 (matriz)[1] = (matriz)[2] = (matriz)[3] = (matriz)[4] = (matriz)[6] = (matriz)[7] = \ 1279 (matriz)[8] = (matriz)[9] = (matriz)[11] = (matriz)[12] = (matriz)[13] = (matriz)[14] = 0.f; } 1282 #define gcgTRANSPOSEMATRIX3(tm, m) { \ 1283 (tm)[ 0] = (m)[0]; (tm)[1] = (m)[3]; (tm)[2] = (m)[6]; \ 1284 (tm)[ 3] = (m)[1]; (tm)[4] = (m)[4]; (tm)[5] = (m)[7]; \ 1285 (tm)[ 6] = (m)[2]; (tm)[7] = (m)[5]; (tm)[8] = (m)[8]; } 1288 #define gcgTRANSPOSEMATRIX4(tm, m) { \ 1289 (tm)[ 0] = (m)[ 0]; (tm)[ 1] = (m)[ 4]; (tm)[ 2] = (m)[ 8]; (tm)[ 3] = (m)[12]; \ 1290 (tm)[ 4] = (m)[ 1]; (tm)[ 5] = (m)[ 5]; (tm)[ 6] = (m)[ 9]; (tm)[ 7] = (m)[13]; \ 1291 (tm)[ 8] = (m)[ 2]; (tm)[ 9] = (m)[ 6]; (tm)[10] = (m)[10]; (tm)[11] = (m)[14]; \ 1292 (tm)[12] = (m)[ 3]; (tm)[13] = (m)[ 7]; (tm)[14] = (m)[11]; (tm)[15] = (m)[15]; } 1295 #define gcgSCALEMATRIX2(dest, m, s) \ 1296 {(dest)[0] = (m)[0] * (s); (dest)[1] = (m)[1] * (s); (dest)[2] = (m)[2] * (s); (dest)[3] = (m)[3] * (s); } 1299 #define gcgSCALEMATRIX3(dest, m, s) { \ 1300 (dest)[0] = (m)[0] * (s); (dest)[1] = (m)[1] * (s); (dest)[2] = (m)[2] * (s); \ 1301 (dest)[3] = (m)[3] * (s); (dest)[4] = (m)[4] * (s); (dest)[5] = (m)[5] * (s); \ 1302 (dest)[6] = (m)[6] * (s); (dest)[7] = (m)[7] * (s); (dest)[8] = (m)[8] * (s); } 1305 #define gcgSCALEMATRIX4(dest, m, s) { \ 1306 (dest)[ 0] = (m)[ 0] * (s); (dest)[ 1] = (m)[ 1] * (s); (dest)[ 2] = (m)[ 2] * (s); (dest)[ 3] = (m)[ 3] * (s); \ 1307 (dest)[ 4] = (m)[ 4] * (s); (dest)[ 5] = (m)[ 5] * (s); (dest)[ 6] = (m)[ 6] * (s); (dest)[ 7] = (m)[ 7] * (s); \ 1308 (dest)[ 8] = (m)[ 8] * (s); (dest)[ 9] = (m)[ 9] * (s); (dest)[10] = (m)[10] * (s); (dest)[11] = (m)[11] * (s); \ 1309 (dest)[12] = (m)[12] * (s); (dest)[13] = (m)[13] * (s); (dest)[14] = (m)[14] * (s); (dest)[15] = (m)[15] * (s); } 1312 #define gcgADDMATRIX2(dest, m1, m2) { \ 1313 (dest)[ 0] = (m1)[ 0] + (m2)[ 0]; (dest)[ 1] = (m1)[ 1] + (m2)[ 1]; \ 1314 (dest)[ 2] = (m1)[ 2] + (m2)[ 2]; (dest)[ 3] = (m1)[ 3] + (m2)[ 3]; } 1316 #define gcgADDMATRIX3(dest, m1, m2) { \ 1317 (dest)[ 0] = (m1)[ 0] + (m2)[ 0]; (dest)[ 1] = (m1)[ 1] + (m2)[ 1]; (dest)[ 2] = (m1)[ 2] + (m2)[ 2]; \ 1318 (dest)[ 3] = (m1)[ 3] + (m2)[ 3]; (dest)[ 4] = (m1)[ 4] + (m2)[ 4]; (dest)[ 5] = (m1)[ 5] + (m2)[ 5]; \ 1319 (dest)[ 6] = (m1)[ 6] + (m2)[ 6]; (dest)[ 7] = (m1)[ 7] + (m2)[ 7]; (dest)[ 8] = (m1)[ 8] + (m2)[ 8]; } 1321 #define gcgADDMATRIX4(dest, m1, m2) { \ 1322 (dest)[ 0] = (m1)[ 0] + (m2)[ 0]; (dest)[ 1] = (m1)[ 1] + (m2)[ 1]; (dest)[ 2] = (m1)[ 2] + (m2)[ 2]; (dest)[ 3] = (m1)[ 3] + (m2)[ 3]; \ 1323 (dest)[ 4] = (m1)[ 4] + (m2)[ 4]; (dest)[ 5] = (m1)[ 5] + (m2)[ 5]; (dest)[ 6] = (m1)[ 6] + (m2)[ 6]; (dest)[ 7] = (m1)[ 7] + (m2)[ 7]; \ 1324 (dest)[ 8] = (m1)[ 8] + (m2)[ 8]; (dest)[ 9] = (m1)[ 9] + (m2)[ 9]; (dest)[10] = (m1)[10] + (m2)[10]; (dest)[11] = (m1)[11] + (m2)[11]; \ 1325 (dest)[12] = (m1)[12] + (m2)[12]; (dest)[13] = (m1)[13] + (m2)[13]; (dest)[14] = (m1)[14] + (m2)[14]; (dest)[15] = (m1)[15] + (m2)[15]; } 1327 #define gcgSUBMATRIX2(dest, m1, m2) { \ 1328 (dest)[ 0] = (m1)[ 0] - (m2)[ 0]; (dest)[ 1] = (m1)[ 1] - (m2)[ 1]; \ 1329 (dest)[ 2] = (m1)[ 2] - (m2)[ 2]; (dest)[ 3] = (m1)[ 3] - (m2)[ 3]; } 1331 #define gcgSUBMATRIX3(dest, m1, m2) { \ 1332 (dest)[ 0] = (m1)[ 0] - (m2)[ 0]; (dest)[ 1] = (m1)[ 1] - (m2)[ 1]; (dest)[ 2] = (m1)[ 2] - (m2)[ 2]; \ 1333 (dest)[ 3] = (m1)[ 3] - (m2)[ 3]; (dest)[ 4] = (m1)[ 4] - (m2)[ 4]; (dest)[ 5] = (m1)[ 5] - (m2)[ 5]; \ 1334 (dest)[ 6] = (m1)[ 6] - (m2)[ 6]; (dest)[ 7] = (m1)[ 7] - (m2)[ 7]; (dest)[ 8] = (m1)[ 8] - (m2)[ 8]; } 1336 #define gcgSUBMATRIX4(dest, m1, m2) { \ 1337 (dest)[ 0] = (m1)[ 0] - (m2)[ 0]; (dest)[ 1] = (m1)[ 1] - (m2)[ 1]; (dest)[ 2] = (m1)[ 2] - (m2)[ 2]; (dest)[ 3] = (m1)[ 3] - (m2)[ 3]; \ 1338 (dest)[ 4] = (m1)[ 4] - (m2)[ 4]; (dest)[ 5] = (m1)[ 5] - (m2)[ 5]; (dest)[ 6] = (m1)[ 6] - (m2)[ 6]; (dest)[ 7] = (m1)[ 7] - (m2)[ 7]; \ 1339 (dest)[ 8] = (m1)[ 8] - (m2)[ 8]; (dest)[ 9] = (m1)[ 9] - (m2)[ 9]; (dest)[10] = (m1)[10] - (m2)[10]; (dest)[11] = (m1)[11] - (m2)[11]; \ 1340 (dest)[12] = (m1)[12] - (m2)[12]; (dest)[13] = (m1)[13] - (m2)[13]; (dest)[14] = (m1)[14] - (m2)[14]; (dest)[15] = (m1)[15] - (m2)[15]; } 1343 #define gcgMULTMATRIX3(result, m1, m2) { \ 1344 (result)[ 0] = (m1)[ 0] * (m2)[ 0] + (m1)[ 1] * (m2)[ 3] + (m1)[ 2] * (m2)[ 6]; \ 1345 (result)[ 1] = (m1)[ 0] * (m2)[ 1] + (m1)[ 1] * (m2)[ 4] + (m1)[ 2] * (m2)[ 7]; \ 1346 (result)[ 2] = (m1)[ 0] * (m2)[ 2] + (m1)[ 1] * (m2)[ 5] + (m1)[ 2] * (m2)[ 8]; \ 1347 (result)[ 3] = (m1)[ 3] * (m2)[ 0] + (m1)[ 4] * (m2)[ 3] + (m1)[ 5] * (m2)[ 6]; \ 1348 (result)[ 4] = (m1)[ 3] * (m2)[ 1] + (m1)[ 4] * (m2)[ 4] + (m1)[ 5] * (m2)[ 7]; \ 1349 (result)[ 5] = (m1)[ 3] * (m2)[ 2] + (m1)[ 4] * (m2)[ 5] + (m1)[ 5] * (m2)[ 8]; \ 1350 (result)[ 6] = (m1)[ 6] * (m2)[ 0] + (m1)[ 7] * (m2)[ 3] + (m1)[ 8] * (m2)[ 6]; \ 1351 (result)[ 7] = (m1)[ 6] * (m2)[ 1] + (m1)[ 7] * (m2)[ 4] + (m1)[ 8] * (m2)[ 7]; \ 1352 (result)[ 8] = (m1)[ 6] * (m2)[ 2] + (m1)[ 7] * (m2)[ 5] + (m1)[ 8] * (m2)[ 8]; } 1355 #define gcgMULTMATRIX4(result, m1, m2) { \ 1356 (result)[ 0] = (m1)[ 0] * (m2)[ 0] + (m1)[ 1] * (m2)[ 4] + (m1)[ 2] * (m2)[ 8] + (m1)[ 3] * (m2)[12]; \ 1357 (result)[ 1] = (m1)[ 0] * (m2)[ 1] + (m1)[ 1] * (m2)[ 5] + (m1)[ 2] * (m2)[ 9] + (m1)[ 3] * (m2)[13]; \ 1358 (result)[ 2] = (m1)[ 0] * (m2)[ 2] + (m1)[ 1] * (m2)[ 6] + (m1)[ 2] * (m2)[10] + (m1)[ 3] * (m2)[14]; \ 1359 (result)[ 3] = (m1)[ 0] * (m2)[ 3] + (m1)[ 1] * (m2)[ 7] + (m1)[ 2] * (m2)[11] + (m1)[ 3] * (m2)[15]; \ 1360 (result)[ 4] = (m1)[ 4] * (m2)[ 0] + (m1)[ 5] * (m2)[ 4] + (m1)[ 6] * (m2)[ 8] + (m1)[ 7] * (m2)[12]; \ 1361 (result)[ 5] = (m1)[ 4] * (m2)[ 1] + (m1)[ 5] * (m2)[ 5] + (m1)[ 6] * (m2)[ 9] + (m1)[ 7] * (m2)[13]; \ 1362 (result)[ 6] = (m1)[ 4] * (m2)[ 2] + (m1)[ 5] * (m2)[ 6] + (m1)[ 6] * (m2)[10] + (m1)[ 7] * (m2)[14]; \ 1363 (result)[ 7] = (m1)[ 4] * (m2)[ 3] + (m1)[ 5] * (m2)[ 7] + (m1)[ 6] * (m2)[11] + (m1)[ 7] * (m2)[15]; \ 1364 (result)[ 8] = (m1)[ 8] * (m2)[ 0] + (m1)[ 9] * (m2)[ 4] + (m1)[10] * (m2)[ 8] + (m1)[11] * (m2)[12]; \ 1365 (result)[ 9] = (m1)[ 8] * (m2)[ 1] + (m1)[ 9] * (m2)[ 5] + (m1)[10] * (m2)[ 9] + (m1)[11] * (m2)[13]; \ 1366 (result)[10] = (m1)[ 8] * (m2)[ 2] + (m1)[ 9] * (m2)[ 6] + (m1)[10] * (m2)[10] + (m1)[11] * (m2)[14]; \ 1367 (result)[11] = (m1)[ 8] * (m2)[ 3] + (m1)[ 9] * (m2)[ 7] + (m1)[10] * (m2)[11] + (m1)[11] * (m2)[15]; \ 1368 (result)[12] = (m1)[12] * (m2)[ 0] + (m1)[13] * (m2)[ 4] + (m1)[14] * (m2)[ 8] + (m1)[15] * (m2)[12]; \ 1369 (result)[13] = (m1)[12] * (m2)[ 1] + (m1)[13] * (m2)[ 5] + (m1)[14] * (m2)[ 9] + (m1)[15] * (m2)[13]; \ 1370 (result)[14] = (m1)[12] * (m2)[ 2] + (m1)[13] * (m2)[ 6] + (m1)[14] * (m2)[10] + (m1)[15] * (m2)[14]; \ 1371 (result)[15] = (m1)[12] * (m2)[ 3] + (m1)[13] * (m2)[ 7] + (m1)[14] * (m2)[11] + (m1)[15] * (m2)[15]; } 1374 #define gcgMULTMATRIX34(result, m1, m2) { \ 1375 (result)[0] = (m1)[0] * (m2)[0] + (m1)[1] * (m2)[4] + (m1)[2] * (m2)[8]; \ 1376 (result)[1] = (m1)[0] * (m2)[1] + (m1)[1] * (m2)[5] + (m1)[2] * (m2)[9]; \ 1377 (result)[2] = (m1)[0] * (m2)[2] + (m1)[1] * (m2)[6] + (m1)[2] * (m2)[10]; \ 1378 (result)[3] = (m1)[0] * (m2)[3] + (m1)[1] * (m2)[7] + (m1)[2] * (m2)[11] + (m1)[3]; \ 1379 (result)[4] = (m1)[4] * (m2)[0] + (m1)[5] * (m2)[4] + (m1)[6] * (m2)[8]; \ 1380 (result)[5] = (m1)[4] * (m2)[1] + (m1)[5] * (m2)[5] + (m1)[6] * (m2)[9]; \ 1381 (result)[6] = (m1)[4] * (m2)[2] + (m1)[5] * (m2)[6] + (m1)[6] * (m2)[10]; \ 1382 (result)[7] = (m1)[4] * (m2)[3] + (m1)[5] * (m2)[7] + (m1)[6] * (m2)[11] + (m1)[7]; \ 1383 (result)[8] = (m1)[8] * (m2)[0] + (m1)[9] * (m2)[4] + (m1)[10] * (m2)[8]; \ 1384 (result)[9] = (m1)[8] * (m2)[1] + (m1)[9] * (m2)[5] + (m1)[10] * (m2)[9]; \ 1385 (result)[10] = (m1)[8] * (m2)[2] + (m1)[9] * (m2)[6] + (m1)[10] * (m2)[10]; \ 1386 (result)[11] = (m1)[8] * (m2)[3] + (m1)[9] * (m2)[7] + (m1)[10] * (m2)[11] + (m1)[11]; } 1390 #define gcgMATRIX3VECTOR3VECTOR3(result, v1, v2) { \ 1391 (result)[0] = (v1)[0] * (v2)[0]; (result)[1] = (v1)[0] * (v2)[1]; (result)[2] = (v1)[0] * (v2)[2]; \ 1392 (result)[3] = (v1)[1] * (v2)[0]; (result)[4] = (v1)[1] * (v2)[1]; (result)[5] = (v1)[1] * (v2)[2]; \ 1393 (result)[6] = (v1)[2] * (v2)[0]; (result)[7] = (v1)[2] * (v2)[1]; (result)[8] = (v1)[2] * (v2)[2]; } 1396 #define gcgAPPLYMATRIX3VECTOR3(r, t, vetor) { \ 1397 (r)[0] = (vetor)[0] * (t)[0] + (vetor)[1] * (t)[1] + (vetor)[2] * (t)[2]; \ 1398 (r)[1] = (vetor)[0] * (t)[3] + (vetor)[1] * (t)[4] + (vetor)[2] * (t)[5]; \ 1399 (r)[2] = (vetor)[0] * (t)[6] + (vetor)[1] * (t)[7] + (vetor)[2] * (t)[8]; } 1402 #define gcgAPPLYMATRIX4VECTOR4(r, t, vetor) { \ 1403 (r)[0] = (vetor)[0] * (t)[0] + (vetor)[1] * (t)[1] + (vetor)[2] * (t)[2] + (vetor)[3] * (t)[3]; \ 1404 (r)[1] = (vetor)[0] * (t)[4] + (vetor)[1] * (t)[5] + (vetor)[2] * (t)[6] + (vetor)[3] * (t)[7]; \ 1405 (r)[2] = (vetor)[0] * (t)[8] + (vetor)[1] * (t)[9] + (vetor)[2] * (t)[10] + (vetor)[3] * (t)[11]; \ 1406 (r)[3] = (vetor)[0] * (t)[12] + (vetor)[1] * (t)[13] + (vetor)[2] * (t)[14] + (vetor)[3] * (t)[15]; } 1408 #define gcgAPPLYMATRIX34VECTOR3(r, t, vetor) { \ 1409 (r)[0] = (vetor)[0] * (t)[0] + (vetor)[1] * (t)[1] + (vetor)[2] * (t)[2] + (t)[3]; \ 1410 (r)[1] = (vetor)[0] * (t)[4] + (vetor)[1] * (t)[5] + (vetor)[2] * (t)[6] + (t)[7]; \ 1411 (r)[2] = (vetor)[0] * (t)[8] + (vetor)[1] * (t)[9] + (vetor)[2] * (t)[10] + (t)[11]; } 1413 #define gcgLINEARMATRIX4VECTOR3(r, t, vetor) { \ 1414 (r)[0] = (vetor)[0] * (t)[0] + (vetor)[1] * (t)[1] + (vetor)[2] * (t)[2]; \ 1415 (r)[1] = (vetor)[0] * (t)[4] + (vetor)[1] * (t)[5] + (vetor)[2] * (t)[6]; \ 1416 (r)[2] = (vetor)[0] * (t)[8] + (vetor)[1] * (t)[9] + (vetor)[2] * (t)[10]; } 1424 #define gcgNORMALIZEQUATERNION(qf, q) { \ 1425 register double mag = 1.0/(q[0]*q[0] + q[1]*q[1] + q[2]*q[2] + q[3]*q[3]); \ 1426 gcgSCALEVECTOR3(qf, q, mag); } 1429 #define gcgCONJUGATEQUATERNION(qi, q) { \ 1430 (qi)[0] = -(q)[0]; \ 1431 (qi)[1] = -(q)[1]; \ 1432 (qi)[2] = -(q)[2]; \ 1437 static inline void gcgMULTQUATERNION(VECTOR4 dest, VECTOR4 q2, VECTOR4 q1) {
1439 t1[3] = (q1)[3]*(q2)[3] - (q1)[0]*(q2)[0] - (q1)[1]*(q2)[1] - (q1)[2]*(q2)[2];
1440 t1[0] = (q1)[3]*(q2)[0] + (q1)[0]*(q2)[3] + (q1)[1]*(q2)[2] - (q1)[2]*(q2)[1];
1441 t1[1] = (q1)[3]*(q2)[1] + (q1)[1]*(q2)[3] + (q1)[2]*(q2)[0] - (q1)[0]*(q2)[2];
1442 t1[2] = (q1)[3]*(q2)[2] + (q1)[2]*(q2)[3] + (q1)[0]*(q2)[1] - (q1)[1]*(q2)[0];
1443 gcgCOPYVECTOR4(dest, t1);
1446 static inline void gcgMULTQUATERNION(VECTOR4d dest, VECTOR4d q2, VECTOR4d q1) {
1448 t1[3] = (q1)[3]*(q2)[3] - (q1)[0]*(q2)[0] - (q1)[1]*(q2)[1] - (q1)[2]*(q2)[2];
1449 t1[0] = (q1)[3]*(q2)[0] + (q1)[0]*(q2)[3] + (q1)[1]*(q2)[2] - (q1)[2]*(q2)[1];
1450 t1[1] = (q1)[3]*(q2)[1] + (q1)[1]*(q2)[3] + (q1)[2]*(q2)[0] - (q1)[0]*(q2)[2];
1451 t1[2] = (q1)[3]*(q2)[2] + (q1)[2]*(q2)[3] + (q1)[0]*(q2)[1] - (q1)[1]*(q2)[0];
1452 gcgCOPYVECTOR4(dest, t1);
1456 static inline void gcgQUATERNIONTOMATRIX4(MATRIX4 m, VECTOR4 q) {
1457 register double xx = (q)[0] * (q)[0], yy = (q)[1] * (q)[1], zz = (q)[2] * (q)[2];
1458 register double xy = (q)[0] * (q)[1], xz = (q)[0] * (q)[2], yz = (q)[1] * (q)[2];
1459 register double xw = (q)[0] * (q)[3], yw = (q)[1] * (q)[3], zw = (q)[2] * (q)[3];
1460 m[0] = (float) (1.0 - (yy + yy + zz + zz));
1461 m[1] = (float) (xy + xy - zw - zw);
1462 m[2] = (float) (xz + xz + yw + yw);
1464 m[4] = (float) (xy + xy + zw + zw);
1465 m[5] = (float) (1.0 - (zz + zz + xx + xx));
1466 m[6] = (float) (yz + yz - xw - xw);
1468 m[8] = (float) (xz + xz - yw - yw);
1469 m[9] = (float) (yz + yz + xw + xw);
1470 m[10] = (float) (1.0 - (yy + yy + xx + xx));
1471 m[11] = m[12] = m[13] = m[14] = 0.0f;
1476 static inline void gcgQUATERNIONTOMATRIX4(MATRIX4d m, VECTOR4d q) {
1477 register double xx = (q)[0] * (q)[0], yy = (q)[1] * (q)[1], zz = (q)[2] * (q)[2];
1478 register double xy = (q)[0] * (q)[1], xz = (q)[0] * (q)[2], yz = (q)[1] * (q)[2];
1479 register double xw = (q)[0] * (q)[3], yw = (q)[1] * (q)[3], zw = (q)[2] * (q)[3];
1480 m[0] = (1.0 - (yy + yy + zz + zz));
1481 m[1] = (xy + xy - zw - zw);
1482 m[2] = (xz + xz + yw + yw);
1484 m[4] = (xy + xy + zw + zw);
1485 m[5] = (1.0 - (zz + zz + xx + xx));
1486 m[6] = (yz + yz - xw - xw);
1488 m[8] = (xz + xz - yw - yw);
1489 m[9] = (yz + yz + xw + xw);
1490 m[10] = (1.0 - (yy + yy + xx + xx));
1491 m[11] = m[12] = m[13] = m[14] = 0.0f;
1496 static inline void gcgAXISTOQUATERNION(VECTOR4 q,
float phi, VECTOR3 a) {
1497 gcgSCALEVECTOR3(q, a, sinf(phi * 0.5f));
1498 q[3] = cosf(phi * 0.5f);
1501 static inline void gcgAXISTOQUATERNION(VECTOR4d q,
double phi, VECTOR3d a) {
1502 register double factor = sin(phi * 0.5);
1503 gcgSCALEVECTOR3(q, a, factor);
1504 q[3] = cos(phi * 0.5);
1509 #define gcgQUATERNIONTOAXIS(angle, a, q) { \ 1510 register double cos_a = q[3]; \ 1511 angle = acos(cos_a) * 2; \ 1512 register double sin_a = sqrt(1.0 - cos_a * cos_a ); \ 1513 if(fabs(sin_a) < 0.0005) sin_a = 1.0; \ 1514 gcgSETVECTOR3(a, q[0] / sin_a, q[1] / sin_a, q[2] / sin_a); } 1519 #define gcgQUATERNIONTOMATRIX3(m, q) { \ 1520 register double xx = (q)[0] * (q)[0], yy = (q)[1] * (q)[1], zz = (q)[2] * (q)[2];\ 1521 register double xy = (q)[0] * (q)[1], xz = (q)[0] * (q)[2], yz = (q)[1] * (q)[2];\ 1522 register double xw = (q)[0] * (q)[3], yw = (q)[1] * (q)[3], zw = (q)[2] * (q)[3];\ 1523 m[0] = (1.0 - 2.0 * ( yy + zz)); \ 1524 m[1] = (2.0 * (xy - zw)); \ 1525 m[2] = (2.0 * (xz + yw)); \ 1526 m[3] = (2.0 * (xy + zw)); \ 1527 m[4] = (1.0 - 2.0 * (zz + xx)); \ 1528 m[5] = (2.0 * (yz - xw)); \ 1529 m[6] = (2.0 * (xz - yw)); \ 1530 m[7] = (2.0 * (yz + xw)); \ 1531 m[8] = (1.0 - 2.0 * (yy + xx)); } 1534 #define gcgQUATERNIONTOMATRIX34(m, q) { \ 1535 register double xx = (q)[0] * (q)[0], yy = (q)[1] * (q)[1], zz = (q)[2] * (q)[2];\ 1536 register double xy = (q)[0] * (q)[1], xz = (q)[0] * (q)[2], yz = (q)[1] * (q)[2];\ 1537 register double xw = (q)[0] * (q)[3], yw = (q)[1] * (q)[3], zw = (q)[2] * (q)[3];\ 1538 m[0] = (1.0 - 2.0 * ( yy + zz)); \ 1539 m[1] = (2.0 * (xy - zw)); \ 1540 m[2] = (2.0 * (xz + yw)); \ 1542 m[4] = (2.0 * (xy + zw)); \ 1543 m[5] = (1.0 - 2.0 * (zz + xx)); \ 1544 m[6] = (2.0 * (yz - xw)); \ 1546 m[8] = (2.0 * (xz - yw)); \ 1547 m[9] = (2.0 * (yz + xw)); \ 1548 m[10] = (1.0 - 2.0 * (yy + xx)); \ 1553 #define gcgMATRIX4TOQUATERNION(q, mat) { \ 1554 register double trace = 1.0 + (mat)[0] + (mat)[5] + (mat)[10]; \ 1555 if(trace > EPSILON) { \ 1556 double S = sqrt(trace) * 2.0; \ 1557 (q)[0] = ((mat)[9] - (mat)[6]) / S; \ 1558 (q)[1] = ((mat)[2] - (mat)[8]) / S; \ 1559 (q)[2] = ((mat)[4] - (mat)[1]) / S; \ 1560 (q)[3] = 0.25 * S; \ 1562 if((mat)[0] > (mat)[5] && (mat)[0] > (mat)[10]) { \ 1563 double S = sqrt(1.0 + (mat)[0] - (mat)[5] - (mat)[10]) * 2.0; \ 1564 (q)[0] = 0.25 * S; \ 1565 (q)[1] = ((mat)[4] + (mat)[1] ) / S; \ 1566 (q)[2] = ((mat)[2] + (mat)[8] ) / S; \ 1567 (q)[3] = ((mat)[9] - (mat)[6] ) / S; \ 1568 } else if((mat)[5] > (mat)[10]) { \ 1569 double S = sqrt(1.0 + (mat)[5] - (mat)[0] - (mat)[10] ) * 2.0; \ 1570 (q)[0] = ((mat)[4] + (mat)[1] ) / S; \ 1571 (q)[1] = 0.25 * S; \ 1572 (q)[2] = ((mat)[9] + (mat)[6] ) / S; \ 1573 (q)[3] = ((mat)[2] - (mat)[8] ) / S; \ 1575 double S = sqrt(1.0 + (mat)[10] - (mat)[0] - (mat)[5] ) * 2.0; \ 1576 (q)[0] = ((mat)[2] + (mat)[8] ) / S; \ 1577 (q)[1] = ((mat)[9] + (mat)[6] ) / S; \ 1578 (q)[2] = 0.25 * S; \ 1579 (q)[3] = ((mat)[4] - (mat)[1] ) / S; \ 1581 gcgNORMALIZEQUATERNION(q, q); } 1585 #define gcgTENSORPRODUCT3(result, v1, v2) { \ 1586 (result)[ 0] = (v1)[ 0] * (v2)[ 0]; \ 1587 (result)[ 1] = (v1)[ 0] * (v2)[ 1]; \ 1588 (result)[ 2] = (v1)[ 0] * (v2)[ 2]; \ 1589 (result)[ 3] = (v1)[ 1] * (v2)[ 0]; \ 1590 (result)[ 4] = (v1)[ 1] * (v2)[ 1]; \ 1591 (result)[ 5] = (v1)[ 1] * (v2)[ 2]; \ 1592 (result)[ 6] = (v1)[ 2] * (v2)[ 0]; \ 1593 (result)[ 7] = (v1)[ 2] * (v2)[ 1]; \ 1594 (result)[ 8] = (v1)[ 2] * (v2)[ 2]; } 1599 static inline void gcgEULERTOQUATERNION(VECTOR4 q,
float pitch,
float yaw,
float roll) {
1600 VECTOR4 qx = {sinf(pitch * -0.5f), 0.0f, 0.0f, cosf(pitch * -0.5f)};
1601 VECTOR4 qy = {0.0f, sinf(yaw * -0.5f), 0.0f, cosf(yaw * -0.5f)};
1602 VECTOR4 qz = {0.0f, 0.0f, sinf(roll * -0.5f), cosf(roll * -0.5f)};
1603 gcgMULTQUATERNION(qy, qy, qx);
1604 gcgMULTQUATERNION(q, qz, qy);
1607 static inline void gcgEULERTOQUATERNION(VECTOR4d q,
double pitch,
double yaw,
double roll) {
1608 VECTOR4d qx = {sin(pitch * -0.5), 0, 0, cos(pitch * -0.5)};
1609 VECTOR4d qy = {0, sin(yaw * -0.5), 0, cos(yaw * -0.5)};
1610 VECTOR4d qz = {0, 0, sin(roll * -0.5), cos(roll * -0.5)};
1611 gcgMULTQUATERNION(qy, qy, qx);
1612 gcgMULTQUATERNION(q, qz, qy);
1617 static inline void gcgAPPLYQUATERNIONVECTOR3(VECTOR4 vi, VECTOR4 qr, VECTOR3 va) {
1619 gcgCONJUGATEQUATERNION(qi, qr);
1620 gcgCOPYVECTOR3((
float*) kr, va);
1622 gcgMULTQUATERNION(kr, qr, kr);
1623 gcgMULTQUATERNION(kr, kr, qi);
1624 gcgCOPYVECTOR3(vi, kr);
1627 static inline void gcgAPPLYQUATERNIONVECTOR3(VECTOR4d vi, VECTOR4d qr, VECTOR3d va) {
1629 gcgCONJUGATEQUATERNION(qi, qr);
1630 gcgCOPYVECTOR3((
double*) kr, va);
1632 gcgMULTQUATERNION(kr, qr, kr);
1633 gcgMULTQUATERNION(kr, kr, qi);
1634 gcgCOPYVECTOR3(vi, kr);
1733 GCG_API_FUNCTION
bool gcgEigenSymmetric(
int norder,
float matrix[],
float eigenvectors[],
float eigenvalues[]);
1749 GCG_API_FUNCTION
bool gcgEigenSymmetric(
int norder,
double matrix[],
double eigenvectors[],
double eigenvalues[]);
1789 template<
class NUMTYPE>
class GCG_API_CLASS gcgMATRIX;
1817 GCG_API_FUNCTION
bool gcgDrawLogo(
float scale = 0.67);
1824 GCG_API_FUNCTION
bool gcgDrawAABox(VECTOR3 bbmin, VECTOR3 bbmax);
1831 GCG_API_FUNCTION
bool gcgDrawAABox(VECTOR3d bbmin, VECTOR3d bbmax);
1841 GCG_API_FUNCTION
bool gcgDrawOBox(VECTOR3 obbangles, VECTOR3 obbcenter, VECTOR3 obbsize);
1851 GCG_API_FUNCTION
bool gcgDrawOBox(VECTOR3d obbangles, VECTOR3d obbcenter, VECTOR3d obbsize);
1865 GCG_API_FUNCTION
bool gcgDrawVectorPyramid(
float x,
float y,
float z, VECTOR3 vector,
float scale);
1879 GCG_API_FUNCTION
bool gcgDrawVectorPyramid(
float x,
float y,
float z, VECTOR3d vector,
float scale);
1985 GCG_API_FUNCTION
bool gcgHeatColor(
float normheat, VECTOR3 color);
1994 GCG_API_FUNCTION
bool gcgHeatColor(
double normheat, VECTOR3d color);
2007 #define GCG_FONT_VERSION 0xf010 2010 #define GCG_FONT_UNCOMPRESSED 0 2011 #define GCG_FONT_COMPRESSED_RLE 1 2013 #pragma pack(push, 1) // Must have 1 byte alignment 2016 typedef struct _GCGFONTDATA {
2018 unsigned short version;
2019 unsigned int fontdatasize;
2020 unsigned char compression;
2024 unsigned int height;
2025 unsigned int cellwidth;
2026 unsigned int cellheight;
2027 unsigned char firstASCII;
2030 unsigned int xoffset;
2031 unsigned int yoffset;
2032 unsigned int charheight;
2044 class GCG_API_CLASS gcgFONT :
public gcgCLASS {
2046 unsigned int textureID;
2047 unsigned int nchars;
2048 unsigned char firstASCII;
2051 unsigned int charheight;
2052 unsigned char *basewidths;
2059 bool loadGFF(
char *fontname);
2060 bool createFromData(GCGFONTDATA *font);
2064 void textLength(
unsigned int *strwidth,
unsigned int *strheight,
char *str,
int strlength);
2065 int charsThatFit(
float width,
char *str,
int strlength);
2070 GCG_API_FUNCTION
bool gcgSaveGFF(
char *name, GCGFONTDATA *gcgfont);
2071 GCG_API_FUNCTION GCGFONTDATA *gcgImportBFF(
char *name);
2084 #define GCG_SYSTEM_FONTS 12 2087 #define GCG_FONT_SANSSERIF_11_NORMAL 0 2088 #define GCG_FONT_TAHOMA_12_NORMAL 1 2089 #define GCG_FONT_TAHOMA_12_BOLD 2 2090 #define GCG_FONT_TAHOMA_13_NORMAL 3 2091 #define GCG_FONT_COURIERNEW_15_NORMAL 4 2092 #define GCG_FONT_COURIERNEW_15_BOLD 5 2093 #define GCG_FONT_COURIERNEW_15_ITALIC 6 2094 #define GCG_FONT_COURIERNEW_15_BOLDITALIC 7 2095 #define GCG_FONT_TAHOMA_17_NORMAL 8 2096 #define GCG_FONT_TAHOMA_17_BOLD 9 2097 #define GCG_FONT_TAHOMA_17_ITALIC 10 2098 #define GCG_FONT_TAHOMA_17_BOLDITALIC 11 2101 class GCG_API_CLASS gcgTEXT :
public gcgCLASS {
2104 gcgFONT *currentfont;
2105 float scalex, scaley;
2107 int borderpixels[2];
2121 bool setFont(gcgFONT *font);
2122 bool setSystemFont(
int fontindex);
2123 void fontScale(
float scalex,
float scaley);
2124 float setBestFitSystemFont(
char *str,
float width);
2125 gcgFONT* getCurrentFont();
2128 void enableTextBox(
float x,
float y,
float width,
float height);
2129 void enableTextBoxAt3DPos(
float xpos,
float ypos,
float zpos,
float width,
float height);
2130 void adjustTextBox(
float xoffset,
float yoffset,
float widthoffset,
float heightoffset);
2131 void setBorder(
int npixelsX,
int npixelsY);
2132 void disableTextBox();
2133 void drawTextBox(
float boxR,
float boxG,
float boxB,
float boxA,
float frameR,
float frameG,
float frameB,
float frameA,
float linewidth);
2136 void wrapText(
bool wraptobox);
2137 void textPosition(
float x,
float y);
2138 void textOrientation(
float angle);
2139 void gcgprintf(
const char *format, ...);
2144 void initTextOutput();
2145 void finishTextOutput();
2146 void outputText(
int length,
char *str);
2151 bool gcgGenerateSystemFontCode(
char *name, GCGFONTDATA *gcgfont);
2167 #define gcgADDPPOINTAABox(bbmin, bbmax, p) { \ 2168 if((bbmin)[0] > (p)[0]) (bbmin)[0] = (p)[0]; \ 2169 if((bbmin)[1] > (p)[1]) (bbmin)[1] = (p)[1]; \ 2170 if((bbmin)[2] > (p)[2]) (bbmin)[2] = (p)[2]; \ 2171 if((bbmax)[0] < (p)[0]) (bbmax)[0] = (p)[0]; \ 2172 if((bbmax)[1] < (p)[1]) (bbmax)[1] = (p)[1]; \ 2173 if((bbmax)[2] < (p)[2]) (bbmax)[2] = (p)[2]; } 2181 GCG_API_FUNCTION
void gcgQuaternionSlerp(VECTOR4 dest, VECTOR4 p, VECTOR4 q,
float t);
2185 GCG_API_FUNCTION
bool gcgComputeAlignMatrix(MATRIX4 matrix, VECTOR3 dir);
2188 GCG_API_FUNCTION
void gcgTrackball(VECTOR4 q,
float p1x,
float p1y,
float p2x,
float p2y);
2191 GCG_API_FUNCTION
void gcgAABoxFromOBox(VECTOR3 aabbmin, VECTOR3 aabbmax, VECTOR3 obbangles, VECTOR3 obbposition, VECTOR3 obbmin, VECTOR3 obbmax);
2194 GCG_API_FUNCTION
int gcgIntersectTriangleTriangle(VECTOR3 V0, VECTOR3 V1, VECTOR3 V2, VECTOR3 U0, VECTOR3 U1, VECTOR3 U2);
2195 GCG_API_FUNCTION
int gcgIntersectTriangleTriangleLine(VECTOR3 V0, VECTOR3 V1, VECTOR3 V2, VECTOR3 U0, VECTOR3 U1, VECTOR3 U2,
int *coplanar, VECTOR3 isectpt1, VECTOR3 isectpt2);
2196 GCG_API_FUNCTION
int gcgIntersectLineLine(VECTOR3 p1, VECTOR3 p2, VECTOR3 p3, VECTOR3 p4, VECTOR3 pa, VECTOR3 pb,
double *mua,
double *mub);
2197 GCG_API_FUNCTION
int gcgIntersectPointLine(VECTOR3 point, VECTOR3 edgeA, VECTOR3 edgeB);
2198 GCG_API_FUNCTION
int gcgIntersectPointTriangle(VECTOR3 p, VECTOR3 A, VECTOR3 B, VECTOR3 C);
2199 GCG_API_FUNCTION
bool gcgIntersectLineBox2D(VECTOR2 p1, VECTOR2 p2, VECTOR2 box2dMin, VECTOR2 box2dMax);
2210 GCG_API_FUNCTION
float gcgTriangleArea(VECTOR3 v0, VECTOR3 v1, VECTOR3 v2);
2222 GCG_API_FUNCTION
void gcgTriangleGradient(VECTOR3 grad_u, VECTOR3 v0, VECTOR3 v1, VECTOR3 v2,
float u0,
float u1,
float u2);
2233 GCG_API_FUNCTION
float gcgSphericalDistance(
float latitude1,
float longitude1,
float latitude2,
float longitude2);
2237 GCG_API_FUNCTION
void gcgQuaternionSlerp(VECTOR4d dest, VECTOR4d p, VECTOR4d q,
double t);
2238 GCG_API_FUNCTION
bool gcgComputeAlignMatrix(MATRIX4d matrix, VECTOR3d dir);
2239 GCG_API_FUNCTION
void gcgTrackball(VECTOR4d q,
double p1x,
double p1y,
double p2x,
double p2y);
2240 GCG_API_FUNCTION
void gcgAABoxFromOBox(VECTOR3d aabbmin, VECTOR3d aabbmax, VECTOR3d obbangles, VECTOR3d obbposition, VECTOR3d obbmin, VECTOR3d obbmax);
2241 GCG_API_FUNCTION
int gcgIntersectTriangleTriangle(VECTOR3d V0, VECTOR3d V1, VECTOR3d V2, VECTOR3d U0, VECTOR3d U1, VECTOR3d U2);
2242 GCG_API_FUNCTION
int gcgIntersectTriangleTriangleLine(VECTOR3d V0, VECTOR3d V1, VECTOR3d V2, VECTOR3d U0, VECTOR3d U1, VECTOR3d U2,
int *coplanar, VECTOR3d isectpt1, VECTOR3d isectpt2);
2243 GCG_API_FUNCTION
int gcgIntersectLineLine(VECTOR3d p1, VECTOR3d p2, VECTOR3d p3, VECTOR3d p4, VECTOR3d pa, VECTOR3d pb,
double *mua,
double *mub);
2244 GCG_API_FUNCTION
int gcgIntersectPointLine(VECTOR3d point, VECTOR3d edgeA, VECTOR3d edgeB);
2245 GCG_API_FUNCTION
int gcgIntersectPointTriangle(VECTOR3d p, VECTOR3d A, VECTOR3d B, VECTOR3d C);
2246 GCG_API_FUNCTION
bool gcgIntersectLineBox2D(VECTOR2d p1, VECTOR2d p2, VECTOR2d box2dMin, VECTOR2d box2dMax);
2247 GCG_API_FUNCTION
double gcgTriangleArea(VECTOR3d v0, VECTOR3d v1, VECTOR3d v2);
2248 GCG_API_FUNCTION
void gcgTriangleGradient(VECTOR3d grad_u, VECTOR3d v0, VECTOR3d v1, VECTOR3d v2,
double u0,
double u1,
double u2);
2249 GCG_API_FUNCTION
double gcgSphericalDistance(
double latitude1,
double longitude1,
double latitude2,
double longitude2);
2266 class gcgPOLYGONVERTEX :
public gcgCLASS {
2269 unsigned int nhalf_edges;
2270 unsigned int maxhalf_edges;
2271 struct _GCGHALFEDGE **half_edges;
2272 gcgPOLYGONVERTEX *prevVertex;
2273 gcgPOLYGONVERTEX *nextVertex;
2276 virtual ~gcgPOLYGONVERTEX() {}
2279 virtual bool isEqual(gcgPOLYGONVERTEX *vertex2);
2282 virtual void copy(gcgPOLYGONVERTEX *vertex2);
2292 template <
typename T>
2293 class gcgVERTEX3 :
public gcgPOLYGONVERTEX {
2298 virtual bool isEqual(T vertex2[3]) {
2299 return FEQUAL(this->position[0], vertex2[0]) &&
2300 FEQUAL(this->position[1], vertex2[1]) &&
2301 FEQUAL(this->position[2], vertex2[2]);
2304 virtual void copy(T vertex2[3]) {
2305 this->position[0] = vertex2[0];
2306 this->position[1] = vertex2[1];
2307 this->position[2] = vertex2[2];
2313 class GCG_API_CLASS gcgPOLYGON :
public gcgCLASS {
2315 unsigned int nvertices;
2316 struct _GCGHALFEDGE *half_edge;
2317 gcgPOLYGON *prevPolygon;
2318 gcgPOLYGON *nextPolygon;
2323 typedef struct _GCGHALFEDGE {
2324 gcgPOLYGONVERTEX *srcVertex;
2326 struct _GCGHALFEDGE *nextHalfEdge;
2327 struct _GCGHALFEDGE *prevHalfEdge;
2328 struct _GCGHALFEDGE *nextBrotherHalfEdge;
2329 struct _GCGHALFEDGE *prevBrotherHalfEdge;
2336 class GCG_API_CLASS gcgPOLYGONMESH :
public gcgCLASS {
2339 unsigned int npolygons;
2340 gcgPOLYGON *polygons;
2343 unsigned int nvertices;
2344 gcgPOLYGONVERTEX *vertices;
2347 GCGHALFEDGE* last_half_edge;
2348 GCGHALFEDGE* first_half_edge_brother;
2349 GCGHALFEDGE* last_half_edge_brother;
2354 virtual ~gcgPOLYGONMESH();
2357 void destroyPolygon();
2360 bool addPolygon(gcgPOLYGON *polygon);
2361 bool addVertex(gcgPOLYGONVERTEX *vertex);
2362 gcgPOLYGONVERTEX* findSimilarVertex(gcgPOLYGONVERTEX *vertex);
2365 bool addPolygonVertex(gcgPOLYGON *ipolygon, gcgPOLYGONVERTEX *vertex,
unsigned int newvertexIndex = 0);
2368 gcgPOLYGONVERTEX* getPolygonVertex(gcgPOLYGON *polygon,
unsigned int vertexIndex);
2369 gcgPOLYGONVERTEX* getPolygonNextVertex();
2370 gcgPOLYGON* getPolygonFromEdge(gcgPOLYGONVERTEX *vertexID1, gcgPOLYGONVERTEX *vertexID2);
2371 gcgPOLYGON* getNextPolygonFromEdge();
2374 bool removeVertex(gcgPOLYGONVERTEX *vertex);
2375 bool removeEdge(gcgPOLYGONVERTEX *vertex1, gcgPOLYGONVERTEX *vertex2);
2376 bool removePolygon(gcgPOLYGON *ipolygon);
2377 bool removeHalfEdge(GCGHALFEDGE* ihalf_edge);
2378 unsigned int removeIsolatedVertices();
2381 bool edgeCollapse(gcgPOLYGONVERTEX *vertexID1, gcgPOLYGONVERTEX *vertex2);
2382 bool halfEdgeCollapse(gcgPOLYGONVERTEX *vertexID1, gcgPOLYGONVERTEX *vertex2, gcgPOLYGONVERTEX *newvertex);
2383 bool edgeFlip(gcgPOLYGONVERTEX *vertex1, gcgPOLYGONVERTEX *vertex2);
2384 bool edgeWeld(gcgPOLYGONVERTEX *vertex);
2385 bool edgeSplit(gcgPOLYGONVERTEX *vertex1, gcgPOLYGONVERTEX *vertex2, gcgPOLYGONVERTEX *newvertex);
2386 bool polygonSplit(gcgPOLYGON *ipolygon,
unsigned int vertexIndex, gcgPOLYGONVERTEX *newvertex);
2389 bool testLinkCondition(gcgPOLYGONVERTEX *vertex1, gcgPOLYGONVERTEX *vertex2);
2392 unsigned int getValence(gcgPOLYGONVERTEX *vertexID);
2396 bool getVertexStar(gcgPOLYGONVERTEX *vertex, gcgPOLYGONVERTEX **starVertexVertices,
unsigned int* numVertices, gcgPOLYGON **starVertexPolygons,
unsigned int* numPolygons);
2397 unsigned int getVerticesVertexStar(gcgPOLYGONVERTEX *vertexIndex, gcgPOLYGONVERTEX **starVertexVertices,
unsigned int* numVertices);
2398 unsigned int getPolygonsVertexStar(gcgPOLYGONVERTEX *vertexID, gcgPOLYGON **starVertexPolygons,
unsigned int* numPolygons);
2400 unsigned int getEdgeStar(gcgPOLYGONVERTEX *vertex1, gcgPOLYGONVERTEX *vertex2, gcgPOLYGONVERTEX **starEdgeVertices,
unsigned int* numVertices, gcgPOLYGON **starEdgePolygons,
unsigned int* numPolygons);
2402 bool getStarIntersection(gcgPOLYGONVERTEX** starVertexVertices1, gcgPOLYGON** starVertexPolygons1, gcgPOLYGONVERTEX** starVertexVertices2, gcgPOLYGON** starVertexPolygons2, gcgPOLYGONVERTEX** starIntersectionVertices, gcgPOLYGON** starIntersectionPolygons,
unsigned int numVertices1,
unsigned int numPolygons1,
unsigned int numVertices2,
unsigned int numPolygons2,
unsigned int* numVerticesIntersection,
unsigned int* numPolygonsIntersection);
2404 bool starComparison(gcgPOLYGONVERTEX** starVertices1, gcgPOLYGON** starPolygons1, gcgPOLYGONVERTEX** starVertices2, gcgPOLYGON** starPolygons2,
unsigned int numVertices1,
unsigned int numPolygons1,
unsigned int numVertices2,
unsigned int numPolygons2);
2408 void testVertex(
unsigned int vertexIndex);
2409 void testHalfEdgeBrother(GCGHALFEDGE* ihalf_edge);
2410 void testPolygons();
2411 void testStar(
unsigned int *starVertex[2],
unsigned int numVertices,
unsigned int numPolygons);
2412 void testStarVertices(gcgPOLYGONVERTEX** starVertexVertices,
unsigned int numVertices);
2413 void testStarVerticesRemove(gcgPOLYGONVERTEX** starVertexVertices,
unsigned int numVertices);
2414 void testStarPolygons(gcgPOLYGON** starVertexPolygons,
unsigned int numPolygons);
2415 void testStarPolygonsRemove(gcgPOLYGON** starVertexPolygons,
unsigned int numPolygons);
2416 void testHalfEdgeBrother2();
2417 void testHalfEdgeBrother3();
2455 #define GCG_TOPOLOGY_PLANE 0 // Default topology 2456 #define GCG_TOPOLOGY_CYLINDER 1 2457 #define GCG_TOPOLOGY_TORUS 2 2473 #define GCG_REFINE ((unsigned char) 0x01) 2474 #define GCG_SIMPLIFY ((unsigned char) 0x02) 2475 #define GCG_MAXIMUMLOD ((unsigned char) 0x04) 2476 #define GCG_MINIMUMLOD ((unsigned char) 0x08) 2477 #define GCG_INVISIBLE ((unsigned char) 0x10) 2478 #define GCG_TOTALLYVISIBLE ((unsigned char) 0x20) 2479 #define GCG_SELECT0 ((unsigned char) 0x40) 2480 #define GCG_SELECT1 ((unsigned char) 0x80) 2491 class GCG_API_CLASS gcgADAPTIVE :
public gcgCLASS {
2509 virtual void beginTesselation() = 0;
2528 virtual unsigned char action(
unsigned char nivel,
int *iVertices,
unsigned char oldmask) = 0;
2550 virtual int sample(
int *iVertices,
int apex2) = 0;
2556 virtual void endTesselation() = 0;
2566 class GCG_API_CLASS gcgSEMIREGULAR48 :
public gcgCLASS {
2569 typedef struct __nodo {
2574 unsigned char nivel;
2587 typedef struct __frontinfo {
2588 unsigned char lastmask;
2592 unsigned char topology;
2594 gcgADAPTIVE *geometria;
2610 unsigned char hidemask;
2613 unsigned char showmask;
2620 void divide_node(
int inodo);
2621 void triangle_bissection(
int inodo,
int novovertice,
int ifilhoesq);
2622 int initTesselation(gcgADAPTIVE *geo);
2630 virtual ~gcgSEMIREGULAR48();
2632 void setTopology(
int topologycode);
2639 int tesselate(
int maxtriang, gcgADAPTIVE *geometry);
2648 int tesselate(gcgADAPTIVE *geometry);
2652 int* getIndexArray(
int *ntriang);
2655 int hideTriangles(
unsigned char hidemask,
unsigned char mustshowmask);
2672 template<
class NUMTYPE>
class GCG_API_CLASS gcgDISCRETE1D;
2673 template<
class NUMTYPE>
class GCG_API_CLASS gcgDISCRETE2D;
2683 #define GCG_BORDER_EXTENSION_ZERO 1 2687 #define GCG_BORDER_EXTENSION_CLAMP 2 2691 #define GCG_BORDER_EXTENSION_PERIODIC 3 2695 #define GCG_BORDER_EXTENSION_SYMMETRIC_NOREPEAT 4 2699 #define GCG_BORDER_EXTENSION_SYMMETRIC_REPEAT 5 2730 template <
class NUMTYPE =
float>
class GCG_API_CLASS gcgSEQUENCEDERIVATIVE2D;
2731 template <
class NUMTYPE =
float>
class GCG_API_CLASS gcgFILTERMASK1D;
2741 template<
class NUMTYPE> GCG_API_FUNCTION
double computeMSEwith(gcgDISCRETE2D<NUMTYPE> *src1, gcgDISCRETE2D<NUMTYPE> *src2);
2742 template<
class NUMTYPE> GCG_API_FUNCTION
double computePSNRwith(gcgDISCRETE2D<NUMTYPE> *src1, gcgDISCRETE2D<NUMTYPE> *src2);
2743 template<
class NUMTYPE> GCG_API_FUNCTION
double computeMAEwith(gcgDISCRETE2D<NUMTYPE> *src1, gcgDISCRETE2D<NUMTYPE> *src2);
2756 template<
class NUMTYPE> GCG_API_FUNCTION
bool gcgGradientSobel2D(gcgDISCRETE2D<NUMTYPE> *src, gcgDISCRETE2D<NUMTYPE> *dx, gcgDISCRETE2D<NUMTYPE> *dy);
2761 template<
class NUMTYPE> GCG_API_FUNCTION
bool gcgOpticalFlowAugereau2D(gcgDISCRETE2D<NUMTYPE> *dx1, gcgDISCRETE2D<NUMTYPE> *dy1, gcgDISCRETE2D<NUMTYPE> *dt1,
2762 gcgDISCRETE2D<NUMTYPE> *dx2, gcgDISCRETE2D<NUMTYPE> *dy2, gcgDISCRETE2D<NUMTYPE> *dt2,
2763 gcgDISCRETE2D<NUMTYPE> *dx3, gcgDISCRETE2D<NUMTYPE> *dy3, gcgDISCRETE2D<NUMTYPE> *dt3,
2764 gcgDISCRETE2D<float> *outflowX, gcgDISCRETE2D<float> *outflowY);
2765 template<
class NUMTYPE> GCG_API_FUNCTION
bool gcgOpticalFlowAugereau2D(gcgDISCRETE2D<NUMTYPE> *dx1, gcgDISCRETE2D<NUMTYPE> *dy1, gcgDISCRETE2D<NUMTYPE> *dt1,
2766 gcgDISCRETE2D<NUMTYPE> *dx2, gcgDISCRETE2D<NUMTYPE> *dy2, gcgDISCRETE2D<NUMTYPE> *dt2,
2767 gcgDISCRETE2D<NUMTYPE> *dx3, gcgDISCRETE2D<NUMTYPE> *dy3, gcgDISCRETE2D<NUMTYPE> *dt3,
2768 gcgDISCRETE2D<double> *outflowX, gcgDISCRETE2D<double> *outflowY);
2786 template <
class NUMTYPE =
float>
2789 virtual unsigned int getNumberOfCoefficients() = 0;
2795 virtual bool setNumberOfSamples(
unsigned int nsamples) = 0;
2810 virtual bool projectSignal(
int atX, gcgDISCRETE1D<float> *vector,
gcgDISCRETE1D<NUMTYPE> *outputcoef) = 0;
2811 virtual bool projectSignal(
int atX, gcgDISCRETE1D<double> *vector,
gcgDISCRETE1D<NUMTYPE> *outputcoef) = 0;
2812 virtual bool projectSignal(
int atX, gcgDISCRETE1D<short> *vector,
gcgDISCRETE1D<NUMTYPE> *outputcoef) = 0;
2814 virtual bool projectSignal(
int atX, gcgDISCRETE1D<long> *vector,
gcgDISCRETE1D<NUMTYPE> *outputcoef) = 0;
2827 virtual bool reconstructSignal(
int atX,
gcgDISCRETE1D<NUMTYPE> *inputcoef, gcgDISCRETE1D<float> *outputvector) = 0;
2828 virtual bool reconstructSignal(
int atX,
gcgDISCRETE1D<NUMTYPE> *inputcoef, gcgDISCRETE1D<double> *outputvector) = 0;
2829 virtual bool reconstructSignal(
int atX,
gcgDISCRETE1D<NUMTYPE> *inputcoef, gcgDISCRETE1D<short> *outputvector) = 0;
2830 virtual bool reconstructSignal(
int atX,
gcgDISCRETE1D<NUMTYPE> *inputcoef, gcgDISCRETE1D<int> *outputvector) = 0;
2831 virtual bool reconstructSignal(
int atX,
gcgDISCRETE1D<NUMTYPE> *inputcoef, gcgDISCRETE1D<long> *outputvector) = 0;
2837 template <
class NUMTYPE =
float>
2840 virtual unsigned int getNumberOfCoefficients() = 0;
2853 virtual bool projectSignal(
int atX,
int atY, gcgDISCRETE2D<float> *vector,
gcgDISCRETE1D<NUMTYPE> *outputcoef) = 0;
2854 virtual bool projectSignal(
int atX,
int atY, gcgDISCRETE2D<double> *vector,
gcgDISCRETE1D<NUMTYPE> *outputcoef) = 0;
2855 virtual bool projectSignal(
int atX,
int atY, gcgDISCRETE2D<short> *vector,
gcgDISCRETE1D<NUMTYPE> *outputcoef) = 0;
2856 virtual bool projectSignal(
int atX,
int atY, gcgDISCRETE2D<int> *vector,
gcgDISCRETE1D<NUMTYPE> *outputcoef) = 0;
2857 virtual bool projectSignal(
int atX,
int atY, gcgDISCRETE2D<long> *vector,
gcgDISCRETE1D<NUMTYPE> *outputcoef) = 0;
2871 virtual bool reconstructSignal(
int atX,
int atY,
gcgDISCRETE1D<NUMTYPE> *inputcoef, gcgDISCRETE2D<float> *outputvector) = 0;
2872 virtual bool reconstructSignal(
int atX,
int atY,
gcgDISCRETE1D<NUMTYPE> *inputcoef, gcgDISCRETE2D<double> *outputvector) = 0;
2873 virtual bool reconstructSignal(
int atX,
int atY,
gcgDISCRETE1D<NUMTYPE> *inputcoef, gcgDISCRETE2D<short> *outputvector) = 0;
2874 virtual bool reconstructSignal(
int atX,
int atY,
gcgDISCRETE1D<NUMTYPE> *inputcoef, gcgDISCRETE2D<int> *outputvector) = 0;
2875 virtual bool reconstructSignal(
int atX,
int atY,
gcgDISCRETE1D<NUMTYPE> *inputcoef, gcgDISCRETE2D<long> *outputvector) = 0;
2878 template<
class NUMTYPE>
class GCG_API_CLASS gcgLEGENDREBASIS1D;
2879 template<
class NUMTYPE>
class GCG_API_CLASS gcgLEGENDREBASIS2D;
2880 template<
class NUMTYPE>
class GCG_API_CLASS gcgDWTBASIS1D;
2934 unsigned int colormasks[4];
2935 unsigned int max[4];
2938 unsigned int rightshift[4];
2939 unsigned int nbits[4];
2974 bool createImage(
unsigned int width,
unsigned int height,
unsigned int bpp,
bool usealpha =
false);
2990 bool createSimilar(
gcgIMAGE *source);
2999 bool destroyImage();
3009 bool isCompatibleWith(
gcgIMAGE *source);
3035 bool duplicateImage(
gcgIMAGE *source);
3054 bool duplicateSubimage(
gcgIMAGE *source,
int left,
int top,
unsigned int width,
unsigned int height);
3078 bool loadImage(
const char *filename);
3087 bool loadJPG(
const char *filename);
3096 bool loadBMP(
const char *filename);
3105 bool loadPCX(
const char *filename);
3114 bool loadTGA(
const char *filename);
3122 bool saveBMP(
const char *filename);
3134 bool saveJPG(
const char *filename ,
int quality);
3149 bool getPixelColor(
unsigned int i,
unsigned int j, VECTOR4 color);
3164 bool setPixelColor(
unsigned int i,
unsigned int j, VECTOR4 color);
3173 int getPixelIndex(
unsigned int i,
unsigned int j);
3183 bool setPixelIndex(
unsigned int i,
unsigned int j,
int newindex);
3194 bool getPaletteColor(
int index, VECTOR4 color);
3205 bool setPaletteColor(
int index, VECTOR4 color);
3226 bool convolutionX(
gcgIMAGE *source, gcgDISCRETE1D<float> *mask,
float addthis = 0);
3247 bool convolutionY(
gcgIMAGE *source, gcgDISCRETE1D<float> *mask,
float addthis = 0);
3270 bool convolutionXY(
gcgIMAGE *source, gcgDISCRETE2D<float> *mask,
float addthis = 0);
3294 bool templateMatching(
unsigned int imgleft,
unsigned int imgbottom,
unsigned int imgwidth,
unsigned int imgheight, gcgDISCRETE2D<float> *mask, VECTOR2 position);
3308 bool transformColorSpace(
gcgIMAGE *source, MATRIX4 matrix);
3323 bool convertBits(
gcgIMAGE *source,
unsigned int newbpp);
3337 bool convertGrayScale(
gcgIMAGE *source);
3350 bool convertGrayScale8bits(
gcgIMAGE *source);
3374 bool forceLinearPalette();
3394 bool scale(
float weight,
gcgIMAGE *source,
float addthis = 0.0);
3419 bool combineAdd(
gcgIMAGE *source1,
gcgIMAGE *source2,
float weight1 = 1.0,
float weight2 = 1.0,
float addthis = 0.0);
3445 bool combineMult(
gcgIMAGE *source1,
gcgIMAGE *source2,
float add1 = 0.0,
float add2 = 0.0,
float addthis = 0.0);
3505 bool exportChannels(gcgDISCRETE2D<float> *red, gcgDISCRETE2D<float> *green, gcgDISCRETE2D<float> *blue, gcgDISCRETE2D<float> *alpha);
3522 bool exportChannels(gcgDISCRETE2D<double> *red, gcgDISCRETE2D<double> *green, gcgDISCRETE2D<double> *blue, gcgDISCRETE2D<double> *alpha);
3541 bool exportChannels(gcgDISCRETE2D<short> *red, gcgDISCRETE2D<short> *green, gcgDISCRETE2D<short> *blue, gcgDISCRETE2D<short> *alpha);
3560 bool exportChannels(gcgDISCRETE2D<int> *red, gcgDISCRETE2D<int> *green, gcgDISCRETE2D<int> *blue, gcgDISCRETE2D<int> *alpha);
3579 bool exportChannels(gcgDISCRETE2D<long> *red, gcgDISCRETE2D<long> *green, gcgDISCRETE2D<long> *blue, gcgDISCRETE2D<long> *alpha);
3599 bool importChannels(gcgDISCRETE2D<float> *red, gcgDISCRETE2D<float> *green, gcgDISCRETE2D<float> *blue, gcgDISCRETE2D<float> *alpha);
3619 bool importChannels(gcgDISCRETE2D<double> *red, gcgDISCRETE2D<double> *green, gcgDISCRETE2D<double> *blue, gcgDISCRETE2D<double> *alpha);
3642 bool importChannels(gcgDISCRETE2D<short> *red, gcgDISCRETE2D<short> *green, gcgDISCRETE2D<short> *blue, gcgDISCRETE2D<short> *alpha);
3665 bool importChannels(gcgDISCRETE2D<int> *red, gcgDISCRETE2D<int> *green, gcgDISCRETE2D<int> *blue, gcgDISCRETE2D<int> *alpha);
3688 bool importChannels(gcgDISCRETE2D<long> *red, gcgDISCRETE2D<long> *green, gcgDISCRETE2D<long> *blue, gcgDISCRETE2D<long> *alpha);
3694 bool histogramRGBA(
unsigned int hvectorR[256],
unsigned int hvectorG[256],
unsigned int hvectorB[256],
unsigned int hvectorA[256]);
3695 bool histogramGray(
unsigned int hvector[256]);
3696 int histogramIndex(
unsigned int vectorsize,
unsigned int *hvector);
3697 bool equalizeHistogram(
gcgIMAGE *source);
3704 bool binarizeRGBA(
gcgIMAGE *srcimage,
int threR,
int threG,
int threB,
int threA);
3705 bool binarizeGray(
gcgIMAGE *srcimage,
int threshold);
3706 bool binarizeIndex(
gcgIMAGE *srcimage,
int threshold);
3712 bool verticalFlip();
3717 bool unpackBMP(
void *bmpHeader,
unsigned char *bmpdata,
unsigned int npalcolors,
unsigned char *pal);
3721 bool loadUncompressed8BitTGA(FILE *file);
3722 bool loadUncompressedTrueColorTGA(FILE *file);
3723 bool loadCompressedTrueColorTGA(FILE *file);
3726 bool unpackPalettedBMP(
void *bmpHeader,
unsigned char *bmpdata,
unsigned int npalcolors,
unsigned char *pal);
3727 bool unpack16BitBMP(
void *bmpHeader,
unsigned char *bmpdata,
unsigned int npalcolors,
unsigned char *pal);
3728 bool unpack24BitBMP(
void *bmpHeader,
unsigned char *bmpdata);
3729 bool unpack32BitBMP(
void *bmpHeader,
unsigned char *bmpdata,
unsigned int npalcolors,
unsigned char *pal);
3732 bool convertPalettedto8Bits(
gcgIMAGE *srcimage);
3733 bool convertPalettedto24Bits(
gcgIMAGE *srcimage);
3734 bool convert16Bitsto24Bits(
gcgIMAGE *srcimage);
3735 bool convert32Bitsto24Bits(
gcgIMAGE *srcimage);
3736 bool convert16Bitsto32Bits(
gcgIMAGE *srcimage);
3770 GCG_API_FUNCTION
unsigned int gcgPackRLE8(
unsigned int fullsize,
unsigned char *srcdata,
unsigned char *RLEdata);
3780 GCG_API_FUNCTION
unsigned int gcgUnpackRLE8(
unsigned char *RLEdata,
unsigned char *dstdata);
3792 GCG_API_FUNCTION
unsigned int gcgPackRLE32(
unsigned int fullsize,
unsigned char *srcdata,
unsigned char *RLEdata);
3802 GCG_API_FUNCTION
unsigned int gcgUnpackRLE32(
unsigned char *RLEdata,
unsigned char *dstdata);
3821 GCG_API_FUNCTION
unsigned int gcgCompressImageRLE8(
unsigned int width,
unsigned int height,
unsigned char *srcdata,
unsigned char *RLEdata);
3835 GCG_API_FUNCTION
unsigned int gcgDecompressImageRLE8(
unsigned int width,
unsigned int height,
unsigned char *RLEdata,
unsigned char *dstdata);
3846 GCG_API_FUNCTION
unsigned int gcgDecompressImageRLE4(
unsigned int width,
unsigned int height,
unsigned char *RLEdata,
unsigned char *dstdata);
3863 GCG_API_FUNCTION
bool gcgSaveBytesAsText(
unsigned int size,
unsigned char *data,
char *outputname);
3872 GCG_API_FUNCTION
bool gcgSaveFloatsAsText(
unsigned int size,
float *data,
char *outputname);
3880 GCG_API_FUNCTION
bool gcgSaveBMPcode(
char *inputname,
char *outputname);
3894 #define GCG_PLOT_MAX_LINES 16 // In any implementation, supremum is 255 lines 3895 #define GCG_PLOT_MAX_AXIS 3 // Prepared for 3D plots 3898 #define GCG_PLOT_X 0 3899 #define GCG_PLOT_Y 1 3900 #define GCG_PLOT_Z 2 3902 #define GCG_PLOT_RANGE_INI 0 3903 #define GCG_PLOT_RANGE_END 1 3905 class GCG_API_CLASS gcgPLOT :
public gcgCLASS {
3908 typedef struct __line {
3912 unsigned short bitpattern;
3915 unsigned int maxdata;
3920 typedef struct __axis {
3924 unsigned short bitpattern;
3930 LINE lines[GCG_PLOT_MAX_LINES];
3931 unsigned int nlines;
3934 AXIS axis[GCG_PLOT_MAX_AXIS];
3939 float frameR, frameG, frameB, frameA;
3940 float plotR, plotG, plotB, plotA;
3942 unsigned int gridpixelsX;
3943 unsigned int gridpixelsY;
3944 float gridR, gridG, gridB, gridA;
3948 unsigned int textWidthX, textHeightX;
3949 unsigned int textWidthY, textHeightY;
3960 bool addPoint2D(
unsigned int lineindex,
float x,
float y);
3961 void setAxisRange(
unsigned int axis,
float ini,
float end);
3962 void clipOutOfRange(
unsigned int lineindex,
unsigned int iaxis);
3963 void rangeFromData(
unsigned int iaxis);
3964 void clearData(
unsigned int lineindex);
3965 void clearAllData();
3969 void setFrame(
float x,
float y,
float width,
float height,
float linewidth);
3970 void adjustFrame(
float xoffset,
float yoffset,
float widthoffset,
float heightoffset);
3971 void setFrameColor(
float r,
float g,
float b,
float a);
3973 void setPlotColor(
float r,
float g,
float b,
float a);
3974 void setGrid(
unsigned int pixelsx,
unsigned int pixelsy);
3975 void setGridColor(
float r,
float g,
float b,
float a);
3977 void setAxis(
unsigned int axis,
char *title,
float r,
float g,
float b,
float a,
float linewidth,
unsigned short bitpattern);
3978 void setLine(
unsigned char lineindex,
char *linename,
float r,
float g,
float b,
float a,
float linewidth,
unsigned short bitpattern);
4002 class GCG_API_CLASS gcgRANDOM :
public gcgCLASS {
4003 #define GCG_MERSENNE_N 624 4004 #define GCG_MERSENNE_MATRIX_A 0x9908b0df // Constant vector a 4007 unsigned long mt[GCG_MERSENNE_N];
4008 unsigned long mag01[2];
4010 unsigned int lastInterval;
4011 unsigned int RLimit;
4016 gcgRANDOM(
unsigned int seed);
4017 virtual ~gcgRANDOM();
4020 void setSeed(
unsigned int seed);
4023 unsigned int bitRandom();
4027 int intRandom(
int min,
int max);
4028 float floatRandom(
float min,
float max);
4029 double doubleRandom(
double min,
double max);
4038 class GCG_API_CLASS gcgRANDOMGAUSSIAN :
public gcgCLASS {
4047 gcgRANDOMGAUSSIAN();
4048 gcgRANDOMGAUSSIAN(
unsigned int seed1,
unsigned int seed2);
4049 virtual ~gcgRANDOMGAUSSIAN();
4052 void setSeed(
unsigned int seed1,
unsigned int seed2);
4061 class GCG_API_CLASS gcgRANDOMVECTOR :
public gcgCLASS {
4069 gcgRANDOMVECTOR(
unsigned int seed1,
unsigned int seed2);
4070 virtual ~gcgRANDOMVECTOR();
4073 void setSeed(
unsigned int seed1,
unsigned int seed2);
4076 void random(VECTOR3 v);
4077 void random(VECTOR3d v);
4099 void startingEvents();
4107 float finishedEvents(
int nevents = 1);
4114 float getEventsPerSecond();
4123 GCG_API_FUNCTION
int gcgPDFfromHistogram(
float *pdf,
unsigned int *histogram,
unsigned int Nbins);
4129 GCG_API_FUNCTION
unsigned int gcgOptimalThresholdOtsu(
float *pdf,
unsigned int left,
unsigned int right);
4133 GCG_API_FUNCTION
int gcgPDFfromHistogram(
double *pdf,
unsigned int *histogram,
unsigned int Nbins);
4134 GCG_API_FUNCTION
unsigned int gcgOptimalThresholdOtsu(
double *pdf,
unsigned int left,
unsigned int right);
4146 #define GCG_FRUSTUM_PARTIAL -1 4147 #define GCG_FRUSTUM_OUTSIDE 0 4148 #define GCG_FRUSTUM_INSIDE 1 4151 class GCG_API_CLASS gcgFRUSTUM :
public gcgCLASS {
4162 VECTOR4d orientation;
4163 MATRIX4d view_matrix;
4166 MATRIX4d proj_matrix;
4170 float topA, topB, topC, topD;
4173 float bottomA, bottomB, bottomC, bottomD;
4176 float farA, farB, farC, farD;
4179 float nearA, nearB, nearC, nearD;
4182 float rightA, rightB, rightC, rightD;
4185 float leftA, leftB, leftC, leftD;
4190 virtual ~gcgFRUSTUM();
4196 void setPosition(
float x,
float y,
float z);
4197 void setPosition(
double x,
double y,
double z);
4198 void setPosition(VECTOR3 pos);
4199 void setPosition(VECTOR3d pos);
4201 void movePosition(
float dx,
float dy,
float dz);
4202 void movePosition(
double dx,
double dy,
double dz);
4203 void movePosition(VECTOR3 pos);
4204 void movePosition(VECTOR3d pos);
4206 void advancePosition(
float forward,
float upward,
float rightward);
4207 void advancePosition(
double forward,
double upward,
double rightward);
4210 void resetOrientation();
4212 void setViewVector(
float dirX,
float dirY,
float dirZ);
4213 void setViewVector(
double dirX,
double dirY,
double dirZ);
4214 void setViewVector(VECTOR3 dir);
4215 void setViewVector(VECTOR3d dir);
4217 void setViewVectorSpherical(
float latit,
float longit);
4218 void setViewVectorSpherical(
double latit,
double longit);
4220 void setUpVector(
float cimaX,
float cimaY,
float cimaZ);
4221 void setUpVector(
double cimaX,
double cimaY,
double cimaZ);
4222 void setUpVector(VECTOR3 cima);
4223 void setUpVector(VECTOR3d cima);
4225 void setTarget(
float alvoX,
float alvoY,
float alvoZ);
4226 void setTarget(
double alvoX,
double alvoY,
double alvoZ);
4227 void setTarget(VECTOR3 alvo);
4228 void setTarget(VECTOR3d alvo);
4235 void rotateOrientationTrackball(
double x1,
double y1,
double x2,
double y2);
4236 void rotateOrientationSpherical(
double dlat,
double dlong);
4237 void rotateOrientationEuler(
double pitch,
double yaw,
double row);
4238 void rotateOrientationAxis(
double ang,
double axisX,
double axisY,
double axisZ);
4248 void rotateOrbitTrackball(
double centroX,
double centroY,
double centroZ,
double x1,
double y1,
double x2,
double y2);
4249 void rotateOrbitSpherical(
double centroX,
double centroY,
double centroZ,
double dlat,
double dlong);
4250 void rotateOrbitEuler(
double centroX,
double centroY,
double centroZ,
double pitch,
double yaw,
double roll);
4256 void rotateAxis(
double ang,
double ox,
double oy,
double oz,
double dirX,
double dirY,
double dirZ);
4262 int isPointVisible(
float x,
float y,
float z);
4263 int isSphereVisible(
float x,
float y,
float z,
float raio);
4264 int isBoxVisible(
float xmin,
float ymin,
float zmin,
float xmax,
float ymax,
float zmax);
4268 void setPerspective(
float fovh,
float aspect,
float prox,
float dist);
4269 void setOrthographic(
float left,
float right,
float top,
float bottom,
float near,
float far);
4275 void exportOpenGL();
4280 void getViewMatrix(MATRIX4 matrot);
4281 void getViewMatrix(MATRIX4d matrot);
4283 void getProjectionMatrix(MATRIX4 matproj);
4284 void getProjectionMatrix(MATRIX4d matproj);
4288 void computeParameters();
4307 class gcgINTERNAL_VIDEO;
4322 unsigned int height;
4325 unsigned int bitrate;
4327 gcgINTERNAL_VIDEO *handle;
4374 virtual bool destroyVideo();
4380 virtual int getNumberOfCameras();
4390 virtual bool getCameraName(
unsigned int id,
char* pCameraName,
unsigned int maxName);
4405 virtual bool openCamera(
unsigned int id,
unsigned int width,
unsigned int height,
unsigned char bpp,
float fps);
4415 virtual bool start();
4425 virtual bool stop();
4434 virtual bool resume();
4443 virtual bool pause();
4450 virtual bool isCapturing();
4465 virtual bool setCallBackFunction(
void (*callback) (
gcgVIDEOCAPTURE*));
4476 virtual double copyFrameTo(
gcgIMAGE *dstimg);
4509 virtual bool destroyVideo();
4519 virtual bool openVideoFile(
const char *filename);
4529 virtual long getFrameCount();
4540 virtual long getCurrentPosition();
4550 virtual bool setCurrentPosition(
long newposition);
4562 virtual bool copyFrame(
gcgIMAGE *dstimg);
4640 virtual uintptr_t getCounter() = 0;
4647 virtual bool deleteAll() = 0;
4664 virtual gcgITERATOR *getIterator(
int traversemode = 0) = 0;
4685 virtual gcgITERATOR *detach(
int traversemode = 0) = 0;
4743 virtual bool insertFirst(
gcgLINK *newnode) = 0;
4751 virtual bool insertLast(
gcgLINK *newnode) = 0;
4793 virtual bool moveToFirst(
gcgLINK *node) = 0;
4806 virtual bool moveToLast(
gcgLINK *node) = 0;
4826 virtual bool remove(
gcgLINK *node) = 0;
4909 uintptr_t getCounter();
4964 bool insertFirst(
gcgLINK *node);
4977 bool insertLast(
gcgLINK *node);
5024 bool moveToFirst(
gcgLINK *node);
5039 bool moveToLast(
gcgLINK *node);
5139 uintptr_t getCounter();
5197 bool insertFirst(
gcgLINK *node);
5211 bool insertLast(
gcgLINK *node);
5258 bool moveToFirst(
gcgLINK *node);
5273 bool moveToLast(
gcgLINK *node);
5462 struct _AVL_LEVEL_PATH *path;
5539 uintptr_t getCounter();
5545 virtual bool deleteAll();
5648 gcgHASHTABLE(uintptr_t capacity = 0,
float minload = 0.8,
float maxload = 16.0);
5669 bool setCapacity(uintptr_t capacity);
5689 bool setLoadLimits(
float minload,
float maxload);
5697 uintptr_t getCounter();
6096 bool setKeySize(
unsigned int keysize);
6140 uintptr_t getCounter();
6384 virtual void run() = 0;
6451 bool lock(
long timeoutUsec = -1);
6483 bool wait(
long timeoutUsec = -1);
6496 bool wakeUp(
int numberOfThreads = -1);
6544 bool enqueueTail(
gcgLINK *node);
6559 bool enqueueHead(
gcgLINK *node);
6591 gcgLINK *waitDequeue(
long timeoutUsec = -1);
6609 uintptr_t getCounter();
6641 gcgLOCK *wakeUpWhenEnqueued(
gcgLOCK *notifyme,
int wakeupNumThreads);
6665 gcgLOCK *wakeUpWhenDequeued(
gcgLOCK *notifyme,
int wakeupNumThreads);
6716 gcgCACHE(
unsigned int keysizebytes,
unsigned long cachecapacity);
6746 void *
get(
void *key);
6758 bool flush(
void *key);
6774 bool setCapacity(
unsigned long maximumtotalcost);
6785 bool setKeySize(
unsigned int keysizebytes);
6804 virtual void *retrieveData(
void *key,
unsigned long *datacost) = 0;
6817 virtual void discardData(
void *key,
void *data,
unsigned long datacost) = 0;
6847 virtual void run() = 0;
6925 unsigned int getNumberOfThreads();
6941 bool assignJob(
gcgJOB *job);
6949 uintptr_t getNumberOfPendingJobs();
6978 bool waitAndDestroy();
7085 bool setBufferSize(
unsigned int bufferlength);
7090 bool destroyProducerConsumer();
7104 bool put(
void *val);
7122 uintptr_t getCounter();
7141 void setTimeout(
long timeoutprod,
long timeoutcons);
7155 void enable(
bool enabled);
7201 bool destroyTexture();
7226 bool createTexture(
unsigned int width,
unsigned int height,
unsigned char bpp,
bool usealpha,
bool mipmapped =
false);
7249 bool uploadImage(
gcgIMAGE *srcimage,
int destposX = 0,
int destposY = 0,
unsigned int level = 0,
bool mipmapped =
false);
7260 bool isCompatibleWith(
gcgIMAGE *srcimage);
7305 #define GCG_EVENT_NOTREADYORDISCONNECTED 0x0 7308 #define GCG_EVENT_RECEIVEREADY 0x1 7312 #define GCG_EVENT_SENDREADY 0x2 7315 #define GCG_EVENT_RECEIVESENDREADY (GCG_EVENT_RECEIVEREADY | GCG_EVENT_SENDREADY) // 3 7320 #define GCG_EVENT_INSERTED 0x4 7323 #define GCG_EVENT_REMOVED 0x8 7326 #define GCG_EVENT_VISIT 0x10 7329 #define GCG_EVENT_NEWCONNECTION 0x20 7374 bool connectToHost(
const char *host,
int port);
7390 bool send(
void *buffer,
unsigned int nbytes);
7407 int receive(
void *buffer,
unsigned int nbytes);
7419 bool getConnectionFrom(
gcgINETPEER *oldpeerobject);
7430 bool shutdownSend();
7441 bool shutdownReceive();
7478 int waitEvent(
bool checkReceive =
true,
bool checkSend =
false,
int timeoutUsec = -1);
7533 bool listenPort(
int port);
7541 bool stopListening();
7599 bool flagEvents(
gcgINETPEER *peer,
bool checkReceive,
bool checkSend);
7625 bool postRemoveAll();
7647 bool postVisitAll();
7706 bool setTimeout(
int timeoutUsec);
7721 virtual void eventHandler(
int events,
gcgINETPEER *peer) = 0;
7727 #endif // #if _COUNTER_GCG_ == 1 7746 #undef COERSIONFLOAT 7747 #undef COERSIONDOUBLE 7748 #undef COERSIONSHORT 7751 #if _COUNTER_GCG_ == 1 7752 #define NUMTYPE float 7753 #define COERSIONFLOAT float 7754 #define COERSIONDOUBLE double 7755 #define COERSIONSHORT float 7756 #define COERSIONINT float 7757 #define COERSIONLONG float 7758 #elif _COUNTER_GCG_ == 2 7759 #define NUMTYPE double 7760 #define COERSIONFLOAT double 7761 #define COERSIONDOUBLE double 7762 #define COERSIONSHORT double 7763 #define COERSIONINT double 7764 #define COERSIONLONG double 7765 #elif _COUNTER_GCG_ == 3 7766 #define NUMTYPE short 7767 #define COERSIONFLOAT float 7768 #define COERSIONDOUBLE double 7769 #define COERSIONSHORT short 7770 #define COERSIONINT int 7771 #define COERSIONLONG long 7772 #elif _COUNTER_GCG_ == 4 7774 #define COERSIONFLOAT float 7775 #define COERSIONDOUBLE double 7776 #define COERSIONSHORT int 7777 #define COERSIONINT int 7778 #define COERSIONLONG long 7779 #elif _COUNTER_GCG_ == 5 7780 #define NUMTYPE long 7781 #define COERSIONFLOAT float 7782 #define COERSIONDOUBLE double 7783 #define COERSIONSHORT long 7784 #define COERSIONINT long 7785 #define COERSIONLONG long 7803 class GCG_API_CLASS gcgDISCRETE1D<NUMTYPE> :
public gcgCLASS {
7830 gcgDISCRETE1D(
unsigned int length,
int origin, NUMTYPE *sampledata =
NULL,
bool isstaticdata =
false,
int borderextension =
GCG_BORDER_EXTENSION_CLAMP);
7834 virtual ~gcgDISCRETE1D();
7852 bool createSignal(
unsigned int length,
int origin, NUMTYPE *sampledata =
NULL,
bool isstaticdata =
false,
int borderextension =
GCG_BORDER_EXTENSION_CLAMP);
7858 bool destroySignal();
7872 bool createSimilar(gcgDISCRETE1D<float> *source);
7886 bool createSimilar(gcgDISCRETE1D<double> *source);
7900 bool createSimilar(gcgDISCRETE1D<short> *source);
7914 bool createSimilar(gcgDISCRETE1D<int> *source);
7928 bool createSimilar(gcgDISCRETE1D<long> *source);
7930 bool isCompatibleWith(gcgDISCRETE1D<float> *source);
7931 bool isCompatibleWith(gcgDISCRETE1D<double> *source);
7932 bool isCompatibleWith(gcgDISCRETE1D<short> *source);
7933 bool isCompatibleWith(gcgDISCRETE1D<int> *source);
7934 bool isCompatibleWith(gcgDISCRETE1D<long> *source);
7935 bool duplicateSignal(gcgDISCRETE1D<float> *source);
7936 bool duplicateSignal(gcgDISCRETE1D<double> *source);
7937 bool duplicateSignal(gcgDISCRETE1D<short> *source);
7938 bool duplicateSignal(gcgDISCRETE1D<int> *source);
7939 bool duplicateSignal(gcgDISCRETE1D<long> *source);
7940 bool duplicateSubsignal(gcgDISCRETE1D<float> *source,
int left,
unsigned int width);
7941 bool duplicateSubsignal(gcgDISCRETE1D<double> *source,
int left,
unsigned int width);
7942 bool duplicateSubsignal(gcgDISCRETE1D<short> *source,
int left,
unsigned int width);
7943 bool duplicateSubsignal(gcgDISCRETE1D<int> *source,
int left,
unsigned int width);
7944 bool duplicateSubsignal(gcgDISCRETE1D<long> *source,
int left,
unsigned int width);
7950 NUMTYPE getDataSample(
int i);
7951 bool setDataSample(
int i, NUMTYPE value);
7957 bool normalize(gcgDISCRETE1D<float> *src,
float floor = 0,
float ceil = 1);
7958 bool normalize(gcgDISCRETE1D<double> *src,
double floor = 0,
double ceil = 1);
7959 bool normalize(gcgDISCRETE1D<short> *src,
short floor = 0,
short ceil = 1);
7960 bool normalize(gcgDISCRETE1D<int> *src,
int floor = 0,
int ceil = 1);
7961 bool normalize(gcgDISCRETE1D<long> *src,
long floor = 0,
long ceil = 1);
7967 bool templateMatching(
unsigned int imgleft,
unsigned int imgwidth, gcgDISCRETE1D<float> *mask,
int *position);
7968 bool templateMatching(
unsigned int imgleft,
unsigned int imgwidth, gcgDISCRETE1D<double> *mask,
int *position);
7969 bool templateMatching(
unsigned int imgleft,
unsigned int imgwidth, gcgDISCRETE1D<short> *mask,
int *position);
7970 bool templateMatching(
unsigned int imgleft,
unsigned int imgwidth, gcgDISCRETE1D<int> *mask,
int *position);
7971 bool templateMatching(
unsigned int imgleft,
unsigned int imgwidth, gcgDISCRETE1D<long> *mask,
int *position);
7976 COERSIONFLOAT scalarProduct(
int atX, gcgDISCRETE1D<float> *srcsignal2);
7977 COERSIONDOUBLE scalarProduct(
int atX, gcgDISCRETE1D<double> *srcsignal2);
7978 COERSIONSHORT scalarProduct(
int atX, gcgDISCRETE1D<short> *srcsignal2);
7979 COERSIONINT scalarProduct(
int atX, gcgDISCRETE1D<int> *srcsignal2);
7980 COERSIONLONG scalarProduct(
int atX, gcgDISCRETE1D<long> *srcsignal2);
7984 bool binarize(gcgDISCRETE1D<float> *src,
float threshold, NUMTYPE lessvalue = 0, NUMTYPE greaterequalvalue = 1);
7985 bool binarize(gcgDISCRETE1D<double> *src,
double threshold, NUMTYPE lessvalue = 0, NUMTYPE greaterequalvalue = 1);
7986 bool binarize(gcgDISCRETE1D<short> *src,
short threshold, NUMTYPE lessvalue = 0, NUMTYPE greaterequalvalue = 1);
7987 bool binarize(gcgDISCRETE1D<int> *src,
int threshold, NUMTYPE lessvalue = 0, NUMTYPE greaterequalvalue = 1);
7988 bool binarize(gcgDISCRETE1D<long> *src,
long threshold, NUMTYPE lessvalue = 0, NUMTYPE greaterequalvalue = 1);
7994 bool scale(gcgDISCRETE1D<float> *srcsignal1, COERSIONFLOAT weight, COERSIONFLOAT addthis = 0);
7995 bool scale(gcgDISCRETE1D<double> *srcsignal1, COERSIONDOUBLE weight, COERSIONDOUBLE addthis = 0);
7996 bool scale(gcgDISCRETE1D<short> *srcsignal1, COERSIONSHORT weight, COERSIONSHORT addthis = 0);
7997 bool scale(gcgDISCRETE1D<int> *srcsignal1, COERSIONINT weight, COERSIONINT addthis = 0);
7998 bool scale(gcgDISCRETE1D<long> *srcsignal1, COERSIONLONG weight, COERSIONLONG addthis = 0);
7999 bool power(gcgDISCRETE1D<float> *srcsignal1, COERSIONFLOAT power);
8000 bool power(gcgDISCRETE1D<double> *srcsignal1, COERSIONDOUBLE power);
8001 bool power(gcgDISCRETE1D<short> *srcsignal1, COERSIONSHORT power);
8002 bool power(gcgDISCRETE1D<int> *srcsignal1, COERSIONINT power);
8003 bool power(gcgDISCRETE1D<long> *srcsignal1, COERSIONLONG power);
8004 bool combineAdd(
gcgDISCRETE1D<NUMTYPE> *srcsignal1, gcgDISCRETE1D<float> *srcsignal2, COERSIONFLOAT weight1 = 1, COERSIONFLOAT weight2 = 1);
8005 bool combineAdd(
gcgDISCRETE1D<NUMTYPE> *srcsignal1, gcgDISCRETE1D<double> *srcsignal2, COERSIONDOUBLE weight1 = 1, COERSIONDOUBLE weight2 = 1);
8006 bool combineAdd(
gcgDISCRETE1D<NUMTYPE> *srcsignal1, gcgDISCRETE1D<short> *srcsignal2, COERSIONSHORT weight1 = 1, COERSIONSHORT weight2 = 1);
8007 bool combineAdd(
gcgDISCRETE1D<NUMTYPE> *srcsignal1, gcgDISCRETE1D<int> *srcsignal2, COERSIONINT weight1 = 1, COERSIONINT weight2 = 1);
8008 bool combineAdd(
gcgDISCRETE1D<NUMTYPE> *srcsignal1, gcgDISCRETE1D<long> *srcsignal2, COERSIONLONG weight1 = 1, COERSIONLONG weight2 = 1);
8009 bool combineMult(
gcgDISCRETE1D<NUMTYPE> *srcsignal1, gcgDISCRETE1D<float> *srcsignal2, COERSIONFLOAT add1 = 0, COERSIONFLOAT add2 = 0);
8010 bool combineMult(
gcgDISCRETE1D<NUMTYPE> *srcsignal1, gcgDISCRETE1D<double> *srcsignal2, COERSIONDOUBLE add1 = 0, COERSIONDOUBLE add2 = 0);
8011 bool combineMult(
gcgDISCRETE1D<NUMTYPE> *srcsignal1, gcgDISCRETE1D<short> *srcsignal2, COERSIONSHORT add1 = 0, COERSIONSHORT add2 = 0);
8012 bool combineMult(
gcgDISCRETE1D<NUMTYPE> *srcsignal1, gcgDISCRETE1D<int> *srcsignal2, COERSIONINT add1 = 0, COERSIONINT add2 = 0);
8013 bool combineMult(
gcgDISCRETE1D<NUMTYPE> *srcsignal1, gcgDISCRETE1D<long> *srcsignal2, COERSIONLONG add1 = 0, COERSIONLONG add2 = 0);
8023 bool exportGrayScaleImage(
gcgIMAGE *outimage,
bool normalize);
8034 class GCG_API_CLASS gcgDISCRETE2D<NUMTYPE> :
public gcgCLASS {
8039 unsigned int height;
8056 gcgDISCRETE2D(
unsigned int width,
unsigned int length,
int originX,
int originY, NUMTYPE *sampledata =
NULL,
8058 virtual ~gcgDISCRETE2D();
8063 bool createSignal(
unsigned int width,
unsigned int height,
int originX,
int originY, NUMTYPE *sampledata =
NULL,
8065 void destroySignal();
8070 bool createSimilar(gcgDISCRETE2D<float> *source);
8071 bool createSimilar(gcgDISCRETE2D<double> *source);
8072 bool createSimilar(gcgDISCRETE2D<short> *source);
8073 bool createSimilar(gcgDISCRETE2D<int> *source);
8074 bool createSimilar(gcgDISCRETE2D<long> *source);
8075 bool isCompatibleWith(gcgDISCRETE2D<float> *source);
8076 bool isCompatibleWith(gcgDISCRETE2D<double> *source);
8077 bool isCompatibleWith(gcgDISCRETE2D<short> *source);
8078 bool isCompatibleWith(gcgDISCRETE2D<int> *source);
8079 bool isCompatibleWith(gcgDISCRETE2D<long> *source);
8080 bool duplicateSignal(gcgDISCRETE2D<float> *source);
8081 bool duplicateSignal(gcgDISCRETE2D<double> *source);
8082 bool duplicateSignal(gcgDISCRETE2D<short> *source);
8083 bool duplicateSignal(gcgDISCRETE2D<int> *source);
8084 bool duplicateSignal(gcgDISCRETE2D<long> *source);
8085 bool duplicateSubsignal(gcgDISCRETE2D<float> *source,
int left,
int top,
unsigned int width,
unsigned int height);
8086 bool duplicateSubsignal(gcgDISCRETE2D<double> *source,
int left,
int top,
unsigned int width,
unsigned int height);
8087 bool duplicateSubsignal(gcgDISCRETE2D<short> *source,
int left,
int top,
unsigned int width,
unsigned int height);
8088 bool duplicateSubsignal(gcgDISCRETE2D<int> *source,
int left,
int top,
unsigned int width,
unsigned int height);
8089 bool duplicateSubsignal(gcgDISCRETE2D<long> *source,
int left,
int top,
unsigned int width,
unsigned int height);
8095 NUMTYPE getDataSample(
int i,
int j);
8096 bool setDataSample(
int i,
int j, NUMTYPE value);
8102 bool normalize(gcgDISCRETE2D<float> *src,
float floor = 0,
float ceil = 1);
8103 bool normalize(gcgDISCRETE2D<double> *src,
double floor = 0,
double ceil = 1);
8104 bool normalize(gcgDISCRETE2D<short> *src,
short floor = 0,
short ceil = 1);
8105 bool normalize(gcgDISCRETE2D<int> *src,
int floor = 0,
int ceil = 1);
8106 bool normalize(gcgDISCRETE2D<long> *src,
long floor = 0,
long ceil = 1);
8107 bool convolutionX(gcgDISCRETE2D<NUMTYPE> *src, gcgDISCRETE1D<float> *mask);
8108 bool convolutionX(gcgDISCRETE2D<NUMTYPE> *src, gcgDISCRETE1D<double> *mask);
8109 bool convolutionX(gcgDISCRETE2D<NUMTYPE> *src, gcgDISCRETE1D<short> *mask);
8110 bool convolutionX(gcgDISCRETE2D<NUMTYPE> *src, gcgDISCRETE1D<int> *mask);
8111 bool convolutionX(gcgDISCRETE2D<NUMTYPE> *src, gcgDISCRETE1D<long> *mask);
8112 bool convolutionY(gcgDISCRETE2D<NUMTYPE> *src, gcgDISCRETE1D<float> *mask);
8113 bool convolutionY(gcgDISCRETE2D<NUMTYPE> *src, gcgDISCRETE1D<double> *mask);
8114 bool convolutionY(gcgDISCRETE2D<NUMTYPE> *src, gcgDISCRETE1D<short> *mask);
8115 bool convolutionY(gcgDISCRETE2D<NUMTYPE> *src, gcgDISCRETE1D<int> *mask);
8116 bool convolutionY(gcgDISCRETE2D<NUMTYPE> *src, gcgDISCRETE1D<long> *mask);
8117 bool convolutionXY(gcgDISCRETE2D<NUMTYPE> *src, gcgDISCRETE2D<float> *mask);
8118 bool convolutionXY(gcgDISCRETE2D<NUMTYPE> *src, gcgDISCRETE2D<double> *mask);
8119 bool convolutionXY(gcgDISCRETE2D<NUMTYPE> *src, gcgDISCRETE2D<short> *mask);
8120 bool convolutionXY(gcgDISCRETE2D<NUMTYPE> *src, gcgDISCRETE2D<int> *mask);
8121 bool convolutionXY(gcgDISCRETE2D<NUMTYPE> *src, gcgDISCRETE2D<long> *mask);
8122 bool templateMatching(
unsigned int imgleft,
unsigned int imgbottom,
unsigned int imgwidth,
unsigned int imgheight, gcgDISCRETE2D<float> *mask,
int *positionX,
int *positionY);
8123 bool templateMatching(
unsigned int imgleft,
unsigned int imgbottom,
unsigned int imgwidth,
unsigned int imgheight, gcgDISCRETE2D<double> *mask,
int *positionX,
int *positionY);
8124 bool templateMatching(
unsigned int imgleft,
unsigned int imgbottom,
unsigned int imgwidth,
unsigned int imgheight, gcgDISCRETE2D<short> *mask,
int *positionX,
int *positionY);
8125 bool templateMatching(
unsigned int imgleft,
unsigned int imgbottom,
unsigned int imgwidth,
unsigned int imgheight, gcgDISCRETE2D<int> *mask,
int *positionX,
int *positionY);
8126 bool templateMatching(
unsigned int imgleft,
unsigned int imgbottom,
unsigned int imgwidth,
unsigned int imgheight, gcgDISCRETE2D<long> *mask,
int *positionX,
int *positionY);
8132 COERSIONFLOAT scalarProduct(
int atX,
int atY, gcgDISCRETE2D<float> *srcsignal2);
8133 COERSIONDOUBLE scalarProduct(
int atX,
int atY, gcgDISCRETE2D<double> *srcsignal2);
8134 COERSIONSHORT scalarProduct(
int atX,
int atY, gcgDISCRETE2D<short> *srcsignal2);
8135 COERSIONINT scalarProduct(
int atX,
int atY, gcgDISCRETE2D<int> *srcsignal2);
8136 COERSIONLONG scalarProduct(
int atX,
int atY, gcgDISCRETE2D<long> *srcsignal2);
8140 bool binarize(gcgDISCRETE2D<float> *src,
float threshold, NUMTYPE lessvalue = 0, NUMTYPE greaterequalvalue = 1);
8141 bool binarize(gcgDISCRETE2D<double> *src,
double threshold, NUMTYPE lessvalue = 0, NUMTYPE greaterequalvalue = 1);
8142 bool binarize(gcgDISCRETE2D<short> *src,
short threshold, NUMTYPE lessvalue = 0, NUMTYPE greaterequalvalue = 1);
8143 bool binarize(gcgDISCRETE2D<int> *src,
int threshold, NUMTYPE lessvalue = 0, NUMTYPE greaterequalvalue = 1);
8144 bool binarize(gcgDISCRETE2D<long> *src,
long threshold, NUMTYPE lessvalue = 0, NUMTYPE greaterequalvalue = 1);
8150 bool scale(gcgDISCRETE2D<float> *srcsignal1, COERSIONFLOAT weight, COERSIONFLOAT addthis = 0);
8151 bool scale(gcgDISCRETE2D<double> *srcsignal1, COERSIONDOUBLE weight, COERSIONDOUBLE addthis = 0);
8152 bool scale(gcgDISCRETE2D<short> *srcsignal1, COERSIONSHORT weight, COERSIONSHORT addthis = 0);
8153 bool scale(gcgDISCRETE2D<int> *srcsignal1, COERSIONINT weight, COERSIONINT addthis = 0);
8154 bool scale(gcgDISCRETE2D<long> *srcsignal1, COERSIONLONG weight, COERSIONLONG addthis = 0);
8155 bool power(gcgDISCRETE2D<float> *srcsignal1, COERSIONFLOAT power);
8156 bool power(gcgDISCRETE2D<double> *srcsignal1, COERSIONDOUBLE power);
8157 bool power(gcgDISCRETE2D<short> *srcsignal1, COERSIONSHORT power);
8158 bool power(gcgDISCRETE2D<int> *srcsignal1, COERSIONINT power);
8159 bool power(gcgDISCRETE2D<long> *srcsignal1, COERSIONLONG power);
8160 bool combineAdd(gcgDISCRETE2D<NUMTYPE> *srcsignal1, gcgDISCRETE2D<float> *srcsignal2, COERSIONFLOAT weight1 = 1, COERSIONFLOAT weight2 = 1);
8161 bool combineAdd(gcgDISCRETE2D<NUMTYPE> *srcsignal1, gcgDISCRETE2D<double> *srcsignal2, COERSIONDOUBLE weight1 = 1, COERSIONDOUBLE weight2 = 1);
8162 bool combineAdd(gcgDISCRETE2D<NUMTYPE> *srcsignal1, gcgDISCRETE2D<short> *srcsignal2, COERSIONSHORT weight1 = 1, COERSIONSHORT weight2 = 1);
8163 bool combineAdd(gcgDISCRETE2D<NUMTYPE> *srcsignal1, gcgDISCRETE2D<int> *srcsignal2, COERSIONINT weight1 = 1, COERSIONINT weight2 = 1);
8164 bool combineAdd(gcgDISCRETE2D<NUMTYPE> *srcsignal1, gcgDISCRETE2D<long> *srcsignal2, COERSIONLONG weight1 = 1, COERSIONLONG weight2 = 1);
8165 bool combineMult(gcgDISCRETE2D<NUMTYPE> *srcsignal1, gcgDISCRETE2D<float> *srcsignal2, COERSIONFLOAT add1 = 0, COERSIONFLOAT add2 = 0);
8166 bool combineMult(gcgDISCRETE2D<NUMTYPE> *srcsignal1, gcgDISCRETE2D<double> *srcsignal2, COERSIONDOUBLE add1 = 0, COERSIONDOUBLE add2 = 0);
8167 bool combineMult(gcgDISCRETE2D<NUMTYPE> *srcsignal1, gcgDISCRETE2D<short> *srcsignal2, COERSIONSHORT add1 = 0, COERSIONSHORT add2 = 0);
8168 bool combineMult(gcgDISCRETE2D<NUMTYPE> *srcsignal1, gcgDISCRETE2D<int> *srcsignal2, COERSIONINT add1 = 0, COERSIONINT add2 = 0);
8169 bool combineMult(gcgDISCRETE2D<NUMTYPE> *srcsignal1, gcgDISCRETE2D<long> *srcsignal2, COERSIONLONG add1 = 0, COERSIONLONG add2 = 0);
8170 bool combineNorm(gcgDISCRETE2D<NUMTYPE> *srcsignal1, gcgDISCRETE2D<float> *srcsignal2);
8171 bool combineNorm(gcgDISCRETE2D<NUMTYPE> *srcsignal1, gcgDISCRETE2D<double> *srcsignal2);
8172 bool combineNorm(gcgDISCRETE2D<NUMTYPE> *srcsignal1, gcgDISCRETE2D<short> *srcsignal2);
8173 bool combineNorm(gcgDISCRETE2D<NUMTYPE> *srcsignal1, gcgDISCRETE2D<int> *srcsignal2);
8174 bool combineNorm(gcgDISCRETE2D<NUMTYPE> *srcsignal1, gcgDISCRETE2D<long> *srcsignal2);
8179 bool verticalFlip();
8184 bool exportGrayScaleImage(
gcgIMAGE *outimage,
bool normalize);
8190 #if _COUNTER_GCG_ < 3 8204 class GCG_API_CLASS gcgMATRIX<NUMTYPE> :
public gcgCLASS {
8217 gcgMATRIX(
unsigned int rows,
unsigned int columns, NUMTYPE *sampledata =
NULL,
bool isstaticdata =
false);
8218 virtual ~gcgMATRIX();
8223 bool createMatrix(
unsigned int rows,
unsigned int columns, NUMTYPE *sampledata =
NULL,
bool isstaticdata =
false);
8224 void destroyMatrix();
8229 bool createSimilar(gcgMATRIX<float> *source);
8230 bool createSimilar(gcgMATRIX<double> *source);
8231 bool isCompatibleWith(gcgMATRIX<float> *source);
8232 bool isCompatibleWith(gcgMATRIX<double> *source);
8233 bool duplicateMatrix(gcgMATRIX<float> *source);
8234 bool duplicateMatrix(gcgMATRIX<double> *source);
8235 bool duplicateSubMatrix(gcgMATRIX<float> *source,
int firstrow,
int firstcolumn,
unsigned int rows,
unsigned int columns);
8236 bool duplicateSubMatrix(gcgMATRIX<double> *source,
int firstrow,
int firstcolumn,
unsigned int rows,
unsigned int columns);
8241 NUMTYPE getDataSample(
int row,
int column);
8242 bool setDataSample(
int row,
int column, NUMTYPE value);
8248 bool scale(gcgMATRIX<float> *srcmatrix1, COERSIONFLOAT weight, COERSIONFLOAT addthis = 0);
8249 bool scale(gcgMATRIX<double> *srcmatrix1, COERSIONDOUBLE weight, COERSIONDOUBLE addthis = 0);
8250 bool power(gcgMATRIX<float> *srcmatrix1, COERSIONFLOAT power);
8251 bool power(gcgMATRIX<double> *srcmatrix1, COERSIONDOUBLE power);
8252 bool combineAdd(
gcgMATRIX<NUMTYPE> *srcmatrix1, gcgMATRIX<float> *srcmatrix2, COERSIONFLOAT weight1 = 1, COERSIONFLOAT weight2 = 1);
8253 bool combineAdd(
gcgMATRIX<NUMTYPE> *srcmatrix1, gcgMATRIX<double> *srcmatrix2, COERSIONDOUBLE weight1 = 1, COERSIONDOUBLE weight2 = 1);
8254 bool combineMult(
gcgMATRIX<NUMTYPE> *srcmatrix1, gcgMATRIX<float> *srcmatrix2, COERSIONFLOAT add1 = 0, COERSIONFLOAT add2 = 0);
8255 bool combineMult(
gcgMATRIX<NUMTYPE> *srcmatrix1, gcgMATRIX<double> *srcmatrix2, COERSIONDOUBLE add1 = 0, COERSIONDOUBLE add2 = 0);
8281 class GCG_API_CLASS gcgLEGENDREBASIS1D<NUMTYPE> :
public gcgBASIS1D<NUMTYPE> {
8287 double *coefficients;
8288 unsigned int npolynomials;
8290 NUMTYPE *discretepolynomials;
8293 gcgLEGENDREBASIS1D();
8294 virtual ~gcgLEGENDREBASIS1D();
8299 bool setBasisDegree(
unsigned int degree);
8310 bool setNumberOfSamples(
unsigned int nsamples);
8314 unsigned int getNumberOfCoefficients();
8322 NUMTYPE getPointValue(
unsigned int idegree, NUMTYPE x);
8329 NUMTYPE getIntegralValue(
unsigned int idegree, NUMTYPE a, NUMTYPE b);
8339 NUMTYPE getDiscreteValue(
unsigned int idegree,
unsigned int i);
8382 bool basisInformation(
const char *filename);
8406 class GCG_API_CLASS gcgLEGENDREBASIS2D<NUMTYPE> :
public gcgBASIS2D<NUMTYPE> {
8413 double *coefficients;
8414 unsigned int npolynomials;
8416 NUMTYPE *discretepolynomials;
8419 gcgLEGENDREBASIS2D();
8420 virtual ~gcgLEGENDREBASIS2D();
8425 bool setBasisDegree(
unsigned int degree);
8439 bool setNumberOfSamples(
unsigned int nsamplesX,
unsigned int nsamplesY);
8443 unsigned int getNumberOfCoefficients();
8455 bool synchBasisWithFile(
const char *filename,
unsigned int nsamplesX,
unsigned int nsamplesY);
8466 NUMTYPE getPointValue(
unsigned int i,
unsigned int j, NUMTYPE x, NUMTYPE y);
8476 NUMTYPE getIntegralValue(
unsigned int i,
unsigned int j, NUMTYPE xmin, NUMTYPE xmax, NUMTYPE ymin, NUMTYPE ymax);
8493 NUMTYPE getDiscreteValue(
unsigned int i,
unsigned int j,
unsigned int ix,
unsigned int iy);
8528 bool reconstructSignal(
int atX,
int atY,
gcgDISCRETE1D<NUMTYPE> *inputcoef, gcgDISCRETE2D<float> *outputvector);
8529 bool reconstructSignal(
int atX,
int atY,
gcgDISCRETE1D<NUMTYPE> *inputcoef, gcgDISCRETE2D<double> *outputvector);
8530 bool reconstructSignal(
int atX,
int atY,
gcgDISCRETE1D<NUMTYPE> *inputcoef, gcgDISCRETE2D<short> *outputvector);
8531 bool reconstructSignal(
int atX,
int atY,
gcgDISCRETE1D<NUMTYPE> *inputcoef, gcgDISCRETE2D<int> *outputvector);
8532 bool reconstructSignal(
int atX,
int atY,
gcgDISCRETE1D<NUMTYPE> *inputcoef, gcgDISCRETE2D<long> *outputvector);
8541 bool basisInformation(
const char *filename,
bool checkorthogonality,
bool savefunctionsasimages);
8563 class GCG_API_CLASS gcgDWTBASIS1D<NUMTYPE> :
public gcgBASIS1D<NUMTYPE> {
8578 virtual ~gcgDWTBASIS1D();
8598 bool setNumberOfSamples(
unsigned int nsamples);
8608 unsigned int getNumberOfCoefficients();
8651 bool basisInformation(
const char *filename);
8677 class GCG_API_CLASS gcgSEQUENCEDERIVATIVE2D<NUMTYPE> :
public gcgCLASS {
8679 gcgDISCRETE2D<NUMTYPE> *current;
8680 gcgDISCRETE2D<NUMTYPE> *next;
8681 gcgDISCRETE2D<NUMTYPE> *lowcurrent;
8682 gcgDISCRETE2D<NUMTYPE> *lownext;
8683 gcgDISCRETE2D<NUMTYPE> temp;
8691 virtual bool sequenceDerivative(gcgDISCRETE2D<NUMTYPE> *current, gcgDISCRETE2D<NUMTYPE> *next, gcgDISCRETE2D<NUMTYPE> *outputDt);
8713 class GCG_API_CLASS gcgFILTERMASK1D<NUMTYPE> :
public gcgDISCRETE1D<NUMTYPE> {
8716 virtual ~gcgFILTERMASK1D();
8719 bool createBoxFilter(
unsigned int nsamples);
8722 bool createTriangleFilter(
unsigned int nsamples);
8740 template<> GCG_API_TEMPLATE
double computeMSEwith<NUMTYPE>(gcgDISCRETE2D<NUMTYPE> *src1, gcgDISCRETE2D<NUMTYPE> *src2);
8741 template<> GCG_API_TEMPLATE
double computePSNRwith<NUMTYPE>(gcgDISCRETE2D<NUMTYPE> *src1, gcgDISCRETE2D<NUMTYPE> *src2);
8742 template<> GCG_API_TEMPLATE
double computeMAEwith<NUMTYPE>(gcgDISCRETE2D<NUMTYPE> *src1, gcgDISCRETE2D<NUMTYPE> *src2);
8755 template<> GCG_API_TEMPLATE
bool gcgGradientSobel2D<NUMTYPE>(gcgDISCRETE2D<NUMTYPE> *src, gcgDISCRETE2D<NUMTYPE> *dx, gcgDISCRETE2D<NUMTYPE> *dy);
8760 template<> GCG_API_TEMPLATE
bool gcgOpticalFlowAugereau2D<NUMTYPE>(gcgDISCRETE2D<NUMTYPE> *dx1, gcgDISCRETE2D<NUMTYPE> *dy1, gcgDISCRETE2D<NUMTYPE> *dt1,
8761 gcgDISCRETE2D<NUMTYPE> *dx2, gcgDISCRETE2D<NUMTYPE> *dy2, gcgDISCRETE2D<NUMTYPE> *dt2,
8762 gcgDISCRETE2D<NUMTYPE> *dx3, gcgDISCRETE2D<NUMTYPE> *dy3, gcgDISCRETE2D<NUMTYPE> *dt3,
8763 gcgDISCRETE2D<float> *outflowX, gcgDISCRETE2D<float> *outflowY);
8765 template<> GCG_API_TEMPLATE
bool gcgOpticalFlowAugereau2D<NUMTYPE>(gcgDISCRETE2D<NUMTYPE> *dx1, gcgDISCRETE2D<NUMTYPE> *dy1, gcgDISCRETE2D<NUMTYPE> *dt1,
8766 gcgDISCRETE2D<NUMTYPE> *dx2, gcgDISCRETE2D<NUMTYPE> *dy2, gcgDISCRETE2D<NUMTYPE> *dt2,
8767 gcgDISCRETE2D<NUMTYPE> *dx3, gcgDISCRETE2D<NUMTYPE> *dy3, gcgDISCRETE2D<NUMTYPE> *dt3,
8768 gcgDISCRETE2D<double> *outflowX, gcgDISCRETE2D<double> *outflowY);
8890 #if _COUNTER_GCG_ == 1 8891 #undef _COUNTER_GCG_ 8892 #define _COUNTER_GCG_ 2 8893 #elif _COUNTER_GCG_ == 2 8894 #undef _COUNTER_GCG_ 8895 #define _COUNTER_GCG_ 3 8896 #elif _COUNTER_GCG_ == 3 8897 #undef _COUNTER_GCG_ 8898 #define _COUNTER_GCG_ 4 8899 #elif _COUNTER_GCG_ == 4 8900 #undef _COUNTER_GCG_ 8901 #define _COUNTER_GCG_ 5 8903 #define _GCG_H_ // Stop loading 8908 #if !defined(_GCG_H_) 8916 #endif // #ifndef _GCG_H_ Base abstract class for defining a hierarchical data structure in GCGlib for ordered nodes...
Definition: gcg.h:5354
bool gcgInverseMatrix4(MATRIX4 inverse, MATRIX4 matrix)
Computes the inverse of a 4x4 matrix by the direct method. It is suitable for fast inverse computatio...
union _GCGDIGITALKEY GCGDIGITALKEY
Union type for defining digital keys for data map classes. The data maps might use fixed or variable ...
unsigned int bpp
Bits per pixel that can assume the values: 1, 2, 4, 8, 16, 24, 32.
Definition: gcg.h:2927
FILE * gcgGetLogStream()
Returns the current log stream. The default log stream is stderr.
gcgLINK * first
Points to the first gcgLINK node in the list. Read-only.
Definition: gcg.h:4855
const int GCG_VERSION_BUILD
Points to the integer build version value.
Definition: gcg.h:399
int gcgGetReport(int sizestring=0, char *extrastring=NULL)
Returns the code of the last report. Use GCG_REPORT_TYPE(), GCG_REPORT_DOMAIN(), and GCG_REPORT_MESSA...
bool gcgDrawVectorPyramid(float x, float y, float z, VECTOR3 vector, float scale)
Draws an oriented pyramid (its base is not drawn) which can be used to represent vectors: 4 triangles...
bool gcgEigenSymmetricMatrix3(MATRIX3 matrix, MATRIX3 eigenvectors, VECTOR3 eigenvalues)
Computes the eigensystem decomposition of a symmetric 3 x 3 matrix matrix. The resulted eigenvectors ...
char ckey
The key as a char: guaranteed to have at least CHAR_BIT bits in C. It has 8 bits in x86-64 machines...
Definition: gcg.h:5885
Controls a pool of threads for executing multiple jobs concurrently.
Definition: gcg.h:6872
Class for capturing video from camera devices.
Definition: gcg.h:4353
Defines a queue with synchronized access. This is a standard data structure that may be used with Fir...
Definition: gcg.h:6507
Class to estimate the number of events per second.
Definition: gcg.h:4083
signed char status
Sequence of bits used to keep ordered node information. It depends on the underlying data structure...
Definition: gcg.h:5337
unsigned int nsamples
Number of samples for projection/reconstruction processes. Read-only. See setNumberOfSamples().
Definition: gcg.h:8570
gcgDISCRETE1D< NUMTYPE > H
Low pass decomposition filter. Read-only.
Definition: gcg.h:8565
int internalformat
OpenGL internal format: GL_LUMINANCE4, GL_LUMINANCE8, GL_RGB5, GL_RGB5_A1, GL_RGBA8, GL_RGB8 or GL_RGB4, depending on the texture creation parameters.
Definition: gcg.h:7183
void * handle
Internal handle of this object.
Definition: gcg.h:6509
void * handle
Internal handle of this service.
Definition: gcg.h:7513
Concrete class that implements a PATRICIA tree for key/value mappings. Insertion or search for a rand...
Definition: gcg.h:6050
uintptr_t getAllocatedMemoryCounter()
Function to retrieve how much memory was dynamically allocated by using GCGlib.
unsigned int gcgPackRLE8(unsigned int fullsize, unsigned char *srcdata, unsigned char *RLEdata)
Packs a 8 bit sequence as a Run-Lenght Encoded block.
#define GCG_BORDER_EXTENSION_CLAMP
Defines the border extension as: the first/last value s[0] s[0] s[0] s[0] s[1] s[2] s[2] s[2] s[2]...
Definition: gcg.h:2687
signed char balance
Name addressed by AVL trees. Internal use only.
Definition: gcg.h:5338
Class for 1D signal definition and processing.
Definition: gcg.h:7803
Generic abstract class for defining a linkable node for use in single linked lists and linear data st...
Definition: gcg.h:4697
bool gcgSaveFloatsAsText(unsigned int size, float *data, char *outputname)
Saves a float array as C code for software embedding.
void * handle
Internal handle of this peer.
Definition: gcg.h:7358
Class to transparently deal with 3D textures. Allocates the texture directly from graphics system and...
Definition: gcg.h:7173
Generic abstract class for defining classes to be used in the GCGlib data structures. In fact, a specialization of a correct and data structure dependent class is mandatory for using the data structures.
Definition: gcg.h:4589
float minimumload
Minimum load of this table. The table capacity will be adjusted to this minimum counter/capacity rati...
Definition: gcg.h:5627
Generic abstract class for defining a job/task for using with GCGlib. It inherits gcgORDEREDNODE in o...
Definition: gcg.h:6832
Base class for video processing.
Definition: gcg.h:4319
const char * GCG_BUILD_DATE
Points to the build date string.
Definition: gcg.h:390
bool gcgEnableReportLog(int code, bool enable)
Enables or disables the logging of messages of a specific type or domain. When a type or domain is en...
unsigned int height
Height effectively used by the texture. It must be <= actualheight.
Definition: gcg.h:7176
int type
OpenGL format: GL_UNSIGNED_BYTE, GL_BITMAP, GL_UNSIGNED_BYTE_4, GL_UNSIGNED_SHORT_1_5_5_5_REV, GL_UNSIGNED_SHORT_5_6_5, or GL_UNSIGNED_SHORT_4_4_4_4_REV, depending on the texture creation parameters.
Definition: gcg.h:7185
const int GCG_VERSION_MAJOR
Points to the integer major version value.
Definition: gcg.h:393
bool gcgDrawLogo(float scale=0.67)
Draws the GCG logo on the top right conner of the viewport.
const char * gcgGetReportString(char **typestr=NULL, char **domainstr=NULL)
Gets the strings of the last report.
gcgDISCRETE1D< NUMTYPE > rH
Low pass reconstruction filter. Read-only.
Definition: gcg.h:8567
unsigned int gcgDecompressImageRLE8(unsigned int width, unsigned int height, unsigned char *RLEdata, unsigned char *dstdata)
Decompress a bit Run-Length Encoded 8 bits bitmap image. It receives a compressed block of a Windows ...
Class for handling matrices with arbitrary dimension. It is used in general functions for linear alge...
Definition: gcg.h:8204
Generic abstract class for defining a linkable node for use in double linked lists and linear data st...
Definition: gcg.h:4716
unsigned int idOpengl
OpenGL texture internal identification.
Definition: gcg.h:7181
Class with methods to listen a specific port and, as additionnal functionality, manage multiple peers...
Definition: gcg.h:7510
unsigned long capacity
Maximum sum of data costs this cache supports. Read-Only. See setMaximumCost().
Definition: gcg.h:6699
Base abstract class for defining data structures in GCGlib. It indicates the minimum methods that all...
Definition: gcg.h:4637
void * handle
Internal handle of this object.
Definition: gcg.h:7067
void * handle
Internal handle of this object.
Definition: gcg.h:6703
void * pkey
Points to the actual key (null terminated strings or fixed integer keys with size greater than sizeof...
Definition: gcg.h:5880
virtual ~gcgJOB()
Destructs the job. It is intended to be implemented by specialized classes. The object is deleted by ...
Definition: gcg.h:6842
unsigned int gcgDecompressImageRLE4(unsigned int width, unsigned int height, unsigned char *RLEdata, unsigned char *dstdata)
Decompress a bit Run-Length Encoded 4 bits bitmap image. It receives a compressed block of a Windows ...
bool gcgReport(int code, const char *format=NULL,...)
Reports an error. To avoid serialization, it is NEVER called for successful operations inside GCGlib...
bool gcgDrawAABox(VECTOR3 bbmin, VECTOR3 bbmax)
Draws an axis aligned box. Normals are sent and can be used for lighting. All parameters are float va...
unsigned int width
Image size in number of pixels.
Definition: gcg.h:2925
bool gcgDrawVectorPyramidClosed(float x, float y, float z, VECTOR3 vector, float scale)
Draws an oriented pyramid (its base is also drawn) which can be used to represent vectors: 6 triangle...
static int SQR(int x)
Inline function for squaring integers.
Definition: gcg.h:424
uintptr_t counter
Number of elements in this tree. Read-only.
Definition: gcg.h:5459
uintptr_t capacity
Capacity of this table or maximum number of elements of the table without collisions. Read-only.
Definition: gcg.h:5626
bool gcgHeatColor(float normheat, VECTOR3 color)
Returns a color given a normalized "heat" value between 0 and 1. Uses a palette that partitions the u...
int format
OpenGL format: GL_LUMINANCE, GL_BGRA, GL_RGB or GL_RGBA, depending on the texture creation parameters...
Definition: gcg.h:7184
FILE * gcgSetLogStream(FILE *logstream)
Sets a new stream for logging. The default log stream is stderr. Returns the previous log stream...
gcgLINK * left
Points to the left/previous gcgLINK node in a list. Same pointer as previous. Read-only.
Definition: gcg.h:4720
bool gcgInverseMatrix3(MATRIX3 inverse, MATRIX3 matrix)
Computes the inverse of a 3x3 matrix by the direct method. It is suitable for fast inverse computatio...
int extension
Defines the way the borders have to be extended.
Definition: gcg.h:7810
unsigned int rowsize
Stride in bytes between one row and the next. The last image row appears first in the data buffer...
Definition: gcg.h:2928
unsigned char * palette
Definition: gcg.h:2931
float maximumload
Maximum load of this table. The table capacity will be adjusted to this maximum counter/capacity rati...
Definition: gcg.h:5628
unsigned int degree
Degree of the polynomials = number of polynomials - 1. Read-only. See setBasisDegree().
Definition: gcg.h:8283
bool isListening
True if the service is listening a port.
Definition: gcg.h:7512
void * handle
Internal handle of this object.
Definition: gcg.h:6874
It is a concrete class that defines a fast double linked list. This is a standard data structure that...
Definition: gcg.h:5084
Abstract class for 2D basis projection/reconstruction interfaces.
Definition: gcg.h:2838
void gcgOutputLog(const char *format,...)
Reports a new message to the log stream.
short skey
The key as a short integer: guaranteed to have at least 16 bits in C. It has 16 bits in x86-64 machin...
Definition: gcg.h:5884
unsigned int height
Image height in number of pixels.
Definition: gcg.h:2926
uintptr_t counter
Number of elements in this list. Read-only.
Definition: gcg.h:5088
gcgLINK * last
Points to the last gcgLINK node in the list. Read-only.
Definition: gcg.h:5087
void * handle
Internal handle of this object.
Definition: gcg.h:6423
float gcgSphericalDistance(float latitude1, float longitude1, float latitude2, float longitude2)
Computes the distance between two points on the unit sphere using the method of R.W. Sinnott, "Virtues of the Haversine", Sky and Telescope, vol. 68, no. 2, 1984, p. 159): http://www.movable-type.co.uk/scripts/gis-faq-5.1.htmlComputes.
uintptr_t counter
Number of elements in this tree. Read-only.
Definition: gcg.h:6052
gcgORDEREDNODE * root
Root node of the AVL tree. Read-only.
Definition: gcg.h:5458
bool gcgLinearSolver(gcgDISCRETE2D< NUMTYPE > *A, gcgDISCRETE1D< NUMTYPE > *b, gcgDISCRETE1D< NUMTYPE > *x)
Computes the solution of a linear system. If A is a square matrix (number of equations = number of un...
bool gcgDrawOBox(VECTOR3 obbangles, VECTOR3 obbcenter, VECTOR3 obbsize)
Draws an oriented box. Normals are sent and can be used for lighting. All parameters are float values...
bool isstaticdata
True if the data pointer data must not be deleted by this object.
Definition: gcg.h:8210
int ikey
The key as an integer: guaranteed to have at least 16 bits in C. It has 32 bits in x86-64 machines...
Definition: gcg.h:5883
const int GCG_VERSION_MINOR
Points to the integer minor version value.
Definition: gcg.h:396
unsigned int degree
Degree of the polynomials. Read-only. See setBasisDegree().
Definition: gcg.h:8408
float gcgBlinkingAlpha()
Computes a value between 0 and 1 in function of time that can be used as opacity value to simulate bl...
Generic abstract class to manage a hash table. A hash table is a data structure that organizes the no...
Definition: gcg.h:5623
unsigned int ncoefficients
Number of detail coefficients. Read-only. See setNumberOfSamples().
Definition: gcg.h:8571
int local_port
Local Port.
Definition: gcg.h:7352
unsigned int width
Width effectively used by the texture. It must be <= actualwidth.
Definition: gcg.h:7175
unsigned int nsamplesY
Current samples in Y direction. Read-only. See setNumberOfSamples().
Definition: gcg.h:8410
void * handle
Internal handle of this object.
Definition: gcg.h:4085
bool gcgSaveBytesAsText(unsigned int size, unsigned char *data, char *outputname)
Saves a byte array as C code for software embedding.
unsigned int palettecolors
Actual number of colors in the palette. It might be less than the maximum number of colors of a given...
Definition: gcg.h:2930
unsigned int actualheight
Real Height of the texture inside the graphics system: must be a power of 2.
Definition: gcg.h:7179
unsigned int keysize
Key size in bytes. If zero, the keys are null terminated string. Read-only.
Definition: gcg.h:6053
unsigned int gcgPackRLE32(unsigned int fullsize, unsigned char *srcdata, unsigned char *RLEdata)
Packs a 32 bit sequence as a Run-Lenght Encoded block. The parameter srcdata MUST be 4 aligned <=> fu...
gcgLINK * previous
Points to the left/previous gcgLINK node in a list. Same pointer as left. Read-only.
Definition: gcg.h:4719
gcgLINK * right
Points to the right/next gcgLINK node in a list. Same pointer as next. Read-only. ...
Definition: gcg.h:4701
unsigned int keysize
Size of each key in bytes. If zero, the key is a null terminated string. Maximum value is 255...
Definition: gcg.h:6700
Defines a lock for easy critical section control. Provides timed lock, which tries to lock an interna...
Definition: gcg.h:6421
unsigned int length
Signal length = number of samples.
Definition: gcg.h:7806
uintptr_t counter
Number of elements in this table. Read-only.
Definition: gcg.h:5625
Base abstract class for defining a hierarchical data structure in GCGlib for key/value mappings...
Definition: gcg.h:5931
bool isstaticdata
True if the data pointer data must not be deleted by this object.
Definition: gcg.h:7807
void gcgTriangleGradient(VECTOR3 grad_u, VECTOR3 v0, VECTOR3 v1, VECTOR3 v2, float u0, float u1, float u2)
Computes the gradient of a scalar u over a 3D triangle with edges (v0,v1), (v1, v2), (v2, v0).
#define NULL
Defines the null pointer.
Definition: gcg.h:554
unsigned int gcgUnpackRLE8(unsigned char *RLEdata, unsigned char *dstdata)
Decompress a 8 bit Run-Length Encoded data coded with gcgPackRLE8().
float gcgTriangleArea(VECTOR3 v0, VECTOR3 v1, VECTOR3 v2)
Computes the area of a triangle with edges (v0,v1), (v1, v2), (v2, v0). See Graphics Gems II - Pag...
bool gcgDrawVectorThetrahedron(float x, float y, float z, VECTOR3 vector, float scale)
Draws an oriented thetahedron (its base is not drawn) which can be used to represent vectors: 3 trian...
#define FEQUAL(a, b)
A macro for real numbers equality comparisons.
Definition: gcg.h:538
void * handle
Internal handle of this object.
Definition: gcg.h:6324
unsigned int actualwidth
Real width of the texture inside the graphics system: must be a power of 2.
Definition: gcg.h:7178
intptr_t intkey
Maximum integer key: guaranteed to be the same number of bits of a pointer.
Definition: gcg.h:5881
unsigned int nsamples
Current number of samples of each discretized polynomial. Read-only. See setNumberOfSamples().
Definition: gcg.h:8284
unsigned int columns
Number of columns.
Definition: gcg.h:8209
bool isConnected
True if this peer is connected.
Definition: gcg.h:7353
gcgCLASS ** table
Table of data structures. Internal use only.
Definition: gcg.h:5629
int origin
Origin coordinate: indicates the sample position of the origin (x = 0) of the signal.
Definition: gcg.h:7809
Controls and synchronizes multiple producers and consumers accessing a shared and limited buffer...
Definition: gcg.h:7065
Class for decode frames from a video file.
Definition: gcg.h:4491
bool gcgSaveBMPcode(char *inputname, char *outputname)
Saves a windows bitmap image as C code for software embedding.
It is a concrete class that defines a fast single linked list. This is a standard data structure that...
Definition: gcg.h:4853
Abstract class for 1D basis projection/reconstruction interfaces.
Definition: gcg.h:2787
Defines a synchronized and thread safe memory cache. This is an abstract data structure that may be u...
Definition: gcg.h:6696
bool gcgDrawVectorThetrahedronClosed(float x, float y, float z, VECTOR3 vector, float scale)
Draws an oriented thetrahedron (its base is also drawn) which can be used to represent vectors: 4 tri...
unsigned int rows
Number of rows.
Definition: gcg.h:8208
void * buffer
Buffer used in projection/reconstruction.
Definition: gcg.h:8574
unsigned int gcgUnpackRLE32(unsigned char *RLEdata, unsigned char *dstdata)
Decompress a 32 bit Run-Length Encoded data coded with gcgPackRLE32().
unsigned int gcgGetNumberOfProcessors()
Gets the number of processors installed in the system.
unsigned char * data
Image data where each pixel may be an index (1, 2, 4 and 8 bpp) or the actual color.
Definition: gcg.h:2924
struct _GCG_PATRICIA_NODE * root
Root node of the PATRICIA tree: internal only.
Definition: gcg.h:6056
int remote_port
Remote port.
Definition: gcg.h:7356
uintptr_t counter
Number of elements in this list. Read-only.
Definition: gcg.h:4857
gcgDISCRETE1D< NUMTYPE > rG
High pass reconstruction filter. Read-only.
Definition: gcg.h:8568
bool gcgEigenSymmetric(int norder, float matrix[], float eigenvectors[], float eigenvalues[])
Computes the eigensystem decomposition of a symmetric matrix matrix with arbitraty order...
long lkey
The key as a long integer: guaranteed to have at least 32 bits in C. It has 32 bits in x86-64 machine...
Definition: gcg.h:5882
unsigned long totalcost
Sum of the cost of all key/value pairs. Read-Only.
Definition: gcg.h:6698
gcgLINK * first
Points to the first gcgLINK node in the list. Read-only.
Definition: gcg.h:5086
const char * GCG_VERSION
Points to the full version string on the form: major.minor.build.
Definition: gcg.h:387
Generic abstract class to manage a AVL tree. AVL tree is a self balancing data structure that keeps a...
Definition: gcg.h:5456
Class for handling images with up to 32 bits per pixel and up to 4 channels.
Definition: gcg.h:2922
Implements methods for peer-to-peer communication using TCP/IP protocol.
Definition: gcg.h:7349
Generic abstract class to allow iterations over the several GCGlib data structures. The gcgITERATOR::next() returns the next object until it is NULL. The returned object type depends on the data structure and commonly is a specialization of gcgORDEREDNODE, gcgDOUBLELINK or gcgLINK classes. While iteration is being done, the original data structure must not be changed by insertions, removals or moves. Iterators copies all needed information to iterate over the nodes and are not allowed to change its associated data structure. A data structure can have several gcgITERATOR instances working at a time. The gcgITERATOR object must be deleted after use.
Definition: gcg.h:4609
Generic abstract class for defining an extended node for use in ordered data structures like gcgORDER...
Definition: gcg.h:5334
gcgDISCRETE1D< NUMTYPE > G
High pass decomposition filter. Read-only.
Definition: gcg.h:8566
unsigned int nsamplesX
Current samples in X direction. Read-only. See setNumberOfSamples().
Definition: gcg.h:8409
Base abstract class for defining a sequential data structure in GCGlib for lists. It indicates the mi...
Definition: gcg.h:4735
gcgJOB()
Constructs a valid and empty job. It is intended to be implemented by specialized classes...
Definition: gcg.h:6837
GCG - Group for Computer Graphics, Image and Vision library.
gcgLINK * next
Points to the right/next gcgLINK node in a list. Same pointer as right. Read-only.
Definition: gcg.h:4700
bool gcgInverseMatrix2(MATRIX2 inverse, MATRIX2 matrix)
Computes the inverse of a 2x2 matrix by the direct method. It is suitable for fast inverse computatio...
gcgLINK * last
Points to the last gcgLINK node in the list. Read-only.
Definition: gcg.h:4856
Generic abstract class for defining a thread.
Definition: gcg.h:6322
unsigned int gcgCompressImageRLE8(unsigned int width, unsigned int height, unsigned char *srcdata, unsigned char *RLEdata)
Compress a 8 bit bitmap image as a Run-Lenght Encoded block.
Base class for all GCGlib classes. It is used for better control of object instantiation, memory allocation, and object reuse. Some systems (like DLL versions in Windows) might demand special tasks in order to be stable. All GCGlib classes must be inherited from gcgCLASS.
Definition: gcg.h:957
Union type for defining digital keys for data map classes. The data maps might use fixed or variable ...
Definition: gcg.h:5879