optimization/4953: [dfa-branch] ICE in reg_overlap_mentioned_for_reload_p, at reload.c:6158

Naveen Sharma naveens@pamela.noida.hcltech.com
Fri Nov 16 22:31:00 GMT 2001


>Number:         4953
>Category:       optimization
>Synopsis:       [dfa-branch] ICE in  reg_overlap_mentioned_for_reload_p, at reload.c:6158
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          ice-on-legal-code
>Submitter-Id:   net
>Arrival-Date:   Tue Nov 27 01:36:01 PST 2001
>Closed-Date:
>Last-Modified:
>Originator:     Naveen Sharma
>Release:        3.1 20010830 (experimental)
>Organization:
HCLT
>Environment:
System: Linux 2.4.2-2 #1 Sun Apr 8 20:41:30 EDT 2001 i686 unknown
Architecture: i686
host: i686-pc-linux-gnu
build: i686-pc-linux-gnu
target: sh-unknown-elf
configured with: ../gcc/configure --target=sh-elf --with-as=sh-elf-as --with-ld=sh-elf-ld
>Description:
 when the following tp is compiled using -c -ml -m4 -O2 options,the
 compiler aborts.


typedef int __int32_t;
typedef unsigned int __uint32_t;

struct _glue 
{
  struct _glue *_next;
  int _niobs;
  struct __sFILE *_iobs;
};

struct _Bigint 
{
  struct _Bigint *_next;
  int _k, _maxwds, _sign, _wds;
  unsigned long _x[1];
};
struct _atexit {
	struct	_atexit *_next;			 
	int	_ind;				 
	void	(*_fns[32 ])();	 
};

 






struct __sbuf {
	unsigned char *_base;
	int	_size;
};

 




typedef long _fpos_t;		 
				 

struct __sFILE {
  unsigned char *_p;	 
  int	_r;		 
  int	_w;		 
  short	_flags;		 
  short	_file;		 
  struct __sbuf _bf;	 
  int	_lbfsize;	 

   
  void * 	_cookie;	 

  int	 (*_read)   (void *  _cookie, char *_buf, int _n)  ;
  int	 (*_write)   (void *  _cookie, const char *_buf, int _n)  ;
  _fpos_t  (*_seek)   (void *  _cookie, _fpos_t _offset, int _whence)  ;
  int	 (*_close)   (void *  _cookie)  ;

   
  struct __sbuf _ub;	 
  unsigned char *_up;	 
  int	_ur;		 

   
  unsigned char _ubuf[3];	 
  unsigned char _nbuf[1];	 

   
  struct __sbuf _lb;	 

   
  int	_blksize;	 
  int	_offset;	 

  struct _reent *_data;
};


struct _reent
{
   
  int _errno;

   


  struct __sFILE *_stdin, *_stdout, *_stderr;

  int  _inc;			 
  char _emergency[25];
 
  int _current_category;	 
  const  char *_current_locale;

  int __sdidinit;		 

  void  (*__cleanup)   (struct _reent *)  ;

   
  struct _Bigint *_result;
  int _result_k;
  struct _Bigint *_p5s;
  struct _Bigint **_freelist;

   
  int _cvtlen;			 
  char *_cvtbuf;

   

  unsigned char * _nextf[30 ];
  unsigned int _nmalloc[30 ];

   
  struct _atexit *_atexit;	 
  struct _atexit _atexit0;	 

   
  void (**(_sig_func))();

   


  struct _glue __sglue;			 
  struct __sFILE __sf[3];		 
};



extern struct _reent *_impure_ptr  ;

void _reclaim_reent  (struct _reent *)  ;

union __dmath
{
  __uint32_t i[2];
  double d;
};

extern const union __dmath __infinity;
extern double atan  (double)  ;
extern double cos  (double)  ;
extern double sin  (double)  ;
extern double tan  (double)  ;
extern double tanh  (double)  ;
extern double frexp  (double, int *)  ;
extern double modf  (double, double *)  ;
extern double ceil  (double)  ;
extern double fabs  (double)  ;
extern double floor  (double)  ;


 



extern double acos  (double)  ;
extern double asin  (double)  ;
extern double atan2  (double, double)  ;
extern double cosh  (double)  ;
extern double sinh  (double)  ;
extern double exp  (double)  ;
extern double ldexp  (double, int)  ;
extern double log  (double)  ;
extern double log10  (double)  ;
extern double pow  (double, double)  ;
extern double sqrt  (double)  ;
extern double fmod  (double, double)  ;





 

extern double infinity  (void)  ;
extern double nan  (void)  ;
extern int isnan  (double)  ;
extern int isinf  (double)  ;
extern int finite  (double)  ;
extern double copysign  (double, double)  ;
extern int ilogb  (double)  ;

extern double asinh  (double)  ;
extern double cbrt  (double)  ;
extern double nextafter  (double, double)  ;
extern double rint  (double)  ;
extern double scalbn  (double, int)  ;


extern double log1p  (double)  ;
extern double expm1  (double)  ;



extern double acosh  (double)  ;
extern double atanh  (double)  ;
extern double remainder  (double, double)  ;
extern double gamma  (double)  ;
extern double gamma_r  (double, int *)  ;
extern double lgamma  (double)  ;
extern double lgamma_r  (double, int *)  ;
extern double erf  (double)  ;
extern double erfc  (double)  ;
extern double y0  (double)  ;
extern double y1  (double)  ;
extern double yn  (int, double)  ;
extern double j0  (double)  ;
extern double j1  (double)  ;
extern double jn  (int, double)  ;



extern double hypot  (double, double)  ;


extern double cabs();
extern double drem  (double, double)  ;



 

extern float atanf  (float)  ;
extern float cosf  (float)  ;
extern float sinf  (float)  ;
extern float tanf  (float)  ;
extern float tanhf  (float)  ;
extern float frexpf  (float, int *)  ;
extern float modff  (float, float *)  ;
extern float ceilf  (float)  ;
extern float fabsf  (float)  ;
extern float floorf  (float)  ;


extern float acosf  (float)  ;
extern float asinf  (float)  ;
extern float atan2f  (float, float)  ;
extern float coshf  (float)  ;
extern float sinhf  (float)  ;
extern float expf  (float)  ;
extern float ldexpf  (float, int)  ;
extern float logf  (float)  ;
extern float log10f  (float)  ;
extern float powf  (float, float)  ;
extern float sqrtf  (float)  ;
extern float fmodf  (float, float)  ;


 

extern float infinityf  (void)  ;
extern float nanf  (void)  ;
extern int isnanf  (float)  ;
extern int isinff  (float)  ;
extern int finitef  (float)  ;
extern float copysignf  (float, float)  ;
extern int ilogbf  (float)  ;

extern float asinhf  (float)  ;
extern float cbrtf  (float)  ;
extern float nextafterf  (float, float)  ;
extern float rintf  (float)  ;
extern float scalbnf  (float, int)  ;
extern float log1pf  (float)  ;
extern float expm1f  (float)  ;


extern float acoshf  (float)  ;
extern float atanhf  (float)  ;
extern float remainderf  (float, float)  ;
extern float gammaf  (float)  ;
extern float gammaf_r  (float, int *)  ;
extern float lgammaf  (float)  ;
extern float lgammaf_r  (float, int *)  ;
extern float erff  (float)  ;
extern float erfcf  (float)  ;
extern float y0f  (float)  ;
extern float y1f  (float)  ;
extern float ynf  (int, float)  ;
extern float j0f  (float)  ;
extern float j1f  (float)  ;
extern float jnf  (int, float)  ;

extern float hypotf  (float, float)  ;

extern float cabsf();
extern float dremf  (float, float)  ;



 

extern int signgam;

 


struct exception 

{
  int type;
  char *name;
  double arg1;
  double arg2;
  double retval;
  int err;
};


extern int matherr  (struct exception *e)  ;



enum __fdlibm_version
{
  __fdlibm_ieee = -1,
  __fdlibm_svid,
  __fdlibm_xopen,
  __fdlibm_posix
};




extern enum __fdlibm_version  __fdlib_version ;











 


















 
















 





 


 



 




 



 









 





 

 



 

 






























typedef unsigned int size_t;


















 




 





 





 










 




















 

 


 


 






typedef long __va_greg;
typedef double __va_freg;

typedef struct {
  __va_greg * __va_next_o;		 
  __va_greg * __va_next_o_limit;	 
  __va_freg * __va_next_fp;		 
  __va_freg * __va_next_fp_limit;	 
  __va_greg * __va_next_stack;		 
} __gnuc_va_list;





 





 

 


















 







typedef _fpos_t fpos_t;

typedef struct __sFILE FILE;





	 











 














































 








int	 remove    (const char *)  ;
int	 rename    (const char *, const char *)  ;

FILE *	 tmpfile    (void)  ;
char *	 tmpnam    (char *)  ;
int	 fclose    (FILE *)  ;
int	 fflush    (FILE *)  ;
FILE *	 freopen    (const char *, const char *, FILE *)  ;
void	 setbuf    (FILE *, char *)  ;
int	 setvbuf    (FILE *, char *, int, size_t)  ;
int	 fprintf    (FILE *, const char *, ...)  ;
int	 fscanf    (FILE *, const char *, ...)  ;
int	 printf    (const char *, ...)  ;
int	 scanf    (const char *, ...)  ;
int	 sscanf    (const char *, const char *, ...)  ;
int	 vfprintf    (FILE *, const char *, __gnuc_va_list )  ;
int	 vprintf    (const char *, __gnuc_va_list )  ;
int	 vsprintf    (char *, const char *, __gnuc_va_list )  ;
int	 fgetc    (FILE *)  ;
char *   fgets    (char *, int, FILE *)  ;
int	 fputc    (int, FILE *)  ;
int	 fputs    (const char *, FILE *)  ;
int	 getc    (FILE *)  ;
int	 getchar    (void)  ;
char *   gets    (char *)  ;
int	 putc    (int, FILE *)  ;
int	 putchar    (int)  ;
int	 puts    (const char *)  ;
int	 ungetc    (int, FILE *)  ;
size_t	 fread    (void * , size_t _size, size_t _n, FILE *)  ;
size_t	 fwrite    (const void *  , size_t _size, size_t _n, FILE *)  ;
int	 fgetpos    (FILE *, fpos_t *)  ;
int	 fseek    (FILE *, long, int)  ;
int	 fsetpos    (FILE *, const fpos_t *)  ;
long	 ftell    ( FILE *)  ;
void	 rewind    (FILE *)  ;
void	 clearerr    (FILE *)  ;
int	 feof    (FILE *)  ;
int	 ferror    (FILE *)  ;
void     perror    (const char *)  ;

FILE *	 fopen    (const char *_name, const char *_type)  ;
int	 sprintf    (char *, const char *, ...)  ;


int	 vfiprintf    (FILE *, const char *, __gnuc_va_list )  ;
int	 iprintf    (const char *, ...)  ;
int	 fiprintf    (FILE *, const char *, ...)  ;
int	 siprintf    (char *, const char *, ...)  ;


 





FILE *	 fdopen    (int, const char *)  ;

int	 fileno    (FILE *)  ;
int	 getw    (FILE *)  ;
int	 pclose    (FILE *)  ;
FILE *   popen    (const char *, const char *)  ;
int	 putw    (int, FILE *)  ;
void     setbuffer    (FILE *, char *, int)  ;
int	 setlinebuf    (FILE *)  ;


 



FILE *	 _fdopen_r    (struct _reent *, int, const char *)  ;
FILE *	 _fopen_r    (struct _reent *, const char *, const char *)  ;
int	 _getchar_r    (struct _reent *)  ;
char *	 _gets_r    (struct _reent *, char *)  ;
int	 _iprintf_r    (struct _reent *, const char *, ...)  ;
int	 _mkstemp_r    (struct _reent *, char *)  ;
char *	 _mktemp_r    (struct _reent *, char *)  ;
void	 _perror_r    (struct _reent *, const char *)  ;
int	 _printf_r    (struct _reent *, const char *, ...)  ;
int	 _putchar_r    (struct _reent *, int)  ;
int	 _puts_r    (struct _reent *, const char *)  ;
int	 _remove_r    (struct _reent *, const char *)  ;
int	 _rename_r    (struct _reent *,
			   const char *_old, const char *_new)  ;
int	 _scanf_r    (struct _reent *, const char *, ...)  ;
int	 _sprintf_r    (struct _reent *, char *, const char *, ...)  ;
char *	 _tempnam_r    (struct _reent *, char *, char *)  ;
FILE *	 _tmpfile_r    (struct _reent *)  ;
char *	 _tmpnam_r    (struct _reent *, char *)  ;
int	 _vfprintf_r    (struct _reent *, FILE *, const char *, __gnuc_va_list )  ;
int	 _vprintf_r    (struct _reent *, const char *, __gnuc_va_list )  ;
int	 _vsprintf_r    (struct _reent *, char *, const char *, __gnuc_va_list )  ;

 



