File indexing completed on 2024-05-19 07:32:58
0001 #include "tessellate.h" 0002 #include <stdio.h> 0003 #include <stdlib.h> 0004 0005 void run_example(const double vertices_array[], const double *contours_array[], int contours_size) 0006 { 0007 double *coordinates_out; 0008 int *tris_out; 0009 int nverts, ntris, i; 0010 0011 const double *p = vertices_array; 0012 /* const double **contours = contours_array; */ 0013 0014 tessellate(&coordinates_out, &nverts, &tris_out, &ntris, contours_array, contours_array + contours_size); 0015 0016 for (i = 0; i < 2 * nverts; ++i) 0017 { 0018 fprintf(stdout, "%g ", coordinates_out[i]); 0019 } 0020 fprintf(stdout, "\n"); 0021 for (i = 0; i < 3 * ntris; ++i) 0022 { 0023 fprintf(stdout, "%d ", tris_out[i]); 0024 } 0025 fprintf(stdout, "\n"); 0026 free(coordinates_out); 0027 if (tris_out) 0028 free(tris_out); 0029 } 0030 0031 int main() 0032 { 0033 double a1[] = { 0, 0, 1, 5, 2, 0, -1, 3, 3, 3 }; 0034 const double *c1[] = { a1, a1 + 10 }; 0035 int s1 = 2; 0036 run_example(a1, c1, 2); 0037 0038 double a2[] = { 0, 0, 3, 0, 3, 3, 0, 3, 1, 1, 2, 1, 2, 2, 1, 2 }; 0039 const double *c2[] = { a2, a2 + 8, a2 + 16 }; 0040 int s2 = 3; 0041 run_example(a2, c2, s2); 0042 0043 double a3[] = { 441, 0, 326, 0, 326, 889, 12, 889, 12, 992, 755, 992, 755, 889, 441, 889 }; 0044 const double *c3[] = { a3, a3 + 16 }; 0045 int s3 = 2; 0046 run_example(a3, c3, s3); 0047 0048 return 0; 0049 }