00001
00032 #ifndef _BIOM_H_
00033 #define _BIOM_H_
00034
00035 #include <gamer/gamer_base.h>
00036
00037 #include <gamer/triangle.h>
00038 #include <gamer/tetgen.h>
00039
00040 #if 0
00041 #include <stdio.h>
00042 #include <stdlib.h>
00043 #include <math.h>
00044 #include <time.h>
00045 #include <string.h>
00046 #include <sys/times.h>
00047 #include <sys/stat.h>
00048 #include <memory.h>
00049 #endif
00050
00051
00052
00054 #define IsoValue 2.5
00055
00056 #define BLOBBYNESS -0.2f
00057
00058 #define DIM_SCALE 1.99
00059
00060 #define CoarsenRate 0.1666
00061
00062 #define MIN_VOLUME 333333
00063
00064 #define SphereRatio 40
00065
00066 #define MaxVal 999999
00067 #define MaxAtom 10
00068
00069
00070
00072 #define PIE 3.14159265358979f
00073
00074 #define IndexVect(i,j,k) ((k)*xdim*ydim + (j)*xdim + (i))
00075 #define IndexVect1(i,j,k) ((k)*xdim1*ydim1 + (j)*xdim1 + (i))
00076
00077 #define max(x, y) ((x>y) ? (x):(y))
00078
00079 #define min(x, y) ((x<y) ? (x):(y))
00080
00082 #define _LITTLE_ENDIAN 1
00083
00085 typedef struct {
00086 float x;
00087 float y;
00088 }FLT2VECT;
00089
00091 typedef struct {
00092 float x;
00093 float y;
00094 float z;
00095 }FLTVECT;
00096
00098 typedef struct {
00099 double x;
00100 double y;
00101 double z;
00102 }DBLVECT;
00103
00105 typedef struct {
00106 int a;
00107 int b;
00108 int c;
00109 }INT3VECT;
00110
00112 typedef struct {
00113 int a;
00114 int b;
00115 int c;
00116 int d;
00117 }INT4VECT;
00118
00120 typedef struct {
00121 int nv;
00122 int nf;
00123 float avglen;
00124 float min[3];
00125 float max[3];
00126 FLTVECT *vertex;
00127 INT3VECT *face;
00128 INT3VECT *neighbor;
00129 }SurFaceMesh;
00130
00132 typedef struct {
00133 int nv;
00134 int nf;
00135 FLTVECT *vertex;
00136 INT4VECT *face;
00137 INT4VECT *neighbor;
00138 }TeTraMesh;
00139
00140
00142 typedef struct SamplePoint SPNT;
00144 struct SamplePoint{
00145 float x;
00146 float y;
00147 float z;
00148 SPNT *next;
00149 };
00150
00151
00153 typedef struct NeighborPoint3 NPNT3;
00155 struct NeighborPoint3{
00156 int a;
00157 int b;
00158 int c;
00159 NPNT3 *next;
00160 };
00161
00162
00164 typedef struct NeighborPoint2 NPNT2;
00166 struct NeighborPoint2{
00167 int a;
00168 int b;
00169 NPNT2 *next;
00170 };
00171
00173 typedef struct {
00174 float x;
00175 float y;
00176 float z;
00177 float radius;
00178 }ATOM;
00179
00180
00182 typedef struct {
00183 float x1;
00184 float y1;
00185 float z1;
00186 float x2;
00187 float y2;
00188 float z2;
00189 float x3;
00190 float y3;
00191 float z3;
00192 }EIGENVECT;
00193
00194
00196 typedef struct {
00197 unsigned short *x;
00198 unsigned short *y;
00199 unsigned short *z;
00200 int *seed;
00201 float *dist;
00202 int size;
00203 }MinHeapS;
00204
00205
00207 typedef struct{
00208 float seedx;
00209 float seedy;
00210 float seedz;
00211 int atom[MaxAtom];
00212 }SEEDS;
00213
00214
00215 NPNT3** CreateNeigborList(SurFaceMesh*);
00216 void GetMinMaxAnglesSurfaceOnly(SurFaceMesh* ,float*, float*, int*, int*, int, int);
00217 void RefineSurfaceMesh(SurFaceMesh*&, NPNT3**&);
00218 void ReadActiveSiteFile(char*, unsigned int&, ATOM*&, unsigned int*&, float*&);
00219 bool SmoothMesh(SurFaceMesh*, NPNT3**, unsigned int, unsigned int, unsigned int, bool);
00220 void NormalSmoothMesh(SurFaceMesh*, NPNT3**);
00221 char CoarseMesh(SurFaceMesh*, NPNT3**,unsigned int*, float, float, float, float);
00222 void DestroyNeigborlist(NPNT3**, unsigned int);
00223 void AssignActiveSites(SurFaceMesh*, ATOM*, unsigned int, unsigned int*, unsigned int*);
00224 void CorrectNormals(SurFaceMesh*);
00225
00226 void ReadSurfMeshFile(char*, bool, char*, SurFaceMesh*&, int&);
00227
00228 void ReadActiveSiteFile(char*, unsigned int&, ATOM*&, unsigned int*&);
00229 void ReadRawiv(int *, int *, int *, float **, char *,float *, float *);
00230 void ReadMeshOFF(char*, SurFaceMesh*&);
00231 void WriteMesh3OFF(SurFaceMesh *, FILE *);
00232 void SurfaceExtract(TeTraMesh *, SurFaceMesh *);
00233 float PDB2Volume(char *, float **, int *, int *, int *,float *, float *, ATOM **,int *,char);
00234 void MarchingCube(int, int, int, float *, float, float, SurFaceMesh **,SPNT **);
00235 void MergeSurfaceMesh(SurFaceMesh *,SurFaceMesh *,SurFaceMesh *);
00236 void GenerateSphereMesh(int, SurFaceMesh **);
00237 void ReadPDB(char *,int *, ATOM **, float [], float []);
00238 void PDB2Mesh(int, ATOM *, float [], float [], SurFaceMesh **);
00239
00240 #endif
00241