int	 __srget    (FILE *)  ;
int	 __swbuf    (int, FILE *)  ;

 




FILE	*  funopen   (const void *  _cookie,
		int (*readfn)(void *  _cookie, char *_buf, int _n),
		int (*writefn)(void *  _cookie, const char *_buf, int _n),
		fpos_t (*seekfn)(void *  _cookie, fpos_t _off, int _whence),
		int (*closefn)(void *  _cookie))  ;





 





 

























 









 















 





 


 



 




 



 









 





 

 



 

 







 




 





 





 











void *  	  memchr   (const void * , int, size_t)  ;
int 	  memcmp   (const void * , const void * , size_t)  ;
void *  	  memcpy   (void * , const void * , size_t)  ;
void * 	  memmove   (void * , const void * , size_t)  ;
void * 	  memset   (void * , int, size_t)  ;
char 	*  strcat   (char *, const char *)  ;
char 	*  strchr   (const char *, int)  ;
int	  strcmp   (const char *, const char *)  ;
int	  strcoll   (const char *, const char *)  ;
char 	*  strcpy   (char *, const char *)  ;
size_t	  strcspn   (const char *, const char *)  ;
char 	*  strerror   (int)  ;
size_t	  strlen   (const char *)  ;
char 	*  strncat   (char *, const char *, size_t)  ;
int	  strncmp   (const char *, const char *, size_t)  ;
char 	*  strncpy   (char *, const char *, size_t)  ;
char 	*  strpbrk   (const char *, const char *)  ;
char 	*  strrchr   (const char *, int)  ;
size_t	  strspn   (const char *, const char *)  ;
char 	*  strstr   (const char *, const char *)  ;
int      ffs   (int)  ;


char 	*  strtok   (char *, const char *)  ;


size_t	  strxfrm   (char *, const char *, size_t)  ;


char 	*  strtok_r   (char *, const char *, char **)  ;

int	  bcmp   (const char *, const char *, size_t)  ;
void	  bcopy   (const char *, char *, size_t)  ;
void	  bzero   (char *, size_t)  ;
int	  ffs   (int)  ;
char 	*  index   (const char *, int)  ;
void * 	  memccpy   (void * , const void * , int, size_t)  ;
char 	*  rindex   (const char *, int)  ;
int	  strcasecmp   (const char *, const char *)  ;
char 	*  strdup   (const char *)  ;
int	  strncasecmp   (const char *, const char *, size_t)  ;
char 	*  strsep   (char **, const char *)  ;
char	*  strlwr   (char *)  ;
char	*  strupr   (char *)  ;


 





















 



 



 




 





 



 







 





 



 








 



 











 




 








 







 























 





 









 















 





 


 



 




 



 









 





 

 



 

 







 




 



























 
















typedef short unsigned int wchar_t;


















 





 











typedef struct 
{
  int quot;  
  int rem;  
} div_t;

typedef struct 
{
  long quot;  
  long rem;  
} ldiv_t;










void 	 abort   (void ) __attribute__ ( (noreturn) )   ;
int	 abs   (int)  ;
int	 atexit   (void  (*_func)(void ))  ;
double	 atof   (const char *_nptr)  ;

float	 atoff   (const char *_nptr)  ;

int	 atoi   (const char *_nptr)  ;
long	 atol   (const char *_nptr)  ;
void * 	 bsearch   (const void *  _key,
		       const void *  _base,
		       size_t _nmemb,
		       size_t _size,
		       int  (*_compar)   (const void * , const void * )  )  ;
void * 	 calloc   (size_t _nmemb, size_t _size)  ;
div_t	 div   (int _numer, int _denom)  ;
void 	 exit   (int _status) __attribute__ ( (noreturn) )   ;
void 	 free   (void * )  ;
char *   getenv   (const char *_string)  ;
long	 labs   (long)  ;
ldiv_t	 ldiv   (long _numer, long _denom)  ;
void * 	 malloc   (size_t _size)  ;
int	 mblen   (const char *, size_t)  ;
int	 mbtowc   (wchar_t *, const char *, size_t)  ;
int	 wctomb   (char *, wchar_t)  ;
size_t	 mbstowcs   (wchar_t *, const char *, size_t)  ;
size_t	 wcstombs   (char *, const wchar_t *, size_t)  ;
void 	 qsort   (void *  _base, size_t _nmemb, size_t _size, int(*_compar)(const void * , const void * ))  ;
int	 rand   (void )  ;
void * 	 realloc   (void *  _r, size_t _size)  ;
void 	 srand   (unsigned _seed)  ;
double	 strtod   (const char *_n, char **_end_PTR)  ;

float	 strtodf   (const char *_n, char **_end_PTR)  ;

long	 strtol   (const char *_n, char **_end_PTR, int _base)  ;
unsigned long  strtoul   (const char *_n_PTR, char **_end_PTR, int _base)  ;
unsigned long  _strtoul_r   (struct _reent *,const char *_n_PTR, char **_end_PTR, int _base)  ;
int	 system   (const char *_string)  ;


void 	 cfree   (void * , void * )  ;
int	 putenv   (const char *_string)  ;
int	 setenv   (const char *_string, const char *_value, int _overwrite)  ;

char *	 gcvt   (double,int,char *)  ;
char *	 gcvtf   (float,int,char *)  ;
char *	 fcvt   (double,int,int *,int *)  ;
char *	 fcvtf   (float,int,int *,int *)  ;
char *	 ecvt   (double,int,int *,int *)  ;
char *	 ecvtbuf   (double, int, int*, int*, char *)  ;
char *	 fcvtbuf   (double, int, int*, int*, char *)  ;
char *	 ecvtf   (float,int,int *,int *)  ;
char *	 dtoa   (double, int, int, int *, int*, char**)  ;
int	 rand_r   (unsigned *_seed)  ;





char *	 _dtoa_r   (struct _reent *, double, int, int, int *, int*, char**)  ;
void * 	 _malloc_r   (struct _reent *, size_t)  ;
void * 	 _calloc_r   (struct _reent *, size_t, size_t)  ;
void 	 _free_r   (struct _reent *, void * )  ;
void * 	 _realloc_r   (struct _reent *, void * , size_t)  ;
void 	 _mstats_r   (struct _reent *, char *)  ;
int	 _system_r   (struct _reent *, const char *)  ;

void 	 __eprintf   (const char *, const char *, unsigned int, const char *)  ;













 























 





 

 




 


 



 




 



 









 





 

 



















typedef long int ptrdiff_t;









 




 

 







 




 













typedef unsigned int  wint_t;




 





 











 


















 
















typedef	unsigned char	u_char;
typedef	unsigned short	u_short;
typedef	unsigned int	u_int;
typedef	unsigned long	u_long;


typedef	unsigned short	ushort;		 
typedef	unsigned int	uint;		 



typedef long  time_t;



typedef	long	daddr_t;
typedef	char *	caddr_t;



typedef	unsigned short	ino_t;



 






typedef	short	dev_t;

typedef	long	off_t;

typedef	unsigned short	uid_t;
typedef	unsigned short	gid_t;
typedef int pid_t;
typedef	long key_t;
typedef long ssize_t;



typedef unsigned int mode_t __attribute__ ((__mode__ (__SI__))) ;



typedef unsigned short nlink_t;

 







 









typedef	long	fd_mask;





 

typedef	struct _types_fd_set {
	fd_mask	fds_bits[((( 64  )+((  (sizeof (fd_mask) * 8 )  )-1))/(  (sizeof (fd_mask) * 8 )  )) ];
} _types_fd_set;


















 





 


 



 




 



 









 





 

 




 




 

 







 




 











 





 











 








extern char **environ;

 

void	 _exit    (int _status ) __attribute__ ( (noreturn) )   ;


int	 access   (const char *_path, int _amode )  ;
unsigned   alarm    (unsigned _secs )  ;
int      chdir    (const char *_path )  ;
int      chmod    (const char *_path, mode_t _mode )  ;
int      chown    (const char *_path, uid_t _owner, gid_t _group )  ;
int      close    (int _fildes )  ;
char     *ctermid    (char *_s )  ;
char     *cuserid    (char *_s )  ;
int      dup    (int _fildes )  ;
int      dup2    (int _fildes, int _fildes2 )  ;
int      execl    (const char *_path, const char *, ... )  ;
int      execle    (const char *_path, const char *, ... )  ;
int      execlp    (const char *_file, const char *, ... )  ;
int      execv    (const char *_path, char * const _argv[] )  ;
int      execve    (const char *_path, char * const _argv[], char * const _envp[] )  ;
int      execvp    (const char *_file, char * const _argv[] )  ;
pid_t    fork    (void )  ;
long     fpathconf    (int _fd, int _name )  ;
int      fsync    (int _fd)  ;
char     *getcwd    (char *_buf, size_t _size )  ;
gid_t    getegid    (void )  ;
uid_t    geteuid    (void )  ;
gid_t    getgid    (void )  ;
int      getgroups    (int _gidsetsize, gid_t _grouplist[] )  ;
char     *getlogin    (void )  ;
size_t   getpagesize    (void)  ;
pid_t    getpgrp    (void )  ;
pid_t    getpid    (void )  ;
pid_t    getppid    (void )  ;
uid_t    getuid    (void )  ;
int      isatty    (int _fildes )  ;
int      link    (const char *_path1, const char *_path2 )  ;
off_t    lseek    (int _fildes, off_t _offset, int _whence )  ;
long     pathconf    (char *_path, int _name )  ;
int      pause    (void )  ;
int      pipe    (int _fildes[2] )  ;
int      read    (int _fildes, void *_buf, size_t _nbyte )  ;
int      rmdir    (const char *_path )  ;
void *   sbrk     (size_t incr)  ;
int      setgid    (gid_t _gid )  ;
int      setpgid    (pid_t _pid, pid_t _pgid )  ;
pid_t    setsid    (void )  ;
int      setuid    (uid_t _uid )  ;
unsigned  sleep    (unsigned int _seconds )  ;
void     swab    (const void *, void *, ssize_t)  ;
long     sysconf    (int _name )  ;
pid_t    tcgetpgrp    (int _fildes )  ;
int      tcsetpgrp    (int _fildes, pid_t _pgrp_id )  ;
char     *ttyname    (int _fildes )  ;
int      unlink    (const char *_path )  ;
int      write    (int _fildes, const void *_buf, size_t _nbyte )  ;




















long  sysconf    (int _name)  ;






 



















 












 








 











 







 




 














void UNIX_Timer_Start  (void)  ;
void UNIX_Timer_Stop   (void)  ;
int  UNIX_Timer_Count  (void)  ;



 





 









void UNIX_Abort_Start  (void)  ;
void UNIX_Abort_Handler  (int signum)  ;




 












 















 



















 




























 






 












 








































 




 









 













 




















 







 


















 







 












 


 












 





















 




















 














 















 













 













 

































 






























 








 














 









 




















 





 
















 





typedef struct Object_Struct OBJECT;
typedef struct Ray_Struct RAY;
typedef struct istack_struct ISTACK;
typedef struct istk_entry INTERSECTION;



 





typedef double  UV_VECT [2];
typedef double  VECTOR [3];
typedef double  MATRIX [4][4];
typedef double  EXPRESS [5];
typedef float  COLOUR [5];
typedef float  RGB [3];
typedef int TOKEN;
typedef int CONSTANT;
typedef short WORD;

 



typedef float   BBOX_VECT[3];









 

typedef float  SNGL_VECT[3];




 









 







 


















 





 








 

typedef struct Counter_Struct COUNTER;

struct Counter_Struct
{
  unsigned long high, low;
};












 





typedef struct Bounding_Box_Struct BBOX;

struct Bounding_Box_Struct
{
  BBOX_VECT Lower_Left, Lengths;
};



 





typedef struct Transform_Struct TRANSFORM;

struct Transform_Struct
{
  MATRIX matrix;
  MATRIX inverse;
};





 







typedef struct Blend_Map_Entry BLEND_MAP_ENTRY;
typedef struct Blend_Map_Struct BLEND_MAP;
typedef struct Pattern_Struct TPATTERN;
typedef struct Texture_Struct TEXTURE;
typedef struct Pigment_Struct PIGMENT;
typedef struct Tnormal_Struct TNORMAL;
typedef struct Finish_Struct FINISH;
typedef struct Turb_Struct TURB;
typedef struct Warps_Struct WARP;
typedef struct Halo_Struct HALO;

struct Blend_Map_Entry
{
  float  value;
  unsigned char Same;
  union
  {
   COLOUR Colour;
   PIGMENT *Pigment;
   TNORMAL *Tnormal;
   TEXTURE *Texture;
   UV_VECT Point_Slope;
  } Vals;
};

