error compiling nurbs-2.1.1
Eric Z. Ayers
eric.ayers@compgen.com
Thu Dec 24 07:10:00 GMT 1998
I retrieved the 'nurbs-2.1.1' package from
ftp://ftp.cs.umn.edu/users/mein/mindseye/extras/
I am using redhat 5.2 with egcs version:
c++ -v
Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.90.29/specs
gcc version egcs-2.90.29 980515 (egcs-1.0.3 release)
make[1]: Entering directory `/home/eric/src/nurbs-2.1.1/src'
g++ -c -g -O2 -fno-implicit-templates -I/usr/local/include -I../../matrix/include -I/usr/local/include -I../include nurbsS.cc
nurbsS.cc: In method `int PlNurbsSurface::writePOVRAY(const char *, const class Color & = Color(250, 250, 250), const class Point3D & = Point3D(0x000000000000000000000000, 0x00000000000000000080ff3f, 0x000000000000000000000000), const class Point3D & = Point3D(0x000000000000000000000000, 0x000000000000000000000000, 0x00000000000000000080ff3f), int = 1, double = 0x000000d8a3703d0ad7a3f83f, int = 8, int = 8) const':
nurbsS.cc:3189: Internal compiler error.
nurbsS.cc:3189: Please submit a full bug report to `egcs-bugs@cygnus.com'.
make[1]: *** [nurbsS.o] Error 1
make[1]: Leaving directory `/home/eric/src/nurbs-2.1.1/src'
make: *** [all] Error 2
This line is the end of a subroutine.
I tried to help track this down by commenting out code in the
function. I commented out all of the code until I was left with
simply a prototype and 'return 0' that kept it from barfing (on that
function) so I went back and added code in until I could get it to
barf again.
When I uncomment down to the lines 'camera1 = xxx' camera2 = xxxx it
dumps at the end of the function. If I comment those 2 lines out
(and everything below) it barfs on the next function instead of this
one.
A big hint: compiling without -02 fixes it
another big hint: compiling with just plain -O works too
Here's the function: ( know it's not a lot of help without the rest
of the source...)
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
Member: writePOVRAY --- writes a set of povray bicubic patches
Description: Writes a set of povray bicubic patches to the ostream.
Input: patch_type --> the type of the patch
flatness --> the flatness level
num_u_steps --> the minimum number of triangles in the U
direction
num_v_steps --> the minimum number of triangles in the V
direction
Output: an ostream containing the definition of the surface
Restrictions: POVRAY only accepts rational spline patches. Thus you can't
have a value other then 1.0 for the weights of your surface.
A warning message will be generated if this is the case.
POVRAY only deals with surfaces of degree 3. If the surface
as a degree below 3 either in the U or V direction it will be
elevated to be at 3 in both directions. If the surface as a
degree higher then 3, then the function aborts.
Created by: Philippe Lavoie (8 October, 1997)
Modified by:
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
int PlNurbsSurface::writePOVRAY(const char *filename, const Color& col, const Point3D& cView, const Point3D& up, int patch_type, double flatness, int num_u_steps, int num_v_steps) const {
ofstream fout(filename) ;
if(!fout)
return 0 ;
Point3D view(-1*cView) ;
fout << "//\n//Generated for POV-Ray(tm) 3.0 by Phil's NURBS library\n//\n" ;
fout << "\n#include \"colors.inc\"\n" ;
// we want the camera to look at the center of the object
// and be able to view the whole object
// we use and angle of 36 to view the object
// and position the rest according to this.
Point3D minP, maxP ;
minP.x = extremum(1,coordX) ;
minP.y = extremum(1,coordY) ;
minP.z = extremum(1,coordZ) ;
maxP.x = extremum(0,coordX) ;
maxP.y = extremum(0,coordY) ;
maxP.z = extremum(0,coordZ) ;
Point3D lookAt ;
lookAt.x = (minP.x+maxP.x)/2.0 ;
lookAt.y = (minP.y+maxP.y)/2.0 ;
lookAt.z = (minP.z+maxP.z)/2.0 ;
Point3D camera1, camera2 ;
Point3D q1 = minP-lookAt ;
Point3D q2 = maxP-lookAt ;
float D1 = absolute(dot(q1,view))/abs(view) ;
float D2 = absolute(dot(q2,view))/abs(view) ;
float a1 = abs(q1)*cos(angle(view,q1)) ;
float a2 = abs(q2)*cos(angle(view,q2)) ;
float b1 = D1/tan(18.0*M_PI/180.0) ;
float b2 = D2/tan(18.0*M_PI/180.0) ; // this gives the 36 degree angle
// EGCS BUG!!!!!!!!!!!!!!
// COMMENT ADDED BY ERIC
// If you comment out these two lines, and all code after it
// it works
// EGCS BUG!!!!!!!!!!!!!!
camera1 = lookAt+(a1+b1)*view.unitLength() ;
camera2 = lookAt+(a2+b2)*view.unitLength() ;
Point3D right ;
right = crossProduct(view,up) ; // inversed because pov-ray uses a left-handed system
fout << "camera {\n\tlocation <" ;
if(abs2(camera1-lookAt)>abs2(camera2-lookAt))
fout << camera1.x << ", " << camera1.y << ", " << camera1.z << ">\n" ;
else
fout << camera2.x << ", " << camera2.y << ", " << camera2.z << ">\n" ;
fout << "\tup < " << up.x << ", " << up.y << ", " << up.z << ">\n" ;
fout << "\tright < " << right.x << ", " << right.y << ", " << right.z << ">\n" ;
fout << "\tlook_at < " << lookAt.x << ", " << lookAt.y << ", " << lookAt.z << ">\n\tangle 36\n}\n\n" ;
fout << "union {\n" ;
writePOVRAY(fout,patch_type,flatness,num_u_steps,num_v_steps) ;
fout << " texture {\n\tpigment {\n\t\tcolor rgb < " << (double)col.r/255.0 <<
", " << (double)col.g/255.0 << ", " << (double)col.b/255.0 << "> \n" <<
"\t}\n\tfinish { \n\t\tambient .2\n\t\tdiffuse .6\n\t}\n }\n" ;
fout << "\n}\n" ;
fout << "light_source { < " ;
if(abs2(camera1-lookAt)>abs2(camera2-lookAt))
fout << camera1.x+view.x << ", " << camera1.y+view.y << ", " << camera1.z+view.z << "> color White}\n\n" ;
else
{
fout << camera2.x+view.x << ", " << camera2.y+view.y << ", " << camera2.z+view.z << "> color White}\n\n" ;
}
return fout.good() ;
}
More information about the Gcc-bugs
mailing list