int main(int argc, char **argv) { point_t a, b, c, d; struct rt_wdb *fp; si.magic = RT_NURB_INTERNAL_MAGIC; si.nsrf = 0; si.srfs = (struct face_g_snurb **)bu_malloc( sizeof(struct face_g_snurb *)*100, "snurb ptrs"); if ((fp = wdb_fopen(argv[1])) == NULL) { bu_log("unable to open new database [%s]\n", argv[1]); perror("unable to open database file"); return 1; } mk_id( fp, "Mike's Spline Test" ); VSET( a, 0, 0, 0 ); VSET( b, 10, 0, 0 ); VSET( c, 10, 10, 0 ); VSET( d, 0, 10, 0 ); make_face( a, b, c, d, 2 ); mk_export_fwrite( fp, "spl", (genptr_t)&si, ID_BSPLINE ); return 0; }
int main(int argc, char *argv[]) { point_t a, b, c, d; struct rt_wdb *fp; struct rt_nurb_internal *si; char *filename = "spltest.g"; int helpflag; if (argc < 1 || argc > 2) { printusage(argv); bu_exit(1,NULL); } helpflag = (argc == 2 && ( BU_STR_EQUAL(argv[1],"-h") || BU_STR_EQUAL(argv[1],"-?"))); if (argc == 1 || helpflag) { printusage(argv); if (helpflag) bu_exit(1,NULL); bu_log(" Program continues running:\n"); } if (argc == 2) filename = argv[1]; if ((fp = wdb_fopen(filename)) == NULL) { perror("unable to open geometry database for writing"); bu_exit(1, "unable to open new database [%s]\n", filename); } mk_id(fp, "Mike's Spline Test"); VSET(a, 0, 0, 0); VSET(b, 10, 0, -5); VSET(c, 10, 10, 10); VSET(d, 0, 10, 0); BU_ALLOC(si, struct rt_nurb_internal); si->magic = RT_NURB_INTERNAL_MAGIC; si->nsrf = 0; si->srfs = (struct face_g_snurb **)bu_malloc(sizeof(struct face_g_snurb *)*100, "allocate snurb ptrs"); make_face(si, a, b, c, d, 2); /* wdb_export */ mk_export_fwrite(fp, "spltest", (void *)si, ID_BSPLINE); bu_log("Saving file %s\n",filename); return 0; }