struct Blend_Map_Struct
{
  short Number_Of_Entries, Transparency_Flag, Type;
  long  Users;
  BLEND_MAP_ENTRY *Blend_Map_Entries;
};




 









typedef struct Image_Colour_Struct IMAGE_COLOUR;

typedef struct Image_Line_Struct IMAGE_LINE;

struct Image_Colour_Struct
{
  unsigned short Red, Green, Blue, Filter, Transmit;
};

struct Image_Line_Struct
{
  unsigned char *red, *green, *blue, *transm;
};



 





 



















 






typedef struct Image_Struct IMAGE;

struct Image_Struct
{
  int References;  
  int Map_Type;
  int File_Type;
  int Image_Type;  
  int Interpolation_Type;
  short Once_Flag;
  short Use_Colour_Flag;
  VECTOR Gradient;
  float  width, height;
  int iwidth, iheight;
  short Colour_Map_Size;
  IMAGE_COLOUR *Colour_Map;
  union
  {
    IMAGE_LINE *rgb_lines;
    unsigned char **map_lines;
  } data;
};









 








struct Pattern_Struct
{
  unsigned short Type, Wave_Type, Flags; int References; float  Frequency, Phase; WARP *Warps; TPATTERN *Next; BLEND_MAP *Blend_Map; union { IMAGE *Image; VECTOR Gradient; float  Agate_Turb_Scale; short Num_of_Waves; short Iterations; short Arms; struct {float  Mortar; VECTOR Size;} Brick; struct {float  Control0, Control1; } Quilted; } Vals; 
};

struct Pigment_Struct
{
  unsigned short Type, Wave_Type, Flags; int References; float  Frequency, Phase; WARP *Warps; TPATTERN *Next; BLEND_MAP *Blend_Map; union { IMAGE *Image; VECTOR Gradient; float  Agate_Turb_Scale; short Num_of_Waves; short Iterations; short Arms; struct {float  Mortar; VECTOR Size;} Brick; struct {float  Control0, Control1; } Quilted; } Vals; 
  COLOUR Colour; 
};

struct Tnormal_Struct
{
  unsigned short Type, Wave_Type, Flags; int References; float  Frequency, Phase; WARP *Warps; TPATTERN *Next; BLEND_MAP *Blend_Map; union { IMAGE *Image; VECTOR Gradient; float  Agate_Turb_Scale; short Num_of_Waves; short Iterations; short Arms; struct {float  Mortar; VECTOR Size;} Brick; struct {float  Control0, Control1; } Quilted; } Vals; 
  float  Amount;
};



struct Texture_Struct
{
  unsigned short Type, Wave_Type, Flags; int References; float  Frequency, Phase; WARP *Warps; TPATTERN *Next; BLEND_MAP *Blend_Map; union { IMAGE *Image; VECTOR Gradient; float  Agate_Turb_Scale; short Num_of_Waves; short Iterations; short Arms; struct {float  Mortar; VECTOR Size;} Brick; struct {float  Control0, Control1; } Quilted; } Vals;  TEXTURE *Next_Material; 
  PIGMENT *Pigment;
  TNORMAL *Tnormal;
  FINISH *Finish;
  HALO *Halo;                                    
  TEXTURE *Materials;
  int Num_Of_Mats;

};

struct Finish_Struct
{
  float  Diffuse, Brilliance, Index_Of_Refraction;
  float  Refraction, Specular, Roughness, Phong, Phong_Size;
  float  Irid, Irid_Film_Thickness, Irid_Turb;
  float  Crand, Metallic, Caustics;
  float  Fade_Distance, Fade_Power;
  RGB Ambient, Reflection;
};

struct Halo_Struct
{
  char Type, Flags;
  char Dust_Type;
  char Mapping_Type;           
  char Rendering_Type;         
  TURB *Turb;                  
  BLEND_MAP *Blend_Map;        
  TRANSFORM *Trans;            
  TRANSFORM *Container_Trans;  
  double  Max_Value, Exponent;     
  double  Eccentricity;            
  double  Samples;                 
  double  Jitter;                  
  int AA_Level;                
  double  AA_Threshold;            
  HALO *Next_Halo;             
  double  Frequency, Phase;
};



struct Warps_Struct
{
  unsigned short Warp_Type; WARP *Next_Warp; 
};

struct Turb_Struct
{
  unsigned short Warp_Type; WARP *Next_Warp; 
  VECTOR Turbulence;
  int Octaves;
  float  Lambda, Omega;
};






 
















typedef struct Method_Struct METHODS;

typedef int (*ALL_INTERSECTIONS_METHOD) (OBJECT *, RAY *, ISTACK *)  ;
typedef int (*INSIDE_METHOD) (VECTOR , OBJECT *)  ;
typedef void (*NORMAL_METHOD) (VECTOR, OBJECT *, INTERSECTION *)  ;
typedef void *(*COPY_METHOD) (OBJECT *)  ;
typedef void (*TRANSLATE_METHOD) (OBJECT *, VECTOR, TRANSFORM *)  ;
typedef void (*ROTATE_METHOD) (OBJECT *, VECTOR, TRANSFORM *)  ;
typedef void (*SCALE_METHOD) (OBJECT *, VECTOR, TRANSFORM *)  ;
typedef void (*TRANSFORM_METHOD) (OBJECT *, TRANSFORM *)  ;
typedef void (*INVERT_METHOD) (OBJECT *)  ;
typedef void (*DESTROY_METHOD) (OBJECT *)  ;

 



 





struct Method_Struct
{
  ALL_INTERSECTIONS_METHOD All_Intersections_Method;
  INSIDE_METHOD Inside_Method;
  NORMAL_METHOD Normal_Method;
  COPY_METHOD Copy_Method;
  TRANSLATE_METHOD Translate_Method;
  ROTATE_METHOD Rotate_Method;
  SCALE_METHOD Scale_Method;
  TRANSFORM_METHOD Transform_Method;
  INVERT_METHOD Invert_Method;
  DESTROY_METHOD Destroy_Method;
};

 


struct Object_Struct
{
  METHODS *Methods; int Type; OBJECT *Sibling; TEXTURE *Texture; OBJECT *Bound; OBJECT *Clip; BBOX BBox; unsigned short Flags; 
};



 





struct istk_entry
{
   double  Depth;
   VECTOR IPoint;
   VECTOR INormal;
   OBJECT *Object;
 





   int i1, i2;
   double  d1, d2;
  
   void *Pointer;
};

struct istack_struct
{
   struct istack_struct *next;
   struct istk_entry *istack;
   unsigned int top_entry;
};



 





 


















 







struct Ray_Struct
{
  VECTOR Initial;
  VECTOR Direction;
  int Containing_Index;
  TEXTURE *Containing_Textures[100 ];
  OBJECT  *Containing_Objects[100 ];
  double  Containing_IORs[100 ];
};


 




typedef enum
{
  FT_SINGLE_FRAME,
  FT_MULTIPLE_FRAME
} FRAMETYPE;




typedef struct
{
  FRAMETYPE FrameType;
  double  Clock_Value;       
  int FrameNumber;       

  int InitialFrame;
  double  InitialClock;

  int FinalFrame;
  int FrameNumWidth;
  double  FinalClock;

  int SubsetStartFrame;
  double  SubsetStartPercent;
  int SubsetEndFrame;
  double  SubsetEndPercent;
  
  unsigned Field_Render_Flag;
  unsigned Odd_Field_Flag;
} FRAMESEQ;


 





typedef struct Chunk_Header_Struct CHUNK_HEADER;
typedef struct Data_File_Struct DATA_FILE;
typedef struct complex_block complex;
typedef struct file_handle_struct FILE_HANDLE;

struct Reserved_Word_Struct
{
  TOKEN Token_Number;
  char *Token_Name;
};

 

struct Token_Struct
{
  TOKEN Token_Id;
  TOKEN Function_Id;
  int Token_Line_No;
  char *Token_String;
  double  Token_Float;
  TOKEN Begin_Id;
  int Constant_Index;
  int Unget_Token, End_Of_File;
  char *Filename, *Constant_Data;
};

struct Constant_Struct
{
  int Identifier_Number;
  CONSTANT Constant_Type;
  char *Constant_Data;
};

struct Chunk_Header_Struct
{
  long name;
  long size;
};

struct Data_File_Struct
{
  FILE *File;
  char *Filename;
  int Line_Number;
};

struct complex_block
{
  double  r, c;
};





struct file_handle_struct
{
  char *filename;
  int mode;
  int width, height;
  int buffer_size;
  char *buffer;
  FILE *file;
  int file_type;   
  int  (*Open_File_p)  (struct file_handle_struct *handle,
    char *name, int *width, int *height, int buffer_size, int mode)  ;
  void (*Write_Line_p)  (struct file_handle_struct *handle,
    COLOUR *line_data, int line_number)  ;
  int (*Read_Line_p)  (struct file_handle_struct *handle,
    COLOUR *line_data, int *line_number)  ;
  void (*Read_Image_p)  (IMAGE *Image, char *filename)  ;
  void (*Close_File_p)  (struct file_handle_struct *handle)  ;
};











 


























 


















 





 


 



 




 



 









 





 

 




 




 

 







 




 











 





 











 








 



typedef unsigned long  clock_t;





struct tm
{
  int	tm_sec;
  int	tm_min;
  int	tm_hour;
  int	tm_mday;
  int	tm_mon;
  int	tm_year;
  int	tm_wday;
  int	tm_yday;
  int	tm_isdst;
};

clock_t	    clock       (void)  ;
double	    difftime    (time_t _time2, time_t _time1)  ;
time_t	    mktime      (struct tm *_timeptr)  ;
time_t	    time        (time_t *_timer)  ;

char	  *  asctime     (const struct tm *_tblock)  ;
char	  *  ctime       (const time_t *_time)  ;
struct tm *  gmtime      (const time_t *_timer)  ;
struct tm *  localtime   (const time_t *_timer)  ;

size_t	    strftime    (char *_s, size_t _maxsize, const char *_fmt, const struct tm *_t)  ;

char	  *  asctime_r   	(const struct tm *, char *)  ;
char	  *  ctime_r   	(const time_t *, char *)  ;
struct tm *  gmtime_r   	(const time_t *, struct tm *)  ;
struct tm *  localtime_r   	(const time_t *, struct tm *)  ;







 


























 






















 






 



 










 



typedef struct Repeat_Warp REPEAT;
typedef struct Trans_Warp TRANS;
typedef struct Spiral_Warp SPIRAL;
typedef struct Black_Hole_Warp BLACK_HOLE;

struct Repeat_Warp
{
  unsigned short Warp_Type; WARP *Next_Warp; 
  int Axis;
  float  Width;
  VECTOR Flip, Offset;
};

struct Trans_Warp
{
  unsigned short Warp_Type; WARP *Next_Warp; 
  TRANSFORM Trans;
};

struct Spiral_Warp
{
  unsigned short Warp_Type; WARP *Next_Warp; 
  VECTOR Center;
  float  Strength, Phase;
};

struct Black_Hole_Warp

{

  unsigned short Warp_Type; WARP *Next_Warp; 

  VECTOR      Center ;

  VECTOR      Repeat_Vector ;

  VECTOR      Uncertainty_Vector ;

  double          Strength ;

  double          Radius ;

  double          Radius_Squared ;

  double          Inverse_Radius ;

  double          Power ;

  short       Inverted ;

  short       Type ;

  short       Repeat ;

  short       Uncertain ;

} ;






 




 




 



void Warp_EPoint  (VECTOR TPoint, VECTOR EPoint, TPATTERN *TPat)  ;
WARP *Create_Warp  (int Warp_Type)  ;
void Destroy_Warps  (WARP *Warps)  ;
WARP *Copy_Warps  (WARP *Old)  ;




 



 





 









 



typedef struct Atmosphere_Struct ATMOSPHERE;
typedef struct Fog_Struct FOG;
typedef struct Rainbow_Struct RAINBOW;
typedef struct Skysphere_Struct SKYSPHERE;

 

struct Atmosphere_Struct
{
  int Type;                
  int Samples;             
  double  Distance;            
  double  Distance_Threshold;  
  double  Scattering;          
  double  Eccentricity;        
  COLOUR Colour;           
  int AA_Level;            
  double  AA_Threshold;        
  double  Jitter;              
};



struct Fog_Struct
{
  int Type;
  double  Distance;
  double  Alt;
  double  Offset;
  COLOUR Colour;
  VECTOR Up;
  TURB *Turb;
  float  Turb_Depth;
  FOG *Next;
};



 

struct Rainbow_Struct
{
  double  Distance;
  double  Jitter;
  double  Angle, Width;
  double  Arc_Angle, Falloff_Angle, Falloff_Width;
  VECTOR Antisolar_Vector;
  VECTOR Up_Vector, Right_Vector;
  PIGMENT *Pigment;
  RAINBOW *Next;
};



 

struct Skysphere_Struct
{
  int Count;            
  PIGMENT **Pigments;   
  TRANSFORM *Trans;     
};



 





 



