static int writePC33(bor_pc_t *pc, int fd) { FILE *fout; bor_pc_it_t pcit; bor_vec3_t *v; fout = fdopen(fd, "w"); if (!fout) return -1; // first print dimensions fprintf(fout, "3\n"); // then write number of points fprintf(fout, "%d\n", (int)borPCLen(pc)); // and write all points borPCItInit(&pcit, (bor_pc_t *)pc); while (!borPCItEnd(&pcit)){ v = (bor_vec3_t *)borPCItGet(&pcit); fprintf(fout, "%g %g %g\n", borVec3X(v), borVec3Y(v), borVec3Z(v)); borPCItNext(&pcit); } fclose(fout); return 0; }
void pcPrint(bor_pc_t *pc) { size_t i, len = borPCLen(pc); const bor_vec3_t *w; for (i = 0; i < len; i++){ w = (bor_vec3_t *)borPCGet(pc, i); fprintf(stdout, "%g %g %g\n", borVec3X(w), borVec3Y(w), borVec3Z(w)); } }
static void pcPrint(bor_pc_t *pc) { size_t i, j, len = borPCLen(pc); const bor_vec_t *w; for (i = 0; i < len; i++){ w = borPCGet(pc, i); for (j = 0; j < pc->dim; j++){ fprintf(stdout, "%f ", (float)borVecGet(w, j)); } fprintf(stdout, "\n"); } }