--- ray/src/util/rpiece.c 2007/08/22 18:46:36 2.47 +++ ray/src/util/rpiece.c 2009/02/07 05:40:47 2.50 @@ -1,5 +1,5 @@ #ifndef lint -static const char RCSid[] = "$Id: rpiece.c,v 2.47 2007/08/22 18:46:36 greg Exp $"; +static const char RCSid[] = "$Id: rpiece.c,v 2.50 2009/02/07 05:40:47 greg Exp $"; #endif /* * Generate sections of a picture. @@ -9,11 +9,12 @@ static const char RCSid[] = "$Id: rpiece.c,v 2.47 2007 #include #include #include + +#include "platform.h" #ifndef NON_POSIX /* XXX need abstraction for process management */ #include #endif -#include "platform.h" #include "standard.h" #include "color.h" #include "view.h" @@ -107,7 +108,7 @@ main( while ((rval = expandarg(&argc, &argv, i)) > 0) ; if (rval < 0) { - fprintf(stderr, "%s: cannot expand '%s'", + fprintf(stderr, "%s: cannot expand '%s'\n", argv[0], argv[i]); exit(1); } @@ -437,10 +438,10 @@ rpiece(void) /* render picture piece by piece */ pview = ourview; switch (ourview.type) { case VT_PER: - pview.horiz = 2.*180./PI*atan( - tan(PI/180./2.*ourview.horiz)/hmult ); - pview.vert = 2.*180./PI*atan( - tan(PI/180./2.*ourview.vert)/vmult ); + pview.horiz = (2.*180./PI)*atan( + tan((PI/180./2.)*ourview.horiz)/hmult ); + pview.vert = (2.*180./PI)*atan( + tan((PI/180./2.)*ourview.vert)/vmult ); break; case VT_PAR: case VT_ANG: @@ -449,14 +450,26 @@ rpiece(void) /* render picture piece by piece */ break; case VT_CYL: pview.horiz = ourview.horiz / hmult; - pview.vert = 2.*180./PI*atan( - tan(PI/180./2.*ourview.vert)/vmult ); + pview.vert = (2.*180./PI)*atan( + tan((PI/180./2.)*ourview.vert)/vmult ); break; case VT_HEM: - pview.horiz = 2.*180./PI*asin( - sin(PI/180./2.*ourview.horiz)/hmult ); - pview.vert = 2.*180./PI*asin( - sin(PI/180./2.*ourview.vert)/vmult ); + pview.horiz = (2.*180./PI)*asin( + sin((PI/180./2.)*ourview.horiz)/hmult ); + pview.vert = (2.*180./PI)*asin( + sin((PI/180./2.)*ourview.vert)/vmult ); + break; + case VT_PLS: + pview.horiz = sin((PI/180./2.)*ourview.horiz) / + (1.0 + cos((PI/180./2.)*ourview.horiz)) / hmult; + pview.horiz *= pview.horiz; + pview.horiz = (2.*180./PI)*acos((1. - pview.horiz) / + (1. + pview.horiz)); + pview.vert = sin((PI/180./2.)*ourview.vert) / + (1.0 + cos((PI/180./2.)*ourview.vert)) / vmult; + pview.vert *= pview.vert; + pview.vert = (2.*180./PI)*acos((1. - pview.vert) / + (1. + pview.vert)); break; default: fprintf(stderr, "%s: unknown view type '-vt%c'\n",