void Initialize_Atmosphere_Code  (void)  ;
void Deinitialize_Atmosphere_Code  (void)  ;

void Do_Infinite_Atmosphere  (RAY *Ray, COLOUR Colour)  ;
void Do_Finite_Atmosphere  (RAY *Ray, INTERSECTION *Intersection, COLOUR Colour, int Light_Source_Flag)  ;

ATMOSPHERE *Create_Atmosphere  (void)  ;
void *Copy_Atmosphere  (ATMOSPHERE *Atmosphere)  ;
void Destroy_Atmosphere  (ATMOSPHERE *Atmosphere)  ;

FOG *Create_Fog  (void)  ;
void *Copy_Fog  (FOG *Fog)  ;
void Destroy_Fog  (FOG *Fog)  ;

RAINBOW *Create_Rainbow  (void)  ;
void *Copy_Rainbow  (RAINBOW *Rainbow)  ;
void Destroy_Rainbow  (RAINBOW *Rainbow)  ;

SKYSPHERE *Create_Skysphere  (void)  ;
void *Copy_Skysphere  (SKYSPHERE *Skysphere)  ;
void Destroy_Skysphere  (SKYSPHERE *Skysphere)  ;
void Scale_Skysphere  (SKYSPHERE *Skysphere, VECTOR Vector)  ;
void Rotate_Skysphere  (SKYSPHERE *Skysphere, VECTOR Vector)  ;
void Translate_Skysphere  (SKYSPHERE *Skysphere, VECTOR Vector)  ;
void Transform_Skysphere  (SKYSPHERE *Skysphere, TRANSFORM *Trans)  ;





 




























 






 


















 



typedef struct Camera_Struct CAMERA;

struct Camera_Struct
{
  VECTOR Location;
  VECTOR Direction;
  VECTOR Up;
  VECTOR Right;
  VECTOR Sky;
  VECTOR Look_At;                 
  double  Focal_Distance, Aperture;   
  int Blur_Samples;               
  double  Confidence;                 
  double  Variance;                   
  int Type;                       
  double  Angle;                      
  TNORMAL *Tnormal;               
};



 






 



void Translate_Camera  (CAMERA *Cm, VECTOR Vector)  ;
void Rotate_Camera  (CAMERA *Cm, VECTOR Vector)  ;
void Scale_Camera  (CAMERA *Cm, VECTOR Vector)  ;
void Transform_Camera  (CAMERA *Cm, TRANSFORM *Trans)  ;
CAMERA *Copy_Camera  (CAMERA *Old)  ;
CAMERA *Create_Camera  (void)  ;
void Destroy_Camera  (CAMERA *Cm)  ;




 


























 


























 






















 






 



 




 



typedef int VECTORI[3];
typedef struct BBox_Tree_Struct BBOX_TREE;
typedef struct Rayinfo_Struct RAYINFO;
typedef struct Qelem_Struct QELEM;
typedef struct Priority_Queue_Struct PRIORITY_QUEUE;

struct BBox_Tree_Struct
{
  short Infinite;    
  short Entries;     
  BBOX BBox;         
  BBOX_TREE **Node;  
};

struct Rayinfo_Struct
{
  VECTOR slab_num;
  VECTOR slab_den;
  VECTORI nonzero;
  VECTORI positive;
};

struct Qelem_Struct
{
  double  Depth;
  BBOX_TREE *Node;
};

struct Priority_Queue_Struct
{
  unsigned QSize;
  unsigned Max_QSize;
  QELEM *Queue;
};



 



extern BBOX_TREE *Root_Object;



 



void Initialize_BBox_Code  (void)  ;
void Deinitialize_BBox_Code  (void)  ;
void Build_Bounding_Slabs  (BBOX_TREE **Root)  ;
void Destroy_Bounding_Slabs  (void)  ;
void Recompute_BBox  (BBOX *bbox, TRANSFORM *trans)  ;
void Recompute_Inverse_BBox  (BBOX *bbox, TRANSFORM *trans)  ;
int  Intersect_BBox_Tree  (BBOX_TREE *Root, RAY *ray, INTERSECTION *Best_Intersection, OBJECT **Best_Object)  ;
void Check_And_Enqueue  (PRIORITY_QUEUE *Queue, BBOX_TREE *Node, BBOX *BBox, RAYINFO *rayinfo)  ;
void Priority_Queue_Delete  (PRIORITY_QUEUE *Queue, double  *key, BBOX_TREE **Node)  ;
void Build_BBox_Tree  (BBOX_TREE **Root, long nFinites, BBOX_TREE **Finite, long nInfinite, BBOX_TREE **Infinite)  ;
void Destroy_BBox_Tree  (BBOX_TREE *Node)  ;
void Create_Rayinfo  (RAY *Ray, RAYINFO *rayinfo)  ;

PRIORITY_QUEUE *Create_Priority_Queue  (unsigned QSize)  ;
void Destroy_Priority_Queue  (PRIORITY_QUEUE *Queue)  ;








 



 






 






 





 










 



typedef struct Project_Struct PROJECT;

typedef struct Project_Tree_Node_Struct PROJECT_TREE_NODE;
typedef struct Project_Tree_Leaf_Struct PROJECT_TREE_LEAF;
typedef struct Project_Queue_Struct PROJECT_QUEUE;

struct Project_Struct
{
  int x1, y1, x2, y2;
};

 






struct Project_Tree_Node_Struct
{
  unsigned short is_leaf;
  BBOX_TREE *Node;
  PROJECT Project;
  unsigned short Entries;
  PROJECT_TREE_NODE **Entry;
};

struct Project_Tree_Leaf_Struct
{
  unsigned short is_leaf;
  BBOX_TREE *Node;
  PROJECT Project;
};

struct Project_Queue_Struct
{
  unsigned QSize;
  unsigned Max_QSize;
  PROJECT_TREE_NODE **Queue;
};




 



extern PROJECT_QUEUE *Node_Queue;
extern PRIORITY_QUEUE *VLBuffer_Queue;



 



void Clip_Polygon  (VECTOR *Points, int *PointCnt, VECTOR VX1, VECTOR VX2,
  VECTOR VY1, VECTOR VY2, double  DX1, double  DX2, double  DY1, double  DY2)  ;

void Initialize_VLBuffer_Code  (void)  ;
void Reinitialize_VLBuffer_Code  (void)  ;
void Deinitialize_VLBuffer_Code  (void)  ;

void Destroy_Project_Tree  (PROJECT_TREE_NODE *Node)  ;








 







 








 



typedef struct Light_Source_Struct LIGHT_SOURCE;

struct Light_Source_Struct
{
  METHODS *Methods; int Type; OBJECT *Sibling; TEXTURE *Texture; OBJECT *Bound; OBJECT *Clip; BBOX BBox; unsigned short Flags;  OBJECT *Children; 
  COLOUR Colour;
  VECTOR Direction, Center, Points_At, Axis1, Axis2;
  double  Coeff, Radius, Falloff;
  double  Fade_Distance, Fade_Power;
  LIGHT_SOURCE *Next_Light_Source;
  unsigned char Light_Type, Area_Light, Jitter, Track;
  int Area_Size1, Area_Size2;
  int Adaptive_Level;
  int Atmospheric_Attenuation;
  int Atmosphere_Interaction;
  COLOUR **Light_Grid;
  OBJECT *Shadow_Cached_Object;

   

  PROJECT_TREE_NODE *Light_Buffer[6];
};




 






 



LIGHT_SOURCE *Create_Light_Source  (void)  ;
double  Attenuate_Light  (LIGHT_SOURCE *Light_Source, RAY *Light_Source_Ray, double  Distance)  ;
COLOUR **Create_Light_Grid  (int Size1, int Size2)  ;





 




























 






 



typedef enum
{
  CSV,
  SYS,
  PPM,
  TARGA,
  PNG,
  NONE
} Histogram_Types ;

 



extern int Trace_Level, Max_Trace_Level, Highest_Trace_Level;

extern double  ADC_Bailout;

extern unsigned long              *histogram_grid ;
extern unsigned long              max_histogram_value ;
extern FILE_HANDLE                *Histogram_File_Handle ;

 



void Read_Rendered_Part  (char *New_Fname)  ;
void Start_Tracing_Mosaic_Smooth  (int StartPixelSize, int EndPixelSize)  ;
void Start_Tracing_Mosaic_Preview  (int StartPixelSize, int EndPixelSize)  ;
void Start_Adaptive_Tracing  (void)  ;
void Start_Non_Adaptive_Tracing  (void)  ;
void Initialize_Renderer  (void)  ;
void Terminate_Renderer  (void)  ;
double   Trace  (RAY *Ray, COLOUR Colour, double  Weight)  ;
void Check_User_Abort  (int Do_Stats)  ;
void write_histogram  (char *filename)   ;
void destroy_histogram  (void)   ;





 







































































 



typedef struct Frame_Struct FRAME;

struct Frame_Struct
{
  CAMERA *Camera;
  int Screen_Height, Screen_Width;  
  int Number_Of_Light_Sources;
  LIGHT_SOURCE *Light_Sources;
  OBJECT *Objects;
  double  Atmosphere_IOR, Antialias_Threshold;
  COLOUR Background_Colour;
  COLOUR Ambient_Light;
  COLOUR Irid_Wavelengths;
  ATMOSPHERE *Atmosphere;
  FOG *Fog;
  RAINBOW *Rainbow;
  SKYSPHERE *Skysphere;
};

typedef enum STATS
{
   
  Number_Of_Pixels = 0,
  Number_Of_Pixels_Supersampled,
  Number_Of_Samples,
  Number_Of_Rays,
  Calls_To_DNoise,
  Calls_To_Noise,
  ADC_Saves,

   
  Bounding_Region_Tests,
  Bounding_Region_Tests_Succeeded,
  Clipping_Region_Tests,
  Clipping_Region_Tests_Succeeded,
  Istack_overflows,

  Ray_Bicubic_Tests,
  Ray_Bicubic_Tests_Succeeded,
  Ray_Blob_Tests,
  Ray_Blob_Tests_Succeeded,
  Blob_Element_Tests,
  Blob_Element_Tests_Succeeded,
  Blob_Bound_Tests,
  Blob_Bound_Tests_Succeeded,
  Ray_Box_Tests,
  Ray_Box_Tests_Succeeded,
  Ray_Cone_Tests,
  Ray_Cone_Tests_Succeeded,
  Ray_Disc_Tests,
  Ray_Disc_Tests_Succeeded,
  Ray_HField_Tests,
  Ray_HField_Tests_Succeeded,
  Ray_HField_Box_Tests,
  Ray_HField_Box_Tests_Succeeded,
  Ray_HField_Triangle_Tests,
  Ray_HField_Triangle_Tests_Succeeded,
  Ray_HField_Block_Tests,
  Ray_HField_Block_Tests_Succeeded,
  Ray_HField_Cell_Tests,
  Ray_HField_Cell_Tests_Succeeded,
  Ray_Fractal_Tests,
  Ray_Fractal_Tests_Succeeded,
  Ray_Lathe_Tests,
  Ray_Lathe_Tests_Succeeded,
  Lathe_Bound_Tests,
  Lathe_Bound_Tests_Succeeded,
  Ray_Mesh_Tests,
  Ray_Mesh_Tests_Succeeded,
  Ray_Plane_Tests,
  Ray_Plane_Tests_Succeeded,
  Ray_Poly_Tests,
  Ray_Poly_Tests_Succeeded,
  Ray_Polygon_Tests,
  Ray_Polygon_Tests_Succeeded,
  Ray_Prism_Tests,
  Ray_Prism_Tests_Succeeded,
  Prism_Bound_Tests,
  Prism_Bound_Tests_Succeeded,
  Ray_Quadric_Tests,
  Ray_Quadric_Tests_Succeeded,
  Ray_Sor_Tests,
  Ray_Sor_Tests_Succeeded,
  Sor_Bound_Tests,
  Sor_Bound_Tests_Succeeded,
  Ray_Sphere_Tests,
  Ray_Sphere_Tests_Succeeded,
  Ray_Torus_Tests,
  Ray_Torus_Tests_Succeeded,
  Torus_Bound_Tests,
  Torus_Bound_Tests_Succeeded,
  Ray_CSG_Intersection_Tests,
  Ray_CSG_Intersection_Tests_Succeeded,
  Ray_CSG_Merge_Tests,
  Ray_CSG_Merge_Tests_Succeeded,
  Ray_CSG_Union_Tests,
  Ray_CSG_Union_Tests_Succeeded,
  Ray_Triangle_Tests,
  Ray_Triangle_Tests_Succeeded,
  Ray_TTF_Tests,
  Ray_TTF_Tests_Succeeded,
  Ray_Superellipsoid_Tests,
  Ray_Superellipsoid_Tests_Succeeded,
  Atmosphere_Samples,
  Atmosphere_Supersamples,

  Reflected_Rays_Traced,
  Refracted_Rays_Traced,
  Transmitted_Rays_Traced,
  Shadow_Cache_Hits,
  Shadow_Rays_Succeeded,
  Shadow_Ray_Tests,

  nChecked,
  nEnqueued,
  totalQueues,
  totalQueueResets,
  totalQueueResizes,
  Polynomials_Tested,
  Roots_Eliminated,
  VBuffer_Tests,
  VBuffer_Tests_Succeeded,
  LBuffer_Tests,
  LBuffer_Tests_Succeeded,

  Halo_Samples,
  Halo_Supersamples,
  Halo_Rays_Traced,


  MemStat_Smallest_Alloc,
  MemStat_Largest_Alloc,
  MemStat_Largest_Mem_Usage,



   
  MaxStat

} Stats;


