Doxygen Source Code Documentation
SUMA_gts_insert.c File Reference
Go to the source code of this file.
Functions | |
| void | vertex_load (GtsPoint *p, gpointer *data) |
| void | face_load (GtsTriangle *t, gpointer *data) |
| void | gts_surface_suma (GtsSurface *s, float **NodeListp, int *N_Nodep, int *NodeDimp, int **FaceSetListp, int *N_FaceSetp, int *FaceSetDimp) |
Function Documentation
|
||||||||||||
|
Definition at line 27 of file SUMA_gts_insert.c. References v1. Referenced by gts_surface_suma().
00028 {
00029 int *FaceSetList = (int *)data[0];
00030 int *n = (int *)data[1];
00031 GtsVertex * v1, * v2, * v3;
00032 gts_triangle_vertices (t, &v1, &v2, &v3);
00033 FaceSetList[*n*3] = (int)GPOINTER_TO_UINT (GTS_OBJECT (v1)->reserved);
00034 FaceSetList[*n*3+1] =(int) GPOINTER_TO_UINT (GTS_OBJECT (v2)->reserved);
00035 FaceSetList[*n*3+2] = (int)GPOINTER_TO_UINT (GTS_OBJECT (v3)->reserved);
00036 fprintf (stderr, "Triangle %d: %d %d %d\n", *n, FaceSetList[*n*3], FaceSetList[*n*3+1], FaceSetList[*n*3+2]);
00037 GTS_OBJECT (t)->reserved = GUINT_TO_POINTER ((*((guint *) data[1]))++);
00038 *n++; /* does not work, but trick above does */
00039 }
|
|
||||||||||||||||||||||||||||||||
|
Definition at line 42 of file SUMA_gts_insert.c. References calloc, face_load(), and vertex_load(). Referenced by SUMA_Mesh_Resample().
00045 {
00046 guint n = 0;
00047 gpointer data[2];
00048 GtsSurfaceStats stats;
00049 float *NodeList = NULL;
00050 int *FaceSetList = NULL;
00051
00052 g_return_if_fail (s != NULL);
00053
00054
00055
00056 gts_surface_stats (s, &stats);
00057
00058 /* get the stats */
00059 fprintf (stderr,
00060 "gts_surface_suma: Number of vertices %u\n",
00061 stats.edges_per_vertex.n);
00062 fprintf (stderr,
00063 "gts_surface_suma: Number of triangles %u\n",
00064 stats.n_faces);
00065 NodeList = (float *)calloc( stats.edges_per_vertex.n * 3, sizeof(float));
00066 FaceSetList = (int *)calloc(stats.n_faces * 3, sizeof(int));
00067
00068 if (!NodeList || !FaceSetList) {
00069 fprintf(stderr,"Critical Error gts_surface_suma: Could not allocate.\n");
00070 g_return_if_fail (0);
00071 }
00072
00073 /* get the nodes */
00074 n = 0;
00075 data[0] = (gpointer)NodeList;
00076 data[1] = (gpointer)&n;
00077 gts_surface_foreach_vertex (s, (GtsFunc) vertex_load, data);
00078
00079 /* get the facesets */
00080 n = 0;
00081 data[0] = (gpointer)FaceSetList;
00082 data[1] = (gpointer)&n;
00083 gts_surface_foreach_face (s, (GtsFunc) face_load , data);
00084
00085 /* don't know what these two are for,
00086 assuming it has to do with the ->reserved business in vertex_load and face_load above */
00087 gts_surface_foreach_vertex (s, (GtsFunc) gts_object_reset_reserved, NULL);
00088 gts_surface_foreach_face (s, (GtsFunc) gts_object_reset_reserved, NULL);
00089
00090 /* set results */
00091 *N_FaceSetp = (int)stats.n_faces;
00092 *N_Nodep = (int)stats.edges_per_vertex.n;
00093 *NodeListp = NodeList;
00094 *FaceSetListp = FaceSetList;
00095 *NodeDimp = 3;
00096 *FaceSetDimp = 3;
00097 return;
00098 }
|
|
||||||||||||
|
Definition at line 16 of file SUMA_gts_insert.c. References p. Referenced by gts_surface_suma().
00017 {
00018 float *NodeList = (float *)data[0];
00019 int *n = (int *)data[1];
00020 NodeList[*n*3] = (float) p->x;
00021 NodeList[*n*3+1] = (float) p->y;
00022 NodeList[*n*3+2] = (float) p->z;
00023 fprintf (stderr, "Node %d: %g %g %g\n", *n, (double)NodeList[*n*3], (double)NodeList[*n*3+1] , (double)NodeList[*n*3+2]);
00024 GTS_OBJECT (p)->reserved = GUINT_TO_POINTER ((*((guint *) data[1]))++);
00025 *n++; /* does not work, but trick above does */
00026 }
|