--- ray/src/cv/mgf2inv.c 2011/02/18 00:40:25 2.1 +++ ray/src/cv/mgf2inv.c 2014/03/06 00:40:37 2.4 @@ -1,5 +1,5 @@ #ifndef lint -static const char RCSid[] = "$Id: mgf2inv.c,v 2.1 2011/02/18 00:40:25 greg Exp $"; +static const char RCSid[] = "$Id: mgf2inv.c,v 2.4 2014/03/06 00:40:37 greg Exp $"; #endif /* * Convert MGF to Inventor file. @@ -29,8 +29,7 @@ static const char RCSid[] = "$Id: mgf2inv.c,v 2.1 2011 #define VERTFMT "%+16.9e %+16.9e %+16.9e\n%+6.3f %+6.3f %+6.3f" #define VZVECT "+0.000 +0.000 +0.000" -#define VFSEPPOS 50 /* position of newline in above */ -#define VFLEN 72 /* total vertex string length */ +#define VFLEN 92 /* total vertex string length */ #define MAXVERT 10240 /* maximum cached vertices */ #define setvkey(k,v) sprintf(k,VERTFMT,(v)->p[0],(v)->p[1],(v)->p[2],\ @@ -487,13 +486,8 @@ i_cyl( /* translate a cylinder description */ va[0] = v2->p[0] - v1->p[0]; va[1] = v2->p[1] - v1->p[1]; va[2] = v2->p[2] - v1->p[2]; - length = sqrt(DOT(va,va)); - if (va[1] >= length) - angle = 0.; - else if (va[1] <= -length) - angle = PI; - else - angle = acos(va[1]/length); + length = VLEN(va); + angle = Acos(va[1]/length); printf("%sTranslation { translation %13.9g %13.9g %13.9g }\n", tabs, .5*(v1->p[0]+v2->p[0]), .5*(v1->p[1]+v2->p[1]), .5*(v1->p[2]+v2->p[2])); @@ -529,6 +523,7 @@ to_id( /* make sure a name is a valid Inventor ID */ void flush_cache(void) /* put out cached faces */ { + int VFSEPPOS = strchr(vlist[0],'\n') - vlist[0]; int donorms = 0; register struct face *f; register int i;