typedef enum shelltype
 {
   PRE_SCENE_SHL = 0,
   PRE_FRAME_SHL,
   POST_FRAME_SHL,
   POST_SCENE_SHL,
   USER_ABORT_SHL,
   FATAL_SHL,
   MAX_SHL  
 } SHELLTYPE;

typedef enum shellret
{
  IGNORE_RET = 0,
  QUIT_RET,
  USER_RET,
  FATAL_RET,
  SKIP_ONCE_RET,
  ALL_SKIP_RET
} SHELLRET;

typedef struct shelldata
 {
   SHELLRET Ret;
   int Inverse;
   char Command[250 ];
 } SHELLDATA;

typedef struct OPTIONS_STRUCT
{
  int File_Buffer_Size;
  unsigned long Options;
  char DisplayFormat;
  char PaletteOption;

  char OutputFormat;
  int OutputQuality;
  char Input_File_Name[150 ];
  char Output_File_Name[150 ];
  char Output_Path[150 ];
  char Output_Numbered_Name[150 ];
  char Scene_Name[150 ];
  double  DisplayGamma;
  double  GammaFactor;

  unsigned long Quality_Flags;

  long AntialiasDepth;
  double  Antialias_Threshold;

  double  JitterScale;

  int Abort_Test_Counter;

  char *Library_Paths[25 ];
  int Library_Path_Index;

  int First_Column, Last_Column;
  double  First_Column_Percent, Last_Column_Percent;

  int First_Line, Last_Line;
  double  First_Line_Percent, Last_Line_Percent;

   
  double  Language_Version;

  unsigned Use_Slabs;
  long BBox_Threshold;

  int Quality;

  int PreviewGridSize_Start;    
  int PreviewGridSize_End;      

  FRAMESEQ FrameSeq;

   

  double  Radiosity_Brightness;
  long Radiosity_Count;
  double  Radiosity_Dist_Max;
  double  Radiosity_Error_Bound;
  double  Radiosity_Gray;   
  double  Radiosity_Low_Error_Factor;
  double  Radiosity_Min_Reuse;
  long Radiosity_Nearest_Count;
  int Radiosity_Recursion_Limit;
  long Radiosity_Quality;   
  int Radiosity_File_ReadOnContinue;
  int Radiosity_File_SaveWhileRendering;
  int Radiosity_File_AlwaysReadAtStart;
  int Radiosity_File_KeepOnAbort;
  int Radiosity_File_KeepAlways;
  int Radiosity_Preview_Done;   


  int histogram_x, histogram_y, histogram_on;
  Histogram_Types histogram_type;
  char Histogram_File_Name[150 ];

  SHELLDATA *Shellouts;

  char Ini_Output_File_Name[150 ];

  int Tracing_Method;
  int Do_Stats;
} Opts;

 


extern FRAME Frame;

extern COUNTER stats[MaxStat];
extern COUNTER totalstats[MaxStat];

extern time_t tstart, tstop;
extern double  tparse, trender, tparse_total, trender_total;

extern char Color_Bits;

extern int Number_Of_Files;
extern Opts opts;

extern FILE *stat_file;
extern FILE_HANDLE *Output_File_Handle;


extern int Help_Available;

extern int Abort_Test_Every;
extern int Display_Started;
extern int Stage;
extern volatile int Stop_Flag;
extern int pre_init_flag;
extern int Experimental_Flag;

extern int Num_Echo_Lines, Echo_Line_Length;
extern char *Option_String_Ptr;      

 





  void  main  (int argc, char ** argv)  ;



int pov_stricmp  (char *s1,char *s2)  ;
void close_all  (void)  ;
void POV_Std_Split_Time  (double  time_dif,unsigned long *hrs,unsigned long *mins,double  *secs)  ;
FILE *Locate_File  (char *filename, char *mode, char *ext1, char *ext2, int err_flag)  ;

SHELLRET pov_shellout  (SHELLTYPE Type)  ;
void pre_init_povray  (void)  ;

void POV_Split_Path  (char *s, char *p, char *f)  ;



 




























 

extern double  VTemp;

 



 



 



 



 


 



 



 



 


 


 


 



 



 


 




 








 








 








 











 











 






 







 
 



 






 



























 





 





 





 



 
void display_finished  (void)  ;
void display_init  (int width, int height)  ;
void display_close  (void)  ;
void display_plot  (int x, int y, unsigned char Red, unsigned char Green, unsigned char Blue, unsigned char Alpha)  ;
void display_plot_rect  (int x1, int x2, int y1, int y2,
  unsigned char Red, unsigned char Green, unsigned char Blue, unsigned char Alpha)  ;

 
 




























 





 





 





 



void mem_init  (void)  ;
void mem_mark  (void)  ;
void mem_release  (int LogFile)  ;
void mem_release_all  (int LogFile)  ;
void *pov_malloc  (size_t size, char *file, int line, char *msg)  ;
void *pov_calloc  (size_t nitems, size_t size, char *file, int line, char *msg)  ;
void *pov_realloc  (void *ptr, size_t size, char *file, int line, char *msg)  ;
void pov_free  (void *ptr, char *file, int line)  ;


 
size_t mem_stats_current_mem_usage  (void)  ;
size_t mem_stats_largest_mem_usage  (void)  ;
size_t mem_stats_smallest_alloc  (void)  ;
size_t mem_stats_largest_alloc  (void)  ;
 



void *pov_memmove  (void *dest, void *src, size_t length)  ;




 

int   Banner  (char *format,...)  ;
int   Warning  (double  level, char *format,...)  ;
int   Render_Info  (char *format,...)  ;
int   Status_Info  (char *format,...)  ;
int   Statistics  (char *format,...)  ;
int   Error_Line  (char *format,...)  ;
int   Error  (char *format,...)  ;
int   Debug_Info  (char *format, ...)  ;

void Terminate_POV  (int i)  ;




 






















 






 



 

















































 


















 





 



extern unsigned int Number_of_istacks;
extern unsigned int Max_Intersections;
extern ISTACK *free_istack;



 



int Intersection  (INTERSECTION *Ray_Intersection, OBJECT *Object, RAY *Ray)  ;
int Ray_In_Bound  (RAY *Ray, OBJECT *Bounding_Object)  ;
int Point_In_Clip  (VECTOR IPoint, OBJECT *Clip)  ;
OBJECT *Copy_Object  (OBJECT *Old)  ;
void Translate_Object  (OBJECT *Object, VECTOR Vector, TRANSFORM *Trans)  ;
void Rotate_Object  (OBJECT *Object, VECTOR Vector, TRANSFORM *Trans)  ;
void Scale_Object  (OBJECT *Object, VECTOR Vector, TRANSFORM *Trans)  ;
void Transform_Object  (OBJECT *Object, TRANSFORM *Trans)  ;
int Inside_Object  (VECTOR IPoint, OBJECT *Vector)  ;
void Invert_Object  (OBJECT *Object)  ;
void Destroy_Object  (OBJECT *Object)  ;
ISTACK *open_istack  (void)  ;
void close_istack  (ISTACK *istk)  ;
void incstack  (ISTACK *istk)  ;
void Destroy_IStacks  (void)  ;





 




























 






 






 






 



void MZero  (MATRIX result)  ;
void MIdentity  (MATRIX result)  ;
void MTimes  (MATRIX result, MATRIX matrix1, MATRIX matrix2)  ;
void MAdd  (MATRIX result, MATRIX matrix1, MATRIX matrix2)  ;
void MSub  (MATRIX result, MATRIX matrix1, MATRIX matrix2)  ;
void MScale  (MATRIX result, MATRIX matrix1, double  amount)  ;
void MTranspose  (MATRIX result, MATRIX matrix1)  ;
void MTransPoint  (VECTOR result, VECTOR vector, TRANSFORM *trans)  ;
void MInvTransPoint  (VECTOR result, VECTOR vector, TRANSFORM *trans)  ;
void MTransDirection  (VECTOR result, VECTOR vector, TRANSFORM *trans)  ;
void MInvTransDirection  (VECTOR result, VECTOR vector, TRANSFORM *trans)  ;
void MTransNormal  (VECTOR result, VECTOR vector, TRANSFORM *trans)  ;
void MInvTransNormal  (VECTOR result, VECTOR vector, TRANSFORM *trans)  ;
void Compute_Matrix_Transform  (TRANSFORM *result, MATRIX matrix)  ;
void Compute_Scaling_Transform  (TRANSFORM *result, VECTOR vector)  ;
void Compute_Inversion_Transform  (TRANSFORM *result)  ;
void Compute_Translation_Transform  (TRANSFORM *transform, VECTOR vector)  ;
void Compute_Rotation_Transform  (TRANSFORM *transform, VECTOR vector)  ;
void Compute_Look_At_Transform  (TRANSFORM *transform, VECTOR Look_At, VECTOR Up, VECTOR Right)  ;
void Compose_Transforms  (TRANSFORM *Original_Transform, TRANSFORM *New_Transform)  ;
void Compute_Axis_Rotation_Transform  (TRANSFORM *transform, VECTOR V1, double  angle)  ;
void Compute_Coordinate_Transform  (TRANSFORM *trans, VECTOR origin, VECTOR up, double  r, double  len)  ;
TRANSFORM *Create_Transform  (void)  ;
TRANSFORM *Copy_Transform  (TRANSFORM *Old)  ;
VECTOR *Create_Vector  (void)  ;
double  *Create_Float  (void)  ;
void MInvers  (MATRIX r, MATRIX m)  ;





 




























 







 



typedef struct Plane_Struct PLANE;

struct Plane_Struct
{
  METHODS *Methods; int Type; OBJECT *Sibling; TEXTURE *Texture; OBJECT *Bound; OBJECT *Clip; BBOX BBox; unsigned short Flags; 
  VECTOR Normal_Vector;
  double     Distance;
  TRANSFORM *Trans;
};


 



extern METHODS Plane_Methods;



 



PLANE *Create_Plane  (void)  ;
void  Compute_Plane_BBox  (PLANE *Plane)  ;





 






























 







 



typedef struct Quadric_Struct QUADRIC;

struct Quadric_Struct
{
  METHODS *Methods; int Type; OBJECT *Sibling; TEXTURE *Texture; OBJECT *Bound; OBJECT *Clip; BBOX BBox; unsigned short Flags; 
  VECTOR Square_Terms;
  VECTOR Mixed_Terms;
  VECTOR Terms;
  double  Constant;
};



 



extern METHODS Quadric_Methods;



 



QUADRIC *Create_Quadric  (void)  ;
void Compute_Quadric_BBox  (QUADRIC *Quadric, VECTOR Min, VECTOR Max)  ;
void Compute_Plane_Min_Max  (PLANE *Plane, VECTOR Min, VECTOR Max)  ;








 



 

























 



static int Intersect_Quadric  (RAY *Ray, QUADRIC *Quadric, double  *Depth1, double  *Depth2)  ;
static void Quadric_To_Matrix  (QUADRIC *Quadric, MATRIX Matrix)  ;
static void Matrix_To_Quadric  (MATRIX Matrix, QUADRIC *Quadric)  ;
static int All_Quadric_Intersections  (OBJECT *Object, RAY *Ray, ISTACK *Depth_Stack)  ;
static int Inside_Quadric  (VECTOR IPoint, OBJECT *Object)  ;
static void Quadric_Normal  (VECTOR Result, OBJECT *Object, INTERSECTION *Inter)  ;
static void *Copy_Quadric  (OBJECT *Object)  ;
static void Translate_Quadric  (OBJECT *Object, VECTOR Vector, TRANSFORM *Trans)  ;
static void Rotate_Quadric  (OBJECT *Object, VECTOR Vector, TRANSFORM *Trans)  ;
static void Scale_Quadric  (OBJECT *Object, VECTOR Vector, TRANSFORM *Trans)  ;
static void Transform_Quadric  (OBJECT *Object, TRANSFORM *Trans)  ;
static void Invert_Quadric  (OBJECT *Object)  ;
static void Destroy_Quadric  (OBJECT *Object)  ;

 



METHODS Quadric_Methods =
{
  All_Quadric_Intersections,
  Inside_Quadric, Quadric_Normal,
  Copy_Quadric,
  Translate_Quadric, Rotate_Quadric,
  Scale_Quadric, Transform_Quadric, Invert_Quadric,
  Destroy_Quadric
};




 

























static int All_Quadric_Intersections(Object, Ray, Depth_Stack)
OBJECT *Object;
RAY *Ray;
ISTACK *Depth_Stack;
{
  double  Depth1, Depth2;
  VECTOR IPoint;
  register int Intersection_Found;

  Intersection_Found = 0 ;

  if (Intersect_Quadric(Ray, (QUADRIC *)Object, &Depth1, &Depth2))
  {
    if ((Depth1 > 0.001 ) && (Depth1 < 1.0e7 ))
    {
      { ( IPoint )[0 ] = (  Ray->Initial )[0 ] + (  Depth1 ) * (  Ray->Direction )[0 ]; ( IPoint )[1 ] = (  Ray->Initial )[1 ] + (  Depth1 ) * (  Ray->Direction )[1 ]; ( IPoint )[2 ] = (  Ray->Initial )[2 ] + (  Depth1 ) * (  Ray->Direction )[2 ]; } ;

      if (Point_In_Clip(IPoint, Object->Clip))
      {
        (   Depth_Stack  ->istack[   Depth_Stack  ->top_entry]) .Depth  =  Depth1 ; (   Depth_Stack  ->istack[   Depth_Stack  ->top_entry]) .Object =   Object ; memcpy(( (   Depth_Stack  ->istack[   Depth_Stack  ->top_entry]) .IPoint ),(   IPoint  ),sizeof(VECTOR)) ; incstack(  Depth_Stack ); ;

        Intersection_Found = 1 ;
      }
    }

    if ((Depth2 > 0.001 ) && (Depth2 < 1.0e7 ))
    {
      { ( IPoint )[0 ] = (  Ray->Initial )[0 ] + (  Depth2 ) * (  Ray->Direction )[0 ]; ( IPoint )[1 ] = (  Ray->Initial )[1 ] + (  Depth2 ) * (  Ray->Direction )[1 ]; ( IPoint )[2 ] = (  Ray->Initial )[2 ] + (  Depth2 ) * (  Ray->Direction )[2 ]; } ;

      if (Point_In_Clip(IPoint, Object->Clip))
      {
        (   Depth_Stack  ->istack[   Depth_Stack  ->top_entry]) .Depth  =  Depth2 ; (   Depth_Stack  ->istack[   Depth_Stack  ->top_entry]) .Object =   Object ; memcpy(( (   Depth_Stack  ->istack[   Depth_Stack  ->top_entry]) .IPoint ),(   IPoint  ),sizeof(VECTOR)) ; incstack(  Depth_Stack ); ;

        Intersection_Found = 1 ;
      }
    }
  }

  return(Intersection_Found);
}



 

























static int Intersect_Quadric(Ray, Quadric, Depth1, Depth2)
RAY *Ray;
QUADRIC *Quadric;
double  *Depth1, *Depth2;
{
  register double  a, b, c, d;

  { if ((++( stats[Ray_Quadric_Tests] ).low) == 0L) { ( stats[Ray_Quadric_Tests] ).high++; } } ;

  a = Ray->Direction[0 ]  * (Quadric->Square_Terms[0 ]  * Ray->Direction[0 ]  + Quadric->Mixed_Terms[0 ]  * Ray->Direction[1 ]  + Quadric->Mixed_Terms[1 ]  * Ray->Direction[2 ] ) +
                Ray->Direction[1 ]  * (Quadric->Square_Terms[1 ]  * Ray->Direction[1 ]  + Quadric->Mixed_Terms[2 ]  * Ray->Direction[2 ] ) +
                Quadric->Square_Terms[2 ]  * Ray->Direction[2 ]  * Ray->Direction[2 ] ;

  b = Ray->Direction[0 ]  * (Quadric->Square_Terms[0 ]  * Ray->Initial[0 ]  + 0.5 * (Quadric->Mixed_Terms[0 ]  * Ray->Initial[1 ]  + Quadric->Mixed_Terms[1 ]  * Ray->Initial[2 ]  + Quadric->Terms[0 ] )) +
                Ray->Direction[1 ]  * (Quadric->Square_Terms[1 ]  * Ray->Initial[1 ]  + 0.5 * (Quadric->Mixed_Terms[0 ]  * Ray->Initial[0 ]  + Quadric->Mixed_Terms[2 ]  * Ray->Initial[2 ]  + Quadric->Terms[1 ] )) +
                Ray->Direction[2 ]  * (Quadric->Square_Terms[2 ]  * Ray->Initial[2 ]  + 0.5 * (Quadric->Mixed_Terms[1 ]  * Ray->Initial[0 ]  + Quadric->Mixed_Terms[2 ]  * Ray->Initial[1 ]  + Quadric->Terms[2 ] ));

  c = Ray->Initial[0 ]  * (Quadric->Square_Terms[0 ]  * Ray->Initial[0 ]  + Quadric->Mixed_Terms[0 ]  * Ray->Initial[1 ]  + Quadric->Mixed_Terms[1 ]  * Ray->Initial[2 ]  + Quadric->Terms[0 ] ) +
                  Ray->Initial[1 ]  * (Quadric->Square_Terms[1 ]  * Ray->Initial[1 ]  + Quadric->Mixed_Terms[2 ]  * Ray->Initial[2 ]  + Quadric->Terms[1 ] ) +
      Ray->Initial[2 ]  * (Quadric->Square_Terms[2 ]  * Ray->Initial[2 ]  + Quadric->Terms[2 ] ) +
      Quadric->Constant ;

  if (a != 0.0)
  {
     

    d = (( b )*( b ))  - a * c;

    if (d <= 0.0)
    {
      return(0 );
    }

    d = sqrt (d);

    *Depth1 = (-b + d) / (a);
    *Depth2 = (-b - d) / (a);
  }
  else
  {
     

    if (b == 0.0)
    {
      return(0 );
    }

    *Depth1 = - 0.5 * c / b;
    *Depth2 = 1.0e7 ;
  }

  { if ((++( stats[Ray_Quadric_Tests_Succeeded] ).low) == 0L) { ( stats[Ray_Quadric_Tests_Succeeded] ).high++; } } ;

  return(1 );
}



 

























static int Inside_Quadric(IPoint, Object)
VECTOR IPoint;
OBJECT *Object;
{
  QUADRIC *Quadric = (QUADRIC *)Object;

   

  return((IPoint[0 ] * (Quadric->Square_Terms[0 ]  * IPoint[0 ] + Quadric->Mixed_Terms[0 ]  * IPoint[1 ] + Quadric->Terms[0 ] ) +
          IPoint[1 ] * (Quadric->Square_Terms[1 ]  * IPoint[1 ] + Quadric->Mixed_Terms[2 ]  * IPoint[2 ] + Quadric->Terms[1 ] ) +
          IPoint[2 ] * (Quadric->Square_Terms[2 ]  * IPoint[2 ] + Quadric->Mixed_Terms[1 ]  * IPoint[0 ] + Quadric->Terms[2 ] ) + Quadric->Constant ) <= 0.0);
}



 

























static void Quadric_Normal(Result, Object, Inter)
OBJECT *Object;
VECTOR Result;
INTERSECTION *Inter;
{
  QUADRIC *Quadric = (QUADRIC *) Object;
  double  Len;

   

  Result[0 ] = 2.0 * Quadric->Square_Terms[0 ]  * Inter->IPoint[0 ] +
                    Quadric->Mixed_Terms[0 ]  * Inter->IPoint[1 ] +
                    Quadric->Mixed_Terms[1 ]  * Inter->IPoint[2 ] +
                    Quadric->Terms[0 ] ;

  Result[1 ] =       Quadric->Mixed_Terms[0 ]  * Inter->IPoint[0 ] +
              2.0 * Quadric->Square_Terms[1 ]  * Inter->IPoint[1 ] +
                    Quadric->Mixed_Terms[2 ]  * Inter->IPoint[2 ] +
                    Quadric->Terms[1 ] ;

  Result[2 ] =       Quadric->Mixed_Terms[1 ]  * Inter->IPoint[0 ] +
                    Quadric->Mixed_Terms[2 ]  * Inter->IPoint[1 ] +
              2.0 * Quadric->Square_Terms[2 ]  * Inter->IPoint[2 ] +
                    Quadric->Terms[2 ] ;

  { Len =sqrt((  Result )[0 ]*(  Result )[0 ]+(  Result )[1 ]*(  Result )[1 ]+(  Result )[2 ]*(  Result )[2 ]);} ;

  if (Len == 0.0)
  {
     
     

    { ( Result )[0 ]=(  1.0 );( Result )[1 ]=(  0.0 );( Result )[2 ]=(  0.0 ); } ;
  }
  else
  {
    {( Result )[0 ]/=(  Len );( Result )[1 ]/=(  Len );( Result )[2 ]/=(  Len );} ;
  }
}



 

























static void Transform_Quadric(Object, Trans)
OBJECT *Object;
TRANSFORM *Trans;
{
  QUADRIC *Quadric=(QUADRIC *)Object;
  MATRIX Quadric_Matrix, Transform_Transposed;

  Quadric_To_Matrix (Quadric, Quadric_Matrix);

  MTimes (Quadric_Matrix, Trans->inverse, Quadric_Matrix);
  MTranspose (Transform_Transposed, Trans->inverse);
  MTimes (Quadric_Matrix, Quadric_Matrix, Transform_Transposed);

  Matrix_To_Quadric (Quadric_Matrix, Quadric);

  Recompute_BBox(&Object->BBox, Trans);
}



 

























static void Quadric_To_Matrix(Quadric, Matrix)
QUADRIC *Quadric;
MATRIX Matrix;
{
  MZero (Matrix);

  Matrix[0][0] = Quadric->Square_Terms[0 ];
  Matrix[1][1] = Quadric->Square_Terms[1 ];
  Matrix[2][2] = Quadric->Square_Terms[2 ];
  Matrix[0][1] = Quadric->Mixed_Terms[0 ];
  Matrix[0][2] = Quadric->Mixed_Terms[1 ];
  Matrix[0][3] = Quadric->Terms[0 ];
  Matrix[1][2] = Quadric->Mixed_Terms[2 ];
  Matrix[1][3] = Quadric->Terms[1 ];
  Matrix[2][3] = Quadric->Terms[2 ];
  Matrix[3][3] = Quadric->Constant;
}



 

























static void Matrix_To_Quadric(Matrix, Quadric)
MATRIX Matrix;
QUADRIC *Quadric;
{
  Quadric->Square_Terms[0 ] = Matrix[0][0];
  Quadric->Square_Terms[1 ] = Matrix[1][1];
  Quadric->Square_Terms[2 ] = Matrix[2][2];

  Quadric->Mixed_Terms[0 ] = Matrix[0][1] + Matrix[1][0];
  Quadric->Mixed_Terms[1 ] = Matrix[0][2] + Matrix[2][0];
  Quadric->Mixed_Terms[2 ] = Matrix[1][2] + Matrix[2][1];

  Quadric->Terms[0 ] = Matrix[0][3] + Matrix[3][0];
  Quadric->Terms[1 ] = Matrix[1][3] + Matrix[3][1];
  Quadric->Terms[2 ] = Matrix[2][3] + Matrix[3][2];

  Quadric->Constant = Matrix[3][3];
}



 

























static void Translate_Quadric(Object, Vector, Trans)
OBJECT *Object;
VECTOR Vector;
TRANSFORM *Trans;
{
  Transform_Quadric (Object, Trans);
}



 

























static void Rotate_Quadric(Object, Vector, Trans)
OBJECT *Object;
VECTOR Vector;
TRANSFORM *Trans;
{
  Transform_Quadric (Object, Trans);
}



 

























static void Scale_Quadric(Object, Vector, Trans)
OBJECT *Object;
VECTOR Vector;
TRANSFORM *Trans;
{
  Transform_Quadric (Object, Trans);
}



 

























static void Invert_Quadric(Object)
OBJECT *Object;
{
  QUADRIC *Quadric = (QUADRIC *) Object;

  {( Quadric->Square_Terms )[0 ]*=(  -1.0 );( Quadric->Square_Terms )[1 ]*=(  -1.0 );( Quadric->Square_Terms )[2 ]*=(  -1.0 );} ;
  {( Quadric->Mixed_Terms )[0 ]*=(  -1.0 );( Quadric->Mixed_Terms )[1 ]*=(  -1.0 );( Quadric->Mixed_Terms )[2 ]*=(  -1.0 );} ;
  {( Quadric->Terms )[0 ]*=(  -1.0 );( Quadric->Terms )[1 ]*=(  -1.0 );( Quadric->Terms )[2 ]*=(  -1.0 );} ;

  Quadric->Constant *= -1.0;

  { ( Object )->Flags ^=  (  0x0004  ); } ;
}



 

























QUADRIC *Create_Quadric()
{
  QUADRIC *New;

  New = (QUADRIC *)pov_malloc (( sizeof (QUADRIC) ), "../quadrics.c", 682, (  "quadric" )) ;

   New ->Type    =   (0 )  ;  New ->Methods =   &Quadric_Methods ;  New ->Sibling = ((void *)0) ;  New ->Texture = ((void *)0) ;  New ->Bound   = ((void *)0) ;  New ->Clip    = ((void *)0) ;  New ->Flags   = 0; { (  New ->BBox ).Lower_Left[0 ] = (float  )(  - 2.0e10 /2.0 ); (  New ->BBox ).Lower_Left[1 ] = (float  )(  - 2.0e10 /2.0 ); (  New ->BBox ).Lower_Left[2 ] = (float  )(  - 2.0e10 /2.0 ); (  New ->BBox ).Lengths[0 ] = (float  )(  2.0e10  ); (  New ->BBox ).Lengths[1 ] = (float  )(  2.0e10  ); (  New ->BBox ).Lengths[2 ] = (float  )(  2.0e10  ); } ; 

  { ( New->Square_Terms )[0 ]=(  1.0 );( New->Square_Terms )[1 ]=(  1.0 );( New->Square_Terms )[2 ]=(  1.0 ); } ;
  { ( New->Mixed_Terms )[0 ]=(  0.0 );( New->Mixed_Terms )[1 ]=(  0.0 );( New->Mixed_Terms )[2 ]=(  0.0 ); } ;
  { ( New->Terms )[0 ]=(  0.0 );( New->Terms )[1 ]=(  0.0 );( New->Terms )[2 ]=(  0.0 ); } ;
  New->Constant = 1.0;

  return(New);
}



 

























static void *Copy_Quadric(Object)
OBJECT *Object;
{
  QUADRIC *New;

  New = Create_Quadric();

  *New = *((QUADRIC *)Object);

  return(New);
}



 

























static void Destroy_Quadric(Object)
OBJECT *Object;
{
  pov_free ((void *)( Object ), "../quadrics.c", 765) ;
}



 







































void Compute_Quadric_BBox(Quadric, ClipMin, ClipMax)
QUADRIC *Quadric;
VECTOR ClipMin, ClipMax;
{
  double  A, B, C, D, E, F, G, H, I, J;
  double  a, b, c, d;
  double  rx, ry, rz, rx1, rx2, ry1, ry2, rz1, rz2, x, y, z;
  double  New_Volume, Old_Volume;
  VECTOR Min, Max, TmpMin, TmpMax, NewMin, NewMax, T1;
  BBOX Old;
  OBJECT *Sib;

   






   

  A = Quadric->Square_Terms[0 ];
  E = Quadric->Square_Terms[1 ];
  H = Quadric->Square_Terms[2 ];
  B = Quadric->Mixed_Terms[0 ] / 2.0;
  C = Quadric->Mixed_Terms[1 ] / 2.0;
  F = Quadric->Mixed_Terms[2 ] / 2.0;
  D = Quadric->Terms[0 ] / 2.0;
  G = Quadric->Terms[1 ] / 2.0;
  I = Quadric->Terms[2 ] / 2.0;
  J = Quadric->Constant;

   

  if ((( A ) < 0.0 ? -( A ) : ( A ))  < 1.0e-10 ) A = 0.0;
  if ((( B ) < 0.0 ? -( B ) : ( B ))  < 1.0e-10 ) B = 0.0;
  if ((( C ) < 0.0 ? -( C ) : ( C ))  < 1.0e-10 ) C = 0.0;
  if ((( D ) < 0.0 ? -( D ) : ( D ))  < 1.0e-10 ) D = 0.0;
  if ((( E ) < 0.0 ? -( E ) : ( E ))  < 1.0e-10 ) E = 0.0;
  if ((( F ) < 0.0 ? -( F ) : ( F ))  < 1.0e-10 ) F = 0.0;
  if ((( G ) < 0.0 ? -( G ) : ( G ))  < 1.0e-10 ) G = 0.0;
  if ((( H ) < 0.0 ? -( H ) : ( H ))  < 1.0e-10 ) H = 0.0;
  if ((( I ) < 0.0 ? -( I ) : ( I ))  < 1.0e-10 ) I = 0.0;
  if ((( J ) < 0.0 ? -( J ) : ( J ))  < 1.0e-10 ) J = 0.0;

   

  if ((B != 0.0) || (C != 0.0) || (F != 0.0))
  {
    return;
  }

   

  if ((D != 0.0) || (G != 0.0) || (I != 0.0))
  {
    if (A != 0.0)
    {
      T1[0 ] = -D / A;
    }
    else
    {
      if (D != 0.0)
      {
       T1[0 ] = J / (2.0 * D);
      }
      else
      {
        T1[0 ] = 0.0;
      }
    }

    if (E != 0.0)
    {
      T1[1 ] = -G / E;
    }
    else
    {
      if (G != 0.0)
      {
        T1[1 ] = J / (2.0 * G);
      }
      else
      {
        T1[1 ] = 0.0;
      }
    }

    if (H != 0.0)
    {
      T1[2 ] = -I / H;
    }
    else
    {
      if (I != 0.0)
      {
        T1[2 ] = J / (2.0 * I);
      }
      else
      {
        T1[2 ] = 0.0;
      }
    }

     

    D += A * T1[0 ];
    G += E * T1[1 ];
    I += H * T1[2 ];
    J -= T1[0 ]*(A*T1[0 ] + 2.0*D) + T1[1 ]*(E*T1[1 ] + 2.0*G) + T1[2 ]*(H*T1[2 ] + 2.0*I);
  }
  else
  {
    { ( T1 )[0 ]=(  0.0 );( T1 )[1 ]=(  0.0 );( T1 )[2 ]=(  0.0 ); } ;
  }

   

  Old = Quadric->BBox;

   

  NewMin[0 ] = NewMin[1 ] = NewMin[2 ] = - 2.0e10 /2;
  NewMax[0 ] = NewMax[1 ] = NewMax[2 ] =  2.0e10 /2;

   

  if (Quadric->Clip != ((void *)0) )
  {
    Min[0 ] = Min[1 ] = Min[2 ] = - 2.0e10 ;
    Max[0 ] = Max[1 ] = Max[2 ] =  2.0e10 ;

     

    for (Sib = Quadric->Clip; Sib != ((void *)0) ; Sib = Sib->Sibling)
    {
      if (! (( Sib )->Flags & (  0x0004  )) )
      {
        if (Sib->Methods == &Plane_Methods)
        {
          Compute_Plane_Min_Max((PLANE *)Sib, TmpMin, TmpMax);
        }
        else
        {
          { ( TmpMin )[0 ] = (  Sib->BBox ).Lower_Left[0 ]; ( TmpMin )[1 ] = (  Sib->BBox ).Lower_Left[1 ]; ( TmpMin )[2 ] = (  Sib->BBox ).Lower_Left[2 ]; (  TmpMax )[0 ] = ( TmpMin )[0 ] + (  Sib->BBox ).Lengths[0 ]; (  TmpMax )[1 ] = ( TmpMin )[1 ] + (  Sib->BBox ).Lengths[1 ]; (  TmpMax )[2 ] = ( TmpMin )[2 ] + (  Sib->BBox ).Lengths[2 ]; } ;
        }

        Min[0 ] = ((( Min[0 ] )<(  TmpMin[0 ] ))?(  TmpMin[0 ] ):( Min[0 ] )) ;
        Min[1 ] = ((( Min[1 ] )<(  TmpMin[1 ] ))?(  TmpMin[1 ] ):( Min[1 ] )) ;
        Min[2 ] = ((( Min[2 ] )<(  TmpMin[2 ] ))?(  TmpMin[2 ] ):( Min[2 ] )) ;
        Max[0 ] = ((( Max[0 ] )>(  TmpMax[0 ] ))?(  TmpMax[0 ] ):( Max[0 ] )) ;
        Max[1 ] = ((( Max[1 ] )>(  TmpMax[1 ] ))?(  TmpMax[1 ] ):( Max[1 ] )) ;
        Max[2 ] = ((( Max[2 ] )>(  TmpMax[2 ] ))?(  TmpMax[2 ] ):( Max[2 ] )) ;
      }
    }

    memcpy(( ClipMin ),(  Min ),sizeof(VECTOR)) ;
    memcpy(( ClipMax ),(  Max ),sizeof(VECTOR)) ;
  }

   

  {( ClipMin )[0 ]-=(  T1 )[0 ];( ClipMin )[1 ]-=(  T1 )[1 ];( ClipMin )[2 ]-=(  T1 )[2 ];} ;
  {( ClipMax )[0 ]-=(  T1 )[0 ];( ClipMax )[1 ]-=(  T1 )[1 ];( ClipMax )[2 ]-=(  T1 )[2 ];} ;

   

  if (A < 0.0)
  {
    A = -A;
    D = -D;
    E = -E;
    G = -G;
    H = -H;
    I = -I;
    J = -J;
  }

   









  if ((A > 0.0) && (E > 0.0) && (H > 0.0) && (J < 0.0))
  {
    a = sqrt(-J/A);
    b = sqrt(-J/E);
    c = sqrt(-J/H);

    NewMin[0 ] = -a;
    NewMin[1 ] = -b;
    NewMin[2 ] = -c;
    NewMax[0 ] = a;
    NewMax[1 ] = b;
    NewMax[2 ] = c;
  }

   









  if ((A == 0.0) && (E > 0.0) && (H > 0.0) && (J < 0.0))
  {
    b = sqrt(-J/E);
    c = sqrt(-J/H);

    NewMin[1 ] = -b;
    NewMin[2 ] = -c;
    NewMax[1 ] = b;
    NewMax[2 ] = c;
  }

   









  if ((A > 0.0) && (E == 0.0) && (H > 0.0) && (J < 0.0))
  {
    a = sqrt(-J/A);
    c = sqrt(-J/H);

    NewMin[0 ] = -a;
    NewMin[2 ] = -c;
    NewMax[0 ] = a;
    NewMax[2 ] = c;
  }

   









  if ((A > 0.0) && (E > 0.0) && (H == 0.0) && (J < 0.0))
  {
    a = sqrt(-J/A);
    b = sqrt(-J/E);

    NewMin[0 ] = -a;
    NewMin[1 ] = -b;
    NewMax[0 ] = a;
    NewMax[1 ] = b;
  }

   









  if ((A > 0.0) && (E < 0.0) && (H < 0.0) && (J == 0.0))
  {
    a = sqrt(1.0/A);
    b = sqrt(-1.0/E);
    c = sqrt(-1.0/H);

     

    x = ClipMin[0 ];

    ry1 = (( x * b / a ) < 0.0 ? -( x * b / a ) : ( x * b / a )) ;
    rz1 = (( x * c / a ) < 0.0 ? -( x * c / a ) : ( x * c / a )) ;

     

    x = ClipMax[0 ];

    ry2 = (( x * b / a ) < 0.0 ? -( x * b / a ) : ( x * b / a )) ;
    rz2 = (( x * c / a ) < 0.0 ? -( x * c / a ) : ( x * c / a )) ;

    ry = ((( ry1 )<(  ry2 ))?(  ry2 ):( ry1 )) ;
    rz = ((( rz1 )<(  rz2 ))?(  rz2 ):( rz1 )) ;

    NewMin[1 ] = -ry;
    NewMin[2 ] = -rz;
    NewMax[1 ] = ry;
    NewMax[2 ] = rz;
  }

   









  if ((A > 0.0) && (E < 0.0) && (H > 0.0) && (J == 0.0))
  {
    a = sqrt(1.0/A);
    b = sqrt(-1.0/E);
    c = sqrt(1.0/H);

     

    y = ClipMin[1 ];

    rx1 = (( y * a / b ) < 0.0 ? -( y * a / b ) : ( y * a / b )) ;
    rz1 = (( y * c / b ) < 0.0 ? -( y * c / b ) : ( y * c / b )) ;

     

    y = ClipMax[1 ];

    rx2 = (( y * a / b ) < 0.0 ? -( y * a / b ) : ( y * a / b )) ;
    rz2 = (( y * c / b ) < 0.0 ? -( y * c / b ) : ( y * c / b )) ;

    rx = ((( rx1 )<(  rx2 ))?(  rx2 ):( rx1 )) ;
    rz = ((( rz1 )<(  rz2 ))?(  rz2 ):( rz1 )) ;

    NewMin[0 ] = -rx;
    NewMin[2 ] = -rz;
    NewMax[0 ] = rx;
    NewMax[2 ] = rz;
  }

   









  if ((A > 0.0) && (E > 0.0) && (H < 0.0) && (J == 0.0))
  {
    a = sqrt(1.0/A);
    b = sqrt(1.0/E);
    c = sqrt(-1.0/H);

     

    z = ClipMin[2 ];

    rx1 = (( z * a / c ) < 0.0 ? -( z * a / c ) : ( z * a / c )) ;
    ry1 = (( z * b / c ) < 0.0 ? -( z * b / c ) : ( z * b / c )) ;

     

    z = ClipMax[2 ];

    rx2 = (( z * a / c ) < 0.0 ? -( z * a / c ) : ( z * a / c )) ;
    ry2 = (( z * b / c ) < 0.0 ? -( z * b / c ) : ( z * b / c )) ;

    rx = ((( rx1 )<(  rx2 ))?(  rx2 ):( rx1 )) ;
    ry = ((( ry1 )<(  ry2 ))?(  ry2 ):( ry1 )) ;

    NewMin[0 ] = -rx;
    NewMin[1 ] = -ry;
    NewMax[0 ] = rx;
    NewMax[1 ] = ry;
  }

  if ((A > 0.0) && (E < 0.0) && (H < 0.0) && (J > 0.0))
  {
     

    x = ClipMin[0 ];

    d = 1.0 + A * (( x )*( x )) ;

    ry1 = sqrt(-d / E);
    rz1 = sqrt(-d / H);

     

    x = ClipMax[0 ];

    d = 1.0 + A * (( x )*( x )) ;

    ry2 = sqrt(-d / E);
    rz2 = sqrt(-d / H);

    ry = ((( ry1 )<(  ry2 ))?(  ry2 ):( ry1 )) ;
    rz = ((( rz1 )<(  rz2 ))?(  rz2 ):( rz1 )) ;

    NewMin[1 ] = -ry;
    NewMin[2 ] = -rz;
    NewMax[1 ] = ry;
    NewMax[2 ] = rz;
  }

   









  if ((A > 0.0) && (E < 0.0) && (H > 0.0) && (J < 0.0))
  {
     

    y = ClipMin[1 ];

    d = 1.0 - E * (( y )*( y )) ;

    rx1 = sqrt(d / A);
    rz1 = sqrt(d / H);

     

    y = ClipMax[1 ];

    d = 1.0 - E * (( y )*( y )) ;

    rx2 = sqrt(d / A);
    rz2 = sqrt(d / H);

    rx = ((( rx1 )<(  rx2 ))?(  rx2 ):( rx1 )) ;
    rz = ((( rz1 )<(  rz2 ))?(  rz2 ):( rz1 )) ;

    NewMin[0 ] = -rx;
    NewMin[2 ] = -rz;
    NewMax[0 ] = rx;
    NewMax[2 ] = rz;
  }

   









  if ((A > 0.0) && (E > 0.0) && (H < 0.0) && (J < 0.0))
  {
     

    z = ClipMin[2 ];

    d = 1.0 - H * (( z )*( z )) ;

    rx1 = sqrt(d / A);
    ry1 = sqrt(d / E);

     

    z = ClipMax[2 ];

    d = 1.0 - H * (( z )*( z )) ;

    rx2 = sqrt(d / A);
    ry2 = sqrt(d / E);

    rx = ((( rx1 )<(  rx2 ))?(  rx2 ):( rx1 )) ;
    ry = ((( ry1 )<(  ry2 ))?(  ry2 ):( ry1 )) ;

    NewMin[0 ] = -rx;
    NewMin[1 ] = -ry;
    NewMax[0 ] = rx;
    NewMax[1 ] = ry;
  }

   









  if ((A == 0.0) && (D != 0.0) && (E != 0.0) && (H != 0.0) && (J == 0.0))
  {
     

    x = ClipMin[0 ];

    ry1 = sqrt((( 2.0 * D * x / E ) < 0.0 ? -( 2.0 * D * x / E ) : ( 2.0 * D * x / E )) );
    rz1 = sqrt((( 2.0 * D * x / H ) < 0.0 ? -( 2.0 * D * x / H ) : ( 2.0 * D * x / H )) );

     

    x = ClipMax[0 ];

    ry2 = sqrt((( 2.0 * D * x / E ) < 0.0 ? -( 2.0 * D * x / E ) : ( 2.0 * D * x / E )) );
    rz2 = sqrt((( 2.0 * D * x / H ) < 0.0 ? -( 2.0 * D * x / H ) : ( 2.0 * D * x / H )) );

    ry = ((( ry1 )<(  ry2 ))?(  ry2 ):( ry1 )) ;
    rz = ((( rz1 )<(  rz2 ))?(  rz2 ):( rz1 )) ;

    NewMin[1 ] = -ry;
    NewMin[2 ] = -rz;
    NewMax[1 ] = ry;
    NewMax[2 ] = rz;
  }

  if ((E == 0.0) && (G != 0.0) && (A != 0.0) && (H != 0.0) && (J == 0.0))
  {
     

    y = ClipMin[1 ];

    rx1 = sqrt((( 2.0 * G * y / A ) < 0.0 ? -( 2.0 * G * y / A ) : ( 2.0 * G * y / A )) );
    rz1 = sqrt((( 2.0 * G * y / H ) < 0.0 ? -( 2.0 * G * y / H ) : ( 2.0 * G * y / H )) );

     

    y = ClipMax[1 ];

    rx2 = sqrt((( 2.0 * G * y / A ) < 0.0 ? -( 2.0 * G * y / A ) : ( 2.0 * G * y / A )) );
    rz2 = sqrt((( 2.0 * G * y / H ) < 0.0 ? -( 2.0 * G * y / H ) : ( 2.0 * G * y / H )) );

    rx = ((( rx1 )<(  rx2 ))?(  rx2 ):( rx1 )) ;
    rz = ((( rz1 )<(  rz2 ))?(  rz2 ):( rz1 )) ;

    NewMin[0 ] = -rx;
    NewMin[2 ] = -rz;
    NewMax[0 ] = rx;
    NewMax[2 ] = rz;
  }

   

  if ((H == 0.0) && (I != 0.0) && (A != 0.0) && (E != 0.0) && (J == 0.0))
  {
     

    z = ClipMin[2 ];

    rx1 = sqrt((( 2.0 * I * z / A ) < 0.0 ? -( 2.0 * I * z / A ) : ( 2.0 * I * z / A )) );
    ry1 = sqrt((( 2.0 * I * z / E ) < 0.0 ? -( 2.0 * I * z / E ) : ( 2.0 * I * z / E )) );

     

    z = ClipMax[2 ];

    rx2 = sqrt((( 2.0 * I * z / A ) < 0.0 ? -( 2.0 * I * z / A ) : ( 2.0 * I * z / A )) );
    ry2 = sqrt((( 2.0 * I * z / E ) < 0.0 ? -( 2.0 * I * z / E ) : ( 2.0 * I * z / E )) );

    rx = ((( rx1 )<(  rx2 ))?(  rx2 ):( rx1 )) ;
    ry = ((( ry1 )<(  ry2 ))?(  ry2 ):( ry1 )) ;

    NewMin[0 ] = -rx;
    NewMin[1 ] = -ry;
    NewMax[0 ] = rx;
    NewMax[1 ] = ry;
  }

   

  NewMin[0 ] = ((( NewMin[0 ] )<(  ClipMin[0 ] ))?(  ClipMin[0 ] ):( NewMin[0 ] )) ;
  NewMin[1 ] = ((( NewMin[1 ] )<(  ClipMin[1 ] ))?(  ClipMin[1 ] ):( NewMin[1 ] )) ;
  NewMin[2 ] = ((( NewMin[2 ] )<(  ClipMin[2 ] ))?(  ClipMin[2 ] ):( NewMin[2 ] )) ;

  NewMax[0 ] = ((( NewMax[0 ] )>(  ClipMax[0 ] ))?(  ClipMax[0 ] ):( NewMax[0 ] )) ;
  NewMax[1 ] = ((( NewMax[1 ] )>(  ClipMax[1 ] ))?(  ClipMax[1 ] ):( NewMax[1 ] )) ;
  NewMax[2 ] = ((( NewMax[2 ] )>(  ClipMax[2 ] ))?(  ClipMax[2 ] ):( NewMax[2 ] )) ;

   

  New_Volume = (NewMax[0 ] - NewMin[0 ]) * (NewMax[1 ] - NewMin[1 ]) * (NewMax[2 ] - NewMin[2 ]);

  { ( Old_Volume ) = (  Old ).Lengths[0 ] * (  Old ).Lengths[1 ] * (  Old ).Lengths[2 ]; } ;

  if (New_Volume < Old_Volume)
  {
     

    {( NewMin )[0 ]+=(  T1 )[0 ];( NewMin )[1 ]+=(  T1 )[1 ];( NewMin )[2 ]+=(  T1 )[2 ];} ;
    {( NewMax )[0 ]+=(  T1 )[0 ];( NewMax )[1 ]+=(  T1 )[1 ];( NewMax )[2 ]+=(  T1 )[2 ];} ;

    { ( Quadric->BBox ).Lower_Left[0 ] = (float  )(  NewMin [0 ]); ( Quadric->BBox ).Lower_Left[1 ] = (float  )(  NewMin [1 ]); ( Quadric->BBox ).Lower_Left[2 ] = (float  )(  NewMin [2 ]); ( Quadric->BBox ).Lengths[0 ] = (float  )(  NewMax [0 ]-  NewMin [0 ]); ( Quadric->BBox ).Lengths[1 ] = (float  )(  NewMax [1 ]-  NewMin [1 ]); ( Quadric->BBox ).Lengths[2 ] = (float  )(  NewMax [2 ]-  NewMin [2 ]); } ;

     

    if ((Quadric->BBox.Lengths[0 ] > 1.0e6 ) ||
        (Quadric->BBox.Lengths[1 ] > 1.0e6 ) ||
        (Quadric->BBox.Lengths[2 ] > 1.0e6 ))
    {
      { ( Quadric->BBox ).Lower_Left[0 ] = (float  )(  - 2.0e10 /2 ); ( Quadric->BBox ).Lower_Left[1 ] = (float  )(  - 2.0e10 /2 ); ( Quadric->BBox ).Lower_Left[2 ] = (float  )(  - 2.0e10 /2 ); ( Quadric->BBox ).Lengths[0 ] = (float  )( 
        2.0e10  ); ( Quadric->BBox ).Lengths[1 ] = (float  )(  2.0e10  ); ( Quadric->BBox ).Lengths[2 ] = (float  )(  2.0e10  ); } ;
    }
  }
}

void Compute_Plane_Min_Max(Plane, Min, Max)
PLANE *Plane;
VECTOR Min, Max;
{
  double  d;
  VECTOR N;

  memcpy(( N ),(  Plane->Normal_Vector ),sizeof(VECTOR)) ;

  d = -Plane->Distance;

  Min[0 ] = Min[1 ] = Min[2 ] = - 2.0e10 /2;
  Max[0 ] = Max[1 ] = Max[2 ] =  2.0e10 /2;

   

  if ((( 1.0 - (( N[0 ] ) < 0.0 ? -( N[0 ] ) : ( N[0 ] ))  ) < 0.0 ? -( 1.0 - (( N[0 ] ) < 0.0 ? -( N[0 ] ) : ( N[0 ] ))  ) : ( 1.0 - (( N[0 ] ) < 0.0 ? -( N[0 ] ) : ( N[0 ] ))  ))  < 1.0e-10 )
  {
    if (N[0 ] > 0.0)
    {
      Max[0 ] = d;
    }
    else
    {
      Min[0 ] = -d;
    }
  }

   

  if ((( 1.0 - (( N[1 ] ) < 0.0 ? -( N[1 ] ) : ( N[1 ] ))  ) < 0.0 ? -( 1.0 - (( N[1 ] ) < 0.0 ? -( N[1 ] ) : ( N[1 ] ))  ) : ( 1.0 - (( N[1 ] ) < 0.0 ? -( N[1 ] ) : ( N[1 ] ))  ))  < 1.0e-10 )
  {
    if (N[1 ] > 0.0)
    {
      Max[1 ] = d;
    }
    else
    {
      Min[1 ] = -d;
    }
  }

   

  if ((( 1.0 - (( N[2 ] ) < 0.0 ? -( N[2 ] ) : ( N[2 ] ))  ) < 0.0 ? -( 1.0 - (( N[2 ] ) < 0.0 ? -( N[2 ] ) : ( N[2 ] ))  ) : ( 1.0 - (( N[2 ] ) < 0.0 ? -( N[2 ] ) : ( N[2 ] ))  ))  < 1.0e-10 )
  {
    if (N[2 ] > 0.0)
    {
      Max[2 ] = d;
    }
    else
    {
      Min[2 ] = -d;
    }
  }
}

>How-To-Repeat:
	
>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:
 
 
 



More information about the Gcc-bugs mailing list