00001 #ifndef __ayam_h__
00002 #define __ayam_h__
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 #include <limits.h>
00020 #include <float.h>
00021 #include <math.h>
00022 #include <stdlib.h>
00023 #include <stdio.h>
00024 #include <string.h>
00025 #include <errno.h>
00026 
00027 #ifdef WIN32
00028 #define WIN32_LEAN_AND_MEAN
00029 #include <windows.h>
00030 #undef WIN32_LEAN_AND_MEAN
00031 #endif 
00032 
00033 #ifdef WIN64
00034 #define WIN64_LEAN_AND_MEAN
00035 #include <windows.h>
00036 #undef WIN64_LEAN_AND_MEAN
00037 #endif 
00038 
00039 #ifdef __cplusplus
00040  extern "C" {
00041 #endif 
00042 
00043 #ifdef AYWITHAQUA
00044   #include <OpenGL/glu.h>
00045   #ifdef __cplusplus
00046     typedef GLvoid (*_GLUfuncptr)();
00047   #else
00048     typedef GLvoid (*_GLUfuncptr)(GLvoid);
00049   #endif
00050   #define AYLOCALGLUQUADOBJ 1
00051 #else
00052   #include <GL/glu.h>
00053 #endif 
00054 
00055 
00056 
00057 
00058 #include <togl.h>
00059 
00060 
00061 
00062 
00063 
00064 
00065 #ifdef AYUSEAFFINE
00066    
00067    #include <ripriv.h>
00068 #endif 
00069 
00070 #ifdef AYUSEBMRTRIBOUT
00071 #include <ri.h>
00072 #endif
00073 
00074 #ifdef AYUSEAQSISRIB
00075 #include <ri.h>
00076 #endif
00077 
00078 #ifdef AYUSESLARGS
00079 #include <sl.h>
00080 #endif 
00081 
00082 #ifdef AYUSESLCARGS
00083 #include <slc.h>
00084 #endif 
00085 
00086 #ifdef AYUSESLOARGS
00087 #include <slo.h>
00088 #endif 
00089 
00090 #ifdef AYUSESOARGS
00091 #include <so.h>
00092 #endif 
00093 
00094 #ifdef AYUSESLXARGS
00095 #include <slx.h>
00096 #endif 
00097 
00098 #ifndef __sgi
00099 #define AYGLUCBTYPE (_GLUfuncptr)
00100 #else
00101 #define AYGLUCBTYPE
00102 #endif
00103 
00104 #ifdef WIN32
00105  #undef AYGLUCBTYPE
00106  #define AYGLUCBTYPE (GLUnurbsErrorProc)
00107  #ifdef AYMESASGIGLU
00108   #undef AYGLUCBTYPE
00109   #define AYGLUCBTYPE (_GLUfuncptr)
00110  #endif
00111 #endif 
00112 
00113 #ifdef WIN64
00114  #undef AYGLUCBTYPE
00115  #define AYGLUCBTYPE (GLUnurbsErrorProc)
00116  #ifdef AYMESASGIGLU
00117   #undef AYGLUCBTYPE
00118   #define AYGLUCBTYPE (_GLUfuncptr)
00119  #endif
00120 #endif 
00121 
00122 
00123 
00124 #if (TCL_MAJOR_VERSION < 8) || (TCL_MAJOR_VERSION == 8) && (TCL_MINOR_VERSION < 6)
00125 #define Tcl_GetErrorLine(interp) (interp->errorLine)
00126 #endif
00127 
00128 
00129 
00131 typedef struct ay_point_s
00132 {
00133   struct ay_point_s *next; 
00134   char type; 
00135   char readonly; 
00136   double *point; 
00137   unsigned int index; 
00138 } ay_point;
00139 
00140 
00142 typedef struct ay_mpoint_s
00143 {
00144   struct ay_mpoint_s *next; 
00145   int multiplicity; 
00146   int selected; 
00147   double **points; 
00148   unsigned int *indices; 
00149 } ay_mpoint;
00150 
00151 
00153 typedef struct ay_pointedit_s
00154 {
00155   unsigned int num; 
00156   double **coords; 
00157   unsigned int *indices; 
00158   char type; 
00159   char readonly; 
00160   char multiple; 
00161 } ay_pointedit;
00162 
00163 
00165 typedef struct ay_tag_s
00166 {
00167   struct ay_tag_s *next; 
00168   char is_intern; 
00169   char is_binary; 
00170   char *name; 
00171   unsigned int type; 
00172   void *val; 
00173 } ay_tag;
00174 
00175 
00177 typedef struct ay_btval_s
00178 {
00179   size_t size; 
00180   void *payload; 
00181 } ay_btval;
00182 
00183 
00185 typedef struct ay_bparam_s
00186 {
00187   int has_bevels; 
00188   int states[4]; 
00189   int types[4]; 
00190   int dirs[4]; 
00191   int integrate[4]; 
00192   double radii[4]; 
00193   int force3d[4]; 
00194 } ay_bparam;
00195 
00196 
00198 typedef struct ay_cparam_s
00199 {
00200   int has_caps; 
00201   int states[4]; 
00202   int types[4]; 
00203   int integrate[4]; 
00204   double frac[4]; 
00205   double mp[12]; 
00206   int use_mp[4]; 
00207 } ay_cparam;
00208 
00209 
00211 typedef struct ay_trafo_s
00212 {
00214 
00215   double movx, movy, movz;
00218 
00219   double rotx, roty, rotz;
00222 
00223   double scalx, scaly, scalz;
00225   double quat[4]; 
00226 } ay_trafo;
00227 
00228 
00230 typedef struct ay_object_s {
00231   struct ay_object_s *next; 
00232   struct ay_object_s *down; 
00235   unsigned int type;
00236 
00238   char *name;
00239 
00241   unsigned int glname;
00242 
00244   unsigned int refcount;
00245 
00247   unsigned int notcount;
00248 
00250   int selected;
00251 
00253   int modified;
00254 
00256   int parent;
00257 
00259   int inherit_trafos;
00260 
00261   
00263   int hide;
00265   int hide_children;
00266 
00269   double movx, movy, movz;
00274   double rotx, roty, rotz;
00279   double scalx, scaly, scalz;
00282   double quat[4]; 
00284 #if 0
00285   ay_trafo *trafo; 
00286 #endif
00287   ay_point *selp; 
00289   ay_tag *tags; 
00291   struct ay_mat_object_s *mat; 
00293   void *refine; 
00294 } ay_object;
00295 
00296 
00298 typedef struct ay_list_object_s
00299 {
00300   struct ay_list_object_s *next; 
00301   ay_object *object; 
00302 } ay_list_object;
00303 
00304 
00305 
00306 
00308 typedef struct ay_shader_arg_s
00309 {
00310   struct ay_shader_arg_s *next; 
00311   char *name; 
00312   int type; 
00314   union {
00315     float color[3];
00316     float point[4];
00317     float matrix[16];
00318     float scalar;
00319     char *string;
00320   } val; 
00321 } ay_shader_arg;
00322 
00323 
00325 typedef struct ay_shader_s
00326 {
00327   struct ay_shader_s *next; 
00328   int type; 
00330   char *name; 
00331   ay_shader_arg *arg; 
00332 } ay_shader;
00333 
00334 
00336 typedef struct ay_mat_object_s {
00337 
00338   int registered; 
00340   char **nameptr; 
00341   unsigned int *refcountptr; 
00342   ay_object *objptr; 
00344   
00345 
00348   int colr, colg, colb;
00353   int opr, opg, opb;
00356   
00357   int matte; 
00359   
00360   double shading_rate; 
00361   int shading_interpolation; 
00363   
00364   double dbound_val; 
00365   int dbound; 
00367   
00368   int sides; 
00370   
00372   ay_shader *sshader;
00374   ay_shader *dshader;
00376   ay_shader *ishader;
00378   ay_shader *eshader;
00379 
00380   
00381    
00384     int avr, avg, avb, ava;
00388     int emr, emg, emb, ema;
00392     int spr, spg, spb, spa;
00394     
00395     double patch_size; 
00396     double elem_size; 
00397     double min_size; 
00398     
00399     int zonal; 
00401     
00402     int has_caustics; 
00404    
00405    int cast_shadows; 
00407    
00408    int true_displacement; 
00410    
00411    int camera; 
00412    int reflection; 
00413    int shadow; 
00415   GLfloat glcolor[4]; 
00417 } ay_mat_object;
00418 
00419 
00421 typedef struct ay_riopt_s
00422 {
00423   double Variance; 
00424   double Samples_X; 
00425   double Samples_Y; 
00426   char FilterFunc; 
00427   double FilterWidth; 
00428   double FilterHeight; 
00429   double ExpGain; 
00430   double ExpGamma; 
00431   double RGBA_ONE; 
00432   double RGBA_MIN; 
00433   double RGBA_MAX; 
00434   double RGBA_Dither; 
00436   int MinSamples; 
00437   int MaxSamples; 
00438   int MaxRayLevel; 
00439   double ShadowBias; 
00440   char PRManSpec; 
00441   int RadSteps; 
00442   int PatchSamples; 
00444   char *textures; 
00445   char *shaders; 
00446   char *archives; 
00447   char *procedurals; 
00449   int texturemem; 
00450   int geommem; 
00452   int width; 
00453   int height; 
00455   int use_std_display; 
00456 } ay_riopt;
00457 
00458 
00460 typedef struct ay_root_object_s
00461 {
00462   ay_riopt  *riopt; 
00463   ay_shader *imager; 
00464   ay_shader *atmosphere; 
00465 } ay_root_object;
00466 
00467 
00469 typedef struct ay_stess_curve_s {
00470   int tesslen; 
00471   double *tessv; 
00472   int tessqf; 
00473 } ay_stess_curve;
00474 
00475 
00477 typedef struct ay_nurbcurve_object_s
00478 {
00479   int type; 
00480   int length; 
00481   int order; 
00482   int knot_type; 
00483   int is_rat; 
00484   double *controlv; 
00485   double *knotv; 
00486   double *breakv; 
00488   double glu_sampling_tolerance; 
00489   int display_mode; 
00491   GLUnurbsObj *no; 
00492   float *fltcv; 
00494   ay_stess_curve stess[2]; 
00496   
00497   int createmp; 
00498   ay_mpoint *mpoints; 
00499 } ay_nurbcurve_object;
00500 
00501 
00503 typedef struct ay_stess_uvp_s {
00504   struct ay_stess_uvp_s *next; 
00505   struct ay_stess_uvp_s *prev; 
00506   int type; 
00507   int dir; 
00508 
00509   double u, v;
00511   double C[6]; 
00512 } ay_stess_uvp;
00513 
00514 
00516 typedef struct ay_stess_patch_s {
00517   int qf; 
00518   
00519   int tessw; 
00520   int tessh; 
00521   double *tessv; 
00523   
00524   int upslen; 
00525   int vpslen; 
00526   ay_stess_uvp **ups; 
00527   ay_stess_uvp **vps; 
00529   int ft_cw; 
00530   int tcslen; 
00531   int *tcslens; 
00532   double *tcspnts; 
00534   struct ay_pomesh_object_s *pomesh; 
00535   double normal[3]; 
00536 } ay_stess_patch;
00537 
00538 
00540 typedef struct ay_nurbpatch_object_s
00541 {
00542   int width; 
00543   int height; 
00544   int uorder; 
00545   int vorder; 
00546   int uknot_type; 
00547   int vknot_type; 
00549   int utype; 
00550   int vtype; 
00552   char is_rat; 
00553   char is_planar; 
00555   double *controlv; 
00556   double *uknotv; 
00557   double *vknotv; 
00559   double *breakv; 
00561    
00562 
00563   GLUnurbsObj *no; 
00564   float *fltcv; 
00566   double glu_sampling_tolerance; 
00567   int display_mode; 
00569   ay_stess_patch stess[2]; 
00572   ay_object *caps_and_bevels;
00573 
00574   
00575   int createmp; 
00576   ay_mpoint *mpoints; 
00577 } ay_nurbpatch_object;
00578 
00579 
00581 typedef struct ay_apatch_object_s {
00582   int mode; 
00583   int width; 
00584   int height; 
00585   int awidth; 
00586   int aheight; 
00587   int close_u; 
00588   int close_v; 
00589   int order_u; 
00590   int order_v; 
00591   int ktype_u; 
00592   int ktype_v; 
00594   double *controlv; 
00597   ay_object *npatch;
00598 
00600   ay_object *caps_and_bevels;
00601 
00602   double glu_sampling_tolerance; 
00603   int display_mode; 
00604 } ay_apatch_object;
00605 
00606 
00608 typedef struct ay_ipatch_object_s {
00609   int width; 
00610   int height; 
00611   int close_u; 
00612   int close_v; 
00613   int order_u; 
00614   int order_v; 
00615   int ktype_u; 
00616   int ktype_v; 
00618   double *controlv; 
00620   double sdlen_u; 
00621   double edlen_u; 
00623   double sdlen_v; 
00624   double edlen_v; 
00626   int derivs_u; 
00627   double *sderiv_u; 
00628   double *ederiv_u; 
00630   int derivs_v; 
00631   double *sderiv_v; 
00632   double *ederiv_v; 
00635   ay_object *npatch;
00636 
00638   ay_object *caps_and_bevels;
00639 
00640   double glu_sampling_tolerance; 
00641   int display_mode; 
00642 } ay_ipatch_object;
00643 
00644 
00646 typedef struct ay_pamesh_object_s {
00647   int width; 
00648   int height; 
00649   int close_u; 
00650   int close_v; 
00651   double *controlv; 
00653   int is_rat; 
00655   int type; 
00656   int btype_u; 
00657   int btype_v; 
00658   int ustep; 
00659   double *ubasis; 
00660   int vstep; 
00661   double *vbasis; 
00664   ay_object *npatch;
00665 
00667   ay_object *caps_and_bevels;
00668 
00669   double glu_sampling_tolerance; 
00670   int display_mode; 
00671 } ay_pamesh_object;
00672 
00673 
00675 typedef struct ay_pomesh_object_s {
00676   int type; 
00678   unsigned int npolys; 
00679   unsigned int *nloops; 
00680   unsigned int *nverts; 
00681   unsigned int *verts; 
00683   unsigned int ncontrols; 
00684   int has_normals; 
00685   double *controlv; 
00686   double *face_normals; 
00688   unsigned char *face_selection; 
00690   
00691 } ay_pomesh_object;
00692 
00693 
00695 typedef struct ay_sdmesh_object_s {
00696   int scheme; 
00698   unsigned int nfaces; 
00699   unsigned int *nverts; 
00700   unsigned int *verts; 
00701   unsigned int ntags; 
00702   int *tags; 
00703   unsigned int *nargs; 
00704   int *intargs; 
00705   double *floatargs; 
00707   unsigned int ncontrols; 
00708   double *controlv; 
00710   unsigned int level; 
00711   char drawsub; 
00714   ay_object *pomesh;
00715 
00716   double *face_normals; 
00717 } ay_sdmesh_object;
00718 
00719 
00721 typedef struct ay_gordon_object_s {
00722   int watchcorners; 
00723   int is_triangular; 
00724   int uorder; 
00725   int vorder; 
00728   ay_object *caps_and_bevels;
00729 
00731   ay_object *npatch;
00732 
00734   ay_object *pomesh;
00735 
00737   double edgethresh;
00738 
00739   double glu_sampling_tolerance; 
00740   int display_mode; 
00741 } ay_gordon_object;
00742 
00743 
00745 typedef struct ay_text_object_s
00746 {
00747   char *fontname; 
00748   Tcl_UniChar *unistring; 
00749   double height; 
00750   int revert; 
00751   int has_upper_cap; 
00752   int has_lower_cap; 
00755   ay_object *caps_and_bevels;
00756 
00758   ay_object *npatch;
00759 
00760   double *pnts; 
00761   unsigned int pntslen; 
00763   double glu_sampling_tolerance; 
00764   int display_mode; 
00765 } ay_text_object;
00766 
00767 
00769 typedef struct ay_light_object_s
00770 {
00771   int type; 
00772   int on; 
00773   int local; 
00774   RtLightHandle light_handle; 
00775   int shadows; 
00776   int samples; 
00777 
00778   int colr, colg, colb;
00780   double intensity; 
00781   double cone_angle; 
00782   double cone_delta_angle; 
00783   double beam_distribution; 
00784   int use_sm; 
00785   int sm_resolution; 
00786   ay_shader *lshader; 
00787   double tfrom[3]; 
00788   double tto[3]; 
00789 } ay_light_object;
00790 
00791 
00793 typedef struct ay_level_object_s
00794 {
00795   int type; 
00796 } ay_level_object;
00797 
00798 
00800 typedef struct ay_box_object_s
00801 {
00802   double width; 
00803   double length; 
00804   double height; 
00805   double *pnts; 
00806 } ay_box_object;
00807 
00808 
00810 typedef struct ay_bpatch_object_s
00811 {
00812   double p1[3]; 
00813   double p2[3]; 
00814   double p3[3]; 
00815   double p4[3]; 
00816 } ay_bpatch_object;
00817 
00818 
00820 typedef struct ay_sphere_object_s
00821 {
00822   char closed; 
00823   char is_simple; 
00824   double radius; 
00825   double zmin; 
00826   double zmax; 
00827   double thetamax; 
00828   double *pnts; 
00829 } ay_sphere_object;
00830 
00831 
00833 typedef struct ay_cone_object_s
00834 {
00835   char closed; 
00836   char is_simple; 
00837   double radius; 
00838   double height; 
00839   double thetamax; 
00840   double *pnts; 
00841 } ay_cone_object;
00842 
00843 
00845 typedef struct ay_disk_object_s
00846 {
00847   char is_simple; 
00848   double radius; 
00849   double height; 
00850   double thetamax; 
00851   double *pnts; 
00852 } ay_disk_object;
00853 
00854 
00856 typedef struct ay_cylinder_object_s
00857 {
00858   char closed; 
00859   char is_simple; 
00860   double radius; 
00861   double zmin; 
00862   double zmax; 
00863   double thetamax; 
00864   double *pnts; 
00865 } ay_cylinder_object;
00866 
00867 
00869 typedef struct ay_hyperboloid_s
00870 {
00871   char closed; 
00872   double p1[3]; 
00873   double p2[3]; 
00874   double thetamax; 
00875   double *pnts; 
00876 } ay_hyperboloid_object;
00877 
00878 
00880 typedef struct ay_paraboloid_object_s
00881 {
00882   char closed; 
00883   double rmax; 
00884   double zmin; 
00885   double zmax; 
00886   double thetamax; 
00887   double *pnts; 
00888 } ay_paraboloid_object;
00889 
00890 
00892 typedef struct ay_torus_object_s
00893 {
00894   char closed; 
00895   double majorrad; 
00896   double minorrad; 
00897   double phimin; 
00898   double phimax; 
00899   double thetamax; 
00900   double *pnts; 
00901 } ay_torus_object;
00902 
00903 
00905 typedef struct ay_icurve_object_s
00906 {
00907   int type; 
00908   int length; 
00909   int order; 
00911   int param_type; 
00912   double sdlen; 
00913   double edlen; 
00915   double *controlv; 
00917   int derivs; 
00918   double sderiv[3]; 
00919   double ederiv[3]; 
00922   ay_object *ncurve;
00923 
00924   double glu_sampling_tolerance; 
00925   int display_mode; 
00926 } ay_icurve_object;
00927 
00928 
00930 typedef struct ay_acurve_object_s
00931 {
00932   int length; 
00933   int alength; 
00934   int closed; 
00935   int symmetric; 
00936   int order; 
00938   double *controlv; 
00941   ay_object *ncurve;
00942 
00943   double glu_sampling_tolerance; 
00944   int display_mode; 
00945 } ay_acurve_object;
00946 
00947 
00949 typedef struct ay_concatnc_object_s
00950 {
00951   int closed; 
00952   int fillgaps; 
00953   int revert; 
00954   int knot_type; 
00955   double ftlength; 
00958   ay_object *ncurve;
00959 
00960   double glu_sampling_tolerance; 
00961   int display_mode; 
00962 } ay_concatnc_object;
00963 
00964 
00966 typedef struct ay_offnc_object_s
00967 {
00968   int mode; 
00969   int revert; 
00970   double offset; 
00973   ay_object *ncurve;
00974 
00975   double glu_sampling_tolerance; 
00976   int display_mode; 
00977 } ay_offnc_object;
00978 
00979 
00981 typedef struct ay_cap_object_s
00982 {
00983   int type; 
00985   double fraction; 
00988   ay_object *npatch;
00989 
00990   double glu_sampling_tolerance; 
00991   int display_mode; 
00992 } ay_cap_object;
00993 
00994 
00996 typedef struct ay_bevel_object_s
00997 {
00998   int has_start_cap; 
00999   int has_end_cap; 
01002   ay_object *npatch;
01003 
01005   ay_object *caps;
01006 
01007   double glu_sampling_tolerance; 
01008   int display_mode; 
01009 } ay_bevel_object;
01010 
01011 
01013 typedef struct ay_clone_object_s
01014 {
01015   int numclones; 
01016   int rotate; 
01017   int mirror; 
01019   
01021   double movx, movy, movz;
01023 
01024   double rotx, roty, rotz;
01027 
01028   double scalx, scaly, scalz;
01030   double quat[4]; 
01032   double *pnts; 
01033   unsigned int pntslen; 
01034   int pntsrat; 
01037   ay_object *clones;
01038 } ay_clone_object;
01039 
01040 
01042 typedef struct ay_camera_object_s
01043 {
01044   double from[3]; 
01045   double to[3]; 
01046   double up[3]; 
01047   double roll; 
01048   double zoom; 
01049   double nearp; 
01050   double farp; 
01051 } ay_camera_object;
01052 
01053 
01055 typedef struct ay_riinc_object_s
01056 {
01059   double width, length, height;
01061   char *file; 
01062 } ay_riinc_object;
01063 
01064 
01066 typedef struct ay_riproc_object_s
01067 {
01068   int type; 
01071   double minx, miny, minz, maxx, maxy, maxz;
01073   char *file; 
01074   char *data; 
01075 } ay_riproc_object;
01076 
01077 
01079 typedef struct ay_revolve_object_s
01080 {
01081   double thetamax; 
01082   int sections; 
01083   int order; 
01086   ay_object *npatch;
01087 
01089   ay_object *caps_and_bevels;
01090 
01091   double glu_sampling_tolerance; 
01092   int display_mode; 
01093 } ay_revolve_object;
01094 
01095 
01097 typedef struct ay_extrude_object_s
01098 {
01099   double height; 
01100   int has_upper_cap; 
01101   int has_lower_cap; 
01104   ay_object *caps_and_bevels;
01105 
01107   ay_object *npatch;
01108 
01109   double *pnts; 
01110   unsigned int pntslen; 
01112   double glu_sampling_tolerance; 
01113   int display_mode; 
01114 } ay_extrude_object;
01115 
01116 
01118 typedef struct ay_sweep_object_s
01119 {
01120   int rotate; 
01121   int interpolate; 
01122   int close; 
01123   int sections; 
01124   int has_start_cap; 
01125   int has_end_cap; 
01126   int has_left_cap; 
01127   int has_right_cap; 
01130   ay_object *caps_and_bevels;
01131 
01133   ay_object *npatch;
01134 
01135   double glu_sampling_tolerance; 
01136   int display_mode; 
01137 } ay_sweep_object;
01138 
01139 
01141 typedef struct ay_swing_object_s
01142 {
01143 
01145   ay_object *npatch;
01146 
01148   ay_object *caps_and_bevels;
01149 
01150   double glu_sampling_tolerance; 
01151   int display_mode; 
01152 } ay_swing_object;
01153 
01154 
01156 typedef struct ay_birail1_object_s
01157 {
01158   int type; 
01159   int sections; 
01162   ay_object *caps_and_bevels;
01163 
01165   ay_object *npatch;
01166 
01167   double glu_sampling_tolerance; 
01168   int display_mode; 
01169 } ay_birail1_object;
01170 
01171 
01173 typedef struct ay_birail2_object_s
01174 {
01175   int close; 
01176   int sections; 
01177   int interpolctrl; 
01180   ay_object *caps_and_bevels;
01181 
01183   ay_object *npatch;
01184 
01185   double glu_sampling_tolerance; 
01186   int display_mode; 
01187 } ay_birail2_object;
01188 
01189 
01191 typedef struct ay_skin_object_s
01192 {
01193   int interpolate; 
01194   int uorder; 
01195   int uknot_type; 
01196   double uknotv; 
01199   ay_object *caps_and_bevels;
01200 
01202   ay_object *npatch;
01203 
01204   double glu_sampling_tolerance; 
01205   int display_mode; 
01206 } ay_skin_object;
01207 
01208 
01210 typedef struct ay_extrnc_object_s
01211 {
01212   int side; 
01213   int pnum; 
01214   int revert; 
01215   int relative; 
01216   int extractnt; 
01217   double parameter; 
01220   ay_object *ncurve;
01221 
01222   double glu_sampling_tolerance; 
01223   int display_mode; 
01224 } ay_extrnc_object;
01225 
01226 
01228 typedef struct ay_extrnp_object_s
01229 {
01230   int pnum; 
01231   int relative; 
01234   double umin, umax, vmin, vmax;
01238   ay_object *caps_and_bevels;
01239 
01241   ay_object *npatch;
01242 
01243   double glu_sampling_tolerance; 
01244   int display_mode; 
01245 } ay_extrnp_object;
01246 
01247 
01249 typedef struct ay_concatnp_object_s
01250 {
01251   int type; 
01252   int order; 
01253   int revert; 
01254   int knot_type; 
01256   int fillgaps; 
01257   double ftlength; 
01259   int compat; 
01260   char *uv_select; 
01263   ay_object *caps_and_bevels;
01264 
01266   ay_object *npatch;
01267 
01268   double glu_sampling_tolerance; 
01269   int display_mode; 
01270 } ay_concatnp_object;
01271 
01272 
01274 typedef struct ay_offnp_object_s
01275 {
01276   int mode; 
01277   double offset; 
01280   ay_object *caps_and_bevels;
01281 
01283   ay_object *npatch;
01284 
01285   double glu_sampling_tolerance; 
01286   int display_mode; 
01287 } ay_offnp_object;
01288 
01289 
01291 typedef struct ay_ncircle_object_s
01292 {
01293   double radius; 
01294   double tmin; 
01295   double tmax; 
01298   ay_object *ncurve;
01299 
01300   double glu_sampling_tolerance; 
01301   int display_mode; 
01302 } ay_ncircle_object;
01303 
01304 
01306 typedef int (ay_sevalcb) (Tcl_Interp *interp, char *script, int compile,
01307                           Tcl_Obj **cscript);
01308 
01309 
01311 typedef struct ay_script_object_s
01312 {
01313   char *script; 
01314   int active; 
01315   int type; 
01317   ay_object *cm_objects; 
01319   int modified; 
01320   Tcl_Obj *cscript; 
01322   int paramslen; 
01323   Tcl_Obj **params; 
01325   double *pnts; 
01326   unsigned int pntslen; 
01327   int pntsrat; 
01329   ay_sevalcb *cb; 
01330 } ay_script_object;
01331 
01332 
01334 typedef struct ay_view_object_s
01335 {
01336   struct Togl *togl; 
01337   int type; 
01338   int drawmode; 
01340   int local; 
01341   int aligned; 
01343   int drawsel; 
01344   int drawlevel; 
01345   int redraw; 
01347   double grid; 
01348   int drawgrid; 
01349   int usegrid; 
01351   int antialiaslines; 
01353   
01354   int ppreview; 
01355   
01356 
01357   int drawobjectcs; 
01359   
01360   double from[3]; 
01361   double to[3]; 
01362   double up[3]; 
01363   double roll; 
01364   double zoom; 
01365   double nearp; 
01366   double farp; 
01370   double rotx, roty, rotz;
01375   double conv_x, conv_y;
01380   double rect_xmin, rect_xmax, rect_ymin, rect_ymax;
01382   int drawrect; 
01386   double markworld[3];
01387   double markx;
01388   double marky;
01390   int drawmark; 
01394   int pos_x, pos_y;
01398   int isicon;
01399 
01401   int drawhandles;
01402 
01404   int drawaxis;
01405 
01407   int dirty;
01408 
01409   
01410   char *bgimage; 
01411   int bgimagedirty; 
01412   int drawbgimage; 
01416   int bgwidth, bgheight;
01417   int bguorder, bgvorder;
01418   float *bgknotv, *bgcv;
01423   int id;
01424 
01425   int transform_points; 
01427   int enable_undo; 
01431   Togl_Callback *altdispcb;
01432 
01433   int action_state; 
01435   int full_notify; 
01437   GLuint textures[3]; 
01438   int texturestate[3]; 
01439 } ay_view_object;
01440 
01441 
01443 typedef struct ay_select_object_s
01444 {
01445   char *indices; 
01446   int length; 
01447   int *seli; 
01448 } ay_select_object;
01449 
01450 
01452 typedef struct ay_trim_object_s
01453 {
01454   int patchnum; 
01455   int scalemode; 
01457   ay_object *npatch;
01458 } ay_trim_object;
01459 
01460 
01462 typedef struct ay_preferences_s
01463 {
01464   int list_types; 
01465   int mark_hidden; 
01466   int single_window; 
01467   int single_view; 
01469   
01470   int scopemanagement; 
01471   int edit_snaps_to_grid; 
01472   int snap3d; 
01473   int selfacepoints; 
01474   int allow_warp; 
01475   double object_pick_epsilon; 
01476   double pick_epsilon; 
01477   int lazynotify; 
01478   int completenotify; 
01479   int undo_levels; 
01480   int globalmark; 
01481   int createat; 
01482   int createin; 
01483   int rationalstyle; 
01485   int normalizetrafos; 
01486   int normalizemark; 
01487   int normalizedigits; 
01489   
01490   int resolveinstances; 
01491   int checklights; 
01492   int ristandard; 
01493   int use_sm; 
01494   int defaultmat; 
01495   int writeident; 
01496   int excludehidden; 
01497   int smchangeshaders; 
01498   int pvrenameshader;  
01500   
01501   int mopsiresetdisplaymode; 
01502   int mopsiresettolerance; 
01504   double guiscale; 
01506   
01507   int useguiscale; 
01508   double handle_size; 
01512   double bgr, bgg, bgb;
01516   double obr, obg, obb;
01520   double ser, seg, seb;
01524   double grr, grg, grb;
01528   double tpr, tpg, tpb;
01532   double shr, shg, shb;
01536   double lir, lig, lib;
01540   double sxr, sxg, sxb;
01543   int use_materialcolor; 
01545   double linewidth; 
01546   double sellinewidth; 
01547   double aalinewidth; 
01548   double aasellinewidth; 
01549   double aafudge; 
01550   int sdmode; 
01551   double selbndfactor; 
01553   int cullfaces; 
01555   
01556   char onerror; 
01557   char errorlevel; 
01558   int writelog; 
01559   char *logfile; 
01561   
01562   int wrib_sm; 
01563   int wrib_em; 
01564   int wrib_archives; 
01566   
01567   double glu_sampling_tolerance; 
01568   int np_display_mode; 
01569   int nc_display_mode; 
01570   double glu_sampling_tolerance_a; 
01571   int np_display_mode_a; 
01572   int nc_display_mode_a; 
01573   int glu_cache_float; 
01574   int glu_avoid_pwlcurve; 
01575   int stess_qf; 
01578   int smethod;
01579   double sparamu; 
01580   double sparamv; 
01583   int warnunknowntag;
01584 
01586   int warnpnts;
01587 
01588   double polyoffset0; 
01589   double polyoffset1; 
01592   int save_rootviews;
01593 
01595   int pprev_open;
01596   char *pprender; 
01599   int conv_reset_display;
01601   int conv_keep_caps;
01603   int conv_keep_bevels;
01604 
01605   
01606   char *texcoordname; 
01607   char *normalname; 
01608   char *tangentname; 
01609   char *colorname; 
01610   char *opacityname; 
01612   unsigned int *converttags; 
01613   int converttagslen; 
01615   int disablefailedscripts; 
01617   ay_view_object *createview; 
01618 } ay_preferences;
01619 
01620 
01622 typedef void (*ay_voidfp)(void);
01623 
01625 typedef struct ay_ftable_s
01626 {
01627   unsigned int size; 
01628   ay_voidfp *arr; 
01629 } ay_ftable;
01630 
01631 
01633 typedef struct ay_otable_s
01634 {
01635   unsigned int size; 
01636   void *arr; 
01637 } ay_otable;
01638 
01639 
01640 
01641 
01643 typedef int (ay_createcb) (int argc, char *argv[], ay_object *o);
01644 
01646 typedef int (ay_deletecb) (void *c);
01647 
01649 typedef int (ay_copycb) (void *src, void **dst);
01650 
01652 typedef int (ay_drawcb) (struct Togl *togl, ay_object *o);
01653 
01655 typedef int (ay_propcb) (Tcl_Interp *interp, int argc, char *argv[],
01656                          ay_object *o);
01657 
01659 typedef int (ay_getpntcb) (int mode, ay_object *o, double *p,
01660                            ay_pointedit *pe);
01661 
01663 typedef int (ay_wribcb) (char *file, ay_object *o);
01664 
01666 typedef int (ay_readcb) (FILE *fileptr, ay_object *o);
01667 
01669 typedef int (ay_writecb) (FILE *fileptr, ay_object *o);
01670 
01672 typedef int (ay_notifycb) (ay_object *o);
01673 
01675 typedef int (ay_treedropcb) (ay_object *o);
01676 
01678 typedef int (ay_comparecb) (ay_object *o1, ay_object *o2);
01679 
01681 typedef int (ay_convertcb) (ay_object *o, int in_place);
01682 
01684 typedef int (ay_providecb) (ay_object *o, unsigned int type,
01685                             ay_object **result);
01686 
01688 typedef int (ay_peekcb) (ay_object *o, unsigned int type,
01689                          ay_object **result, double *transform);
01690 
01692 typedef int (ay_bbccb) (ay_object *o, double *bbox, int *flags);
01693 
01695 typedef int (ay_inspntcb) (ay_object *o, int *index, double *objXYZ, int edit);
01696 
01698 typedef int (ay_delpntcb) (ay_object *o, int *index, double *objXYZ);
01699 
01701 typedef int (ay_genericcb) (ay_object *o, int op);
01702 
01703 
01704 
01705 
01707 extern Tcl_Interp *ay_interp;
01708 
01710 extern Tcl_Interp *ay_safeinterp;
01711 
01713 extern ay_preferences ay_prefs;
01714 
01716 extern ay_object *ay_root;
01717 
01719 extern ay_object *ay_endlevel;
01720 
01723 extern ay_object **ay_next;
01724 
01726 extern ay_view_object *ay_currentview;
01727 
01729 extern ay_list_object *ay_selection;
01730 
01732 extern ay_list_object *ay_currentlevel;
01733 
01735 extern ay_object *ay_clipboard;
01736 
01738 extern GLUquadric *ay_gluquadobj;
01739 
01741 extern Tcl_HashTable ay_otypesht;
01742 
01744 extern ay_otable ay_typenamest;
01745 
01747 extern Tcl_HashTable ay_tagtypesht;
01748 
01750 extern Tcl_HashTable ay_languagesht;
01751 
01755 extern ay_ftable ay_createcbt;
01757 extern ay_ftable ay_deletecbt;
01759 extern ay_ftable ay_copycbt;
01761 extern ay_ftable ay_drawcbt;
01763 extern ay_ftable ay_drawhcbt;
01765 extern ay_ftable ay_drawacbt;
01767 extern ay_ftable ay_shadecbt;
01769 extern ay_ftable ay_getpropcbt;
01771 extern ay_ftable ay_setpropcbt;
01773 extern ay_ftable ay_getpntcbt;
01775 extern ay_ftable ay_wribcbt;
01777 extern ay_ftable ay_readcbt;
01779 extern ay_ftable ay_writecbt;
01781 extern ay_ftable ay_notifycbt;
01783 extern ay_ftable ay_bbccbt;
01785 extern ay_ftable ay_treedropcbt;
01787 extern ay_ftable ay_convertcbt;
01789 extern ay_ftable ay_providecbt;
01791 extern ay_ftable ay_peekcbt;
01795 extern ay_ftable ay_sevalcbt;
01796 
01798 extern int ay_errno;
01799 
01801 extern int ay_read_version;
01802 
01804 extern int ay_read_viewnum;
01805 
01807 extern unsigned int ay_glname;
01808 
01810 extern int ay_wrib_framenum;
01811 
01813 extern unsigned int ay_wrib_primlevel;
01814 
01816 extern char *ay_version_ma;
01818 extern char *ay_version_mi;
01819 
01822 extern unsigned int ay_dummy_tagtype;
01823 extern char *ay_dummy_tagname;
01824 extern unsigned int ay_oi_tagtype;
01825 extern char *ay_oi_tagname;
01826 extern unsigned int ay_riattr_tagtype;
01827 extern char *ay_riattr_tagname;
01828 extern unsigned int ay_riopt_tagtype;
01829 extern char *ay_riopt_tagname;
01830 extern unsigned int ay_tc_tagtype;
01831 extern char *ay_tc_tagname;
01832 extern unsigned int ay_pv_tagtype;
01833 extern char *ay_pv_tagname;
01834 extern unsigned int ay_ridisp_tagtype;
01835 extern char *ay_ridisp_tagname;
01836 extern unsigned int ay_rihider_tagtype;
01837 extern char *ay_rihider_tagname;
01838 extern unsigned int ay_rimake_tagtype;
01839 extern char *ay_rimake_tagname;
01840 extern unsigned int ay_noexport_tagtype;
01841 extern char *ay_noexport_tagname;
01842 extern unsigned int ay_tp_tagtype;
01843 extern char *ay_tp_tagname;
01844 extern unsigned int ay_bns_tagtype;
01845 extern char *ay_bns_tagname;
01846 extern unsigned int ay_ans_tagtype;
01847 extern char *ay_ans_tagname;
01848 extern unsigned int ay_dbns_tagtype;
01849 extern char *ay_dbns_tagname;
01850 extern unsigned int ay_dans_tagtype;
01851 extern char *ay_dans_tagname;
01852 extern unsigned int ay_umm_tagtype;
01853 extern char *ay_umm_tagname;
01854 extern unsigned int ay_vmm_tagtype;
01855 extern char *ay_vmm_tagname;
01856 extern unsigned int ay_bp_tagtype;
01857 extern char *ay_bp_tagname;
01858 extern unsigned int ay_cp_tagtype;
01859 extern char *ay_cp_tagname;
01860 extern unsigned int ay_np_tagtype;
01861 extern char *ay_np_tagname;
01862 extern unsigned int ay_rp_tagtype;
01863 extern char *ay_rp_tagname;
01864 extern unsigned int ay_hc_tagtype;
01865 extern char *ay_hc_tagname;
01866 extern unsigned int ay_no_tagtype;
01867 extern char *ay_no_tagname;
01868 extern unsigned int ay_nm_tagtype;
01869 extern char *ay_nm_tagname;
01870 extern unsigned int ay_nt_tagtype;
01871 extern char *ay_nt_tagname;
01872 extern unsigned int ay_aswire_tagtype;
01873 extern char *ay_aswire_tagname;
01874 extern unsigned int ay_mn_tagtype;
01875 extern char *ay_mn_tagname;
01876 extern unsigned int ay_mp_tagtype;
01877 extern char *ay_mp_tagname;
01878 extern unsigned int ay_sb_tagtype;
01879 extern char *ay_sb_tagname;
01880 extern unsigned int ay_sbc_tagtype;
01881 extern char *ay_sbc_tagname;
01882 extern unsigned int ay_peek_tagtype;
01883 extern char *ay_peek_tagname;
01884 extern unsigned int ay_da_tagtype;
01885 extern char *ay_da_tagname;
01886 extern unsigned int ay_ti_tagtype;
01887 extern char *ay_ti_tagname;
01888 extern unsigned int ay_rs_tagtype;
01889 extern char *ay_rs_tagname;
01894 extern char *ay_error_igntype;
01897 
01898 
01901 #define AY_TRUE      1
01902 #define AY_FALSE     0
01903 
01907 #define AY_OK          0 
01908 #define AY_EWARN       1 
01909 #define AY_ERROR       2 
01910 #define AY_EFLUSH      3 
01911 #define AY_EOUTPUT     4 
01912 #define AY_EOMEM       5 
01913 #define AY_EOPENFILE  10 
01914 #define AY_ECLOSEFILE 11 
01915 #define AY_EFORMAT    12 
01916 #define AY_EUEOF      13 
01917 #define AY_EEOF       14 
01918 #define AY_EDONOTLINK 15 
01919 #define AY_ERANGE     16 
01920 #define AY_EUTAGTYPE  17 
01921 #define AY_ENOSEL     20 
01922 #define AY_EARGS      21 
01923 #define AY_EOPT       22 
01924 #define AY_EUOPT      23 
01925 #define AY_EWTYPE     24 
01926 #define AY_ETYPE      30 
01927 #define AY_ENTYPE     31 
01928 #define AY_EREF       40 
01929 #define AY_ENULL      50 
01930 
01934 #define AY_IDROOT           0
01935 #define AY_IDNPATCH         1
01936 #define AY_IDNCURVE         2
01937 #define AY_IDLEVEL          3
01938 #define AY_IDLIGHT          4
01939 #define AY_IDBOX            5
01940 #define AY_IDBPATCH         6
01941 #define AY_IDVIEW           7
01942 #define AY_IDCAMERA         8
01943 #define AY_IDINSTANCE       9
01944 #define AY_IDSPHERE        10
01945 #define AY_IDDISK          11
01946 #define AY_IDCONE          12
01947 #define AY_IDCYLINDER      13
01948 #define AY_IDPARABOLOID    14
01949 #define AY_IDHYPERBOLOID   15
01950 #define AY_IDTORUS         16
01951 #define AY_IDRIINC         17
01952 #define AY_IDMATERIAL      18
01953 #define AY_IDICURVE        19
01954 #define AY_IDREVOLVE       20
01955 #define AY_IDEXTRUDE       21
01956 #define AY_IDSWEEP         22
01957 #define AY_IDSKIN          23
01958 #define AY_IDCAP           24
01959 #define AY_IDPAMESH        25
01960 #define AY_IDPOMESH        26
01961 #define AY_IDCONCATNC      27
01962 #define AY_IDCLONE         28
01963 #define AY_IDSDMESH        29
01964 #define AY_IDGORDON        30
01965 #define AY_IDTEXT          31
01966 #define AY_IDBIRAIL1       32
01967 #define AY_IDBIRAIL2       33
01968 #define AY_IDEXTRNC        34
01969 #define AY_IDSCRIPT        35
01970 #define AY_IDRIPROC        36
01971 #define AY_IDBEVEL         37
01972 #define AY_IDNCIRCLE       38
01973 #define AY_IDSWING         39
01974 #define AY_IDSELECT        40
01975 #define AY_IDEXTRNP        41
01976 #define AY_IDOFFNC         42
01977 #define AY_IDACURVE        43
01978 #define AY_IDTRIM          44
01979 #define AY_IDCONCATNP      45
01980 #define AY_IDOFFNP         46
01981 #define AY_IDIPATCH        47
01982 #define AY_IDMIRROR        48
01983 #define AY_IDDSKIN         49
01984 #define AY_IDAPATCH        50
01985 
01986 #define AY_IDLAST          52
01987 
01991 #define AY_LTEND    0
01992 #define AY_LTLEVEL  1
01993 #define AY_LTUNION  2
01994 #define AY_LTDIFF   3
01995 #define AY_LTINT    4
01996 #define AY_LTPRIM   5
01997 
02001 #define AY_VTFRONT  0
02002 #define AY_VTSIDE   1
02003 #define AY_VTTOP    2
02004 #define AY_VTPERSP  3
02005 #define AY_VTTRIM   4
02006 
02010 #define AY_STSURFACE        0
02011 #define AY_STDISPLACEMENT   1
02012 #define AY_STVOLUME         2
02013 #define AY_STLIGHT          3
02014 #define AY_STIMAGER         4
02015 #define AY_STTRANSFORMATION 5
02016 #define AY_STAREALIGHT      6
02017 #define AY_STINTERIOR       7
02018 #define AY_STEXTERIOR       8
02019 #define AY_STATMOSPHERE     9
02020 
02024 #define AY_SASCALAR  0
02025 #define AY_SAPOINT   1
02026 #define AY_SANORMAL  2
02027 #define AY_SAVECTOR  3
02028 #define AY_SACOLOR   4
02029 #define AY_SASTRING  5
02030 #define AY_SAMATRIX  6
02031 
02035 #define AY_LITCUSTOM    0
02036 #define AY_LITPOINT     1
02037 #define AY_LITDISTANT   2
02038 #define AY_LITSPOT      3
02039 
02043 #define AY_CTOPEN     0
02044 #define AY_CTCLOSED   1
02045 #define AY_CTPERIODIC 2
02046 
02050 #define AY_KTBEZIER    0
02051 #define AY_KTBSPLINE   1
02052 #define AY_KTNURB      2
02053 #define AY_KTCUSTOM    3
02054 #define AY_KTCHORDAL   4
02055 #define AY_KTCENTRI    5
02056 #define AY_KTUNIFORM   6
02057 
02061 #define AY_PTBILINEAR  0
02062 #define AY_PTBICUBIC   1
02063 
02067 #define AY_BTBEZIER     0
02068 #define AY_BTBSPLINE    1
02069 #define AY_BTCATMULLROM 2
02070 #define AY_BTHERMITE    3
02071 #define AY_BTPOWER      4
02072 #define AY_BTCUSTOM     5
02073 
02077 #define AY_SDSCATMULL    0
02078 #define AY_SDSLOOP       1
02079 
02083 #define AY_SDTHOLE    0 
02084 #define AY_SDTCORNER  1 
02085 #define AY_SDTCREASE  2 
02086 #define AY_SDTIB      3 
02088 
02089 
02091 #define AY_PRTDREADA  0 
02092 #define AY_PRTRUNPROG 1 
02093 #define AY_PRTDYNLOAD 2 
02095 
02096 
02098 #define AY_CATNONE      0 
02099 #define AY_CATTRIM      1 
02100 #define AY_CATSIMPLE    2 
02101 #define AY_CATSIMPLEINT 3 
02102 #define AY_CATGORDON    4 
02104 
02105 
02107 #define AY_OCTPOINT          0 
02108 #define AY_OCTSECTION        1 
02109 #define AY_OCTHYBRID         2 
02110 #define AY_OCT3DPVN          3 
02111 #define AY_OCT3DPVNB         4 
02112 #define AY_OCTPLANENORMAL    5 
02114 
02115 
02117 #define AY_PT3D    0 
02118 #define AY_PTRAT   1 
02119 #define AY_PTKNOT  2 
02121 
02122 
02124 #define AY_DMWIRE       0
02125 #define AY_DMSHADE      1
02126 #define AY_DMSHADEWIRE  2
02127 #define AY_DMWIREHIDDEN 3
02128 #define AY_DMISOPHOTES  4
02129 
02133 #define AY_NORTH  0
02134 #define AY_EAST   1
02135 #define AY_SOUTH  2
02136 #define AY_WEST   3
02137 
02138 #define AY_FORWARD 0
02139 #define AY_BACKWARD 1
02140 
02144 #define AY_XY  0
02145 #define AY_YZ  1
02146 #define AY_XZ  2
02147 
02151 #define AY_OPREVERT  0
02152 #define AY_OPOPEN    1
02153 #define AY_OPCLOSE   2
02154 #define AY_OPREFINE  3
02155 #define AY_OPCOARSEN 4
02156 
02160 #define AY_TIISOPHOTES 0
02161 #define AY_TISILHOUETTES 1
02162 #define AY_TIVPRENDER 2
02163 
02168 #define AY_MOV 0x1
02169 #define AY_ROT 0x2
02170 #define AY_SCA 0x4
02171 
02174 #define AY_EPSILON 1.0e-06
02175 
02178 #ifdef M_PI
02179  #define AY_PI M_PI
02180 #else
02181  #define AY_PI 3.1415926535897932384626433
02182 #endif
02183 
02184 #ifdef M_PI_2
02185  #define AY_HALFPI M_PI_2
02186 #else
02187  #define AY_HALFPI (AY_PI/2.0)
02188 #endif
02189 
02190 #define AY_D2R(x) ((x)*AY_PI/180.0)
02191 
02192 #define AY_R2D(x) ((x)*180.0/AY_PI)
02193 
02194 #define AY_COT(x) (cos(x)/sin(x))
02195 
02199 #define AY_VLEN(x,y,z) sqrt((x*x)+(y*y)+(z*z))
02200 
02201 #define AY_V3LEN(v) sqrt((v[0]*v[0])+(v[1]*v[1])+(v[2]*v[2]))
02202 
02203 #define AY_V2LEN(v) sqrt((v[0]*v[0])+(v[1]*v[1]))
02204 
02205 #define AY_V3ZERO(v) {v[0]=0.0; v[1]=0.0; v[2]=0.0;}
02206 
02207 #define AY_V3SUB(r,v1,v2) {r[0]=v1[0]-v2[0];r[1]=v1[1]-v2[1];r[2]=v1[2]-v2[2];}
02208 
02209 #define AY_V2SUB(r,v1,v2) {r[0]=v1[0]-v2[0];r[1]=v1[1]-v2[1];}
02210 
02211 #define AY_V3ADD(r,v1,v2) {r[0]=v1[0]+v2[0];r[1]=v1[1]+v2[1];r[2]=v1[2]+v2[2];}
02212 
02213 #define AY_V3MUL(r,v1,v2) {r[0]=v1[0]*v2[0];r[1]=v1[1]*v2[1];r[2]=v1[2]*v2[2];}
02214 
02215 #define AY_V3CROSS(r,v1,v2) {r[0]=(v1[1] * v2[2]) - (v1[2] * v2[1]);r[1]=(v1[2] * v2[0]) - (v1[0] * v2[2]);r[2]=(v1[0] * v2[1]) - (v1[1] * v2[0]);}
02216 
02217 #define AY_V3SCAL(v,f) {(v[0])*=(f);(v[1])*=(f);(v[2])*=(f);}
02218 
02219 #define AY_V2SCAL(v,f) {(v[0])*=(f);(v[1])*=(f);}
02220 
02221 #define AY_V3DOT(v1,v2) (v1[0]*v2[0] + v1[1]*v2[1] + v1[2]*v2[2])
02222 
02223 #define AY_V2DOT(v1,v2) (v1[0]*v2[0] + v1[1]*v2[1])
02224 
02225 #define AY_V3DIST(v1,v2) sqrt(((v1[0]-v2[0])*(v1[0]-v2[0]))+((v1[1]-v2[1])*(v1[1]-v2[1]))+((v1[2]-v2[2])*(v1[2]-v2[2])))
02226 
02227 #define AY_V3SDIST(v1,v2) (((v1[0]-v2[0])*(v1[0]-v2[0]))+((v1[1]-v2[1])*(v1[1]-v2[1]))+((v1[2]-v2[2])*(v1[2]-v2[2])))
02228 
02229 #define AY_V4COMP(v1, v2) ((fabs(v1[0]-v2[0]) < AY_EPSILON) &&\
02230                            (fabs(v1[1]-v2[1]) < AY_EPSILON) &&\
02231                            (fabs(v1[2]-v2[2]) < AY_EPSILON) &&\
02232                            (fabs(v1[3]-v2[3]) < AY_EPSILON))
02233 
02234 #define AY_V3COMP(v1, v2) ((fabs(v1[0]-v2[0]) < AY_EPSILON) &&\
02235                            (fabs(v1[1]-v2[1]) < AY_EPSILON) &&\
02236                            (fabs(v1[2]-v2[2]) < AY_EPSILON))
02237 
02238 #define AY_V2COMP(v1, v2) ((fabs(v1[0]-v2[0]) < AY_EPSILON) &&\
02239                            (fabs(v1[1]-v2[1]) < AY_EPSILON))
02240 
02243 
02245 #define AY_APTRAN4(v1,v2,m) {v1[0]=v2[0]*m[0]+v2[1]*m[4]+v2[2]*m[8]+v2[3]*m[12];v1[1]=v2[0]*m[1]+v2[1]*m[5]+v2[2]*m[9]+v2[3]*m[13];v1[2]=v2[0]*m[2]+v2[1]*m[6]+v2[2]*m[10]+v2[3]*m[14];v1[3]=v2[0]*m[3]+v2[1]*m[7]+v2[2]*m[11]+v2[3]*m[15];}
02246 
02247 
02249 #define AY_APTRAN3(v1,v2,m) {v1[0]=v2[0]*m[0]+v2[1]*m[4]+v2[2]*m[8]+1.0*m[12];v1[1]=v2[0]*m[1]+v2[1]*m[5]+v2[2]*m[9]+1.0*m[13];v1[2]=v2[0]*m[2]+v2[1]*m[6]+v2[2]*m[10]+1.0*m[14];}
02250 
02252 #define AY_M44(m,r,c) ((m)[(c)*4+(r)])
02253 
02255 #define AY_ISTRAFO(o) ((fabs(o->movx) > AY_EPSILON) ||\
02256                        (fabs(o->movy) > AY_EPSILON) ||\
02257                        (fabs(o->movz) > AY_EPSILON) ||\
02258                        (fabs(o->quat[0]) > AY_EPSILON) ||\
02259                        (fabs(o->quat[1]) > AY_EPSILON) ||\
02260                        (fabs(o->quat[2]) > AY_EPSILON) ||\
02261                        (fabs(1.0 - o->quat[3]) > AY_EPSILON) ||\
02262                        (fabs(1.0 - o->scalx) > AY_EPSILON) ||\
02263                        (fabs(1.0 - o->scaly) > AY_EPSILON) ||\
02264                        (fabs(1.0 - o->scalz) > AY_EPSILON))
02265 
02267 #define AY_CHTCLERRRET(stat,name,interp) if(stat){\
02268           ay_error(AY_ERROR, name, Tcl_GetStringResult(interp));\
02269           Tcl_ResetResult(interp);\
02270           return TCL_OK;}
02271 
02273 #define AY_CHTCLERRGOT(stat,name,interp) if(stat){\
02274           ay_error(AY_ERROR, name, Tcl_GetStringResult(interp));\
02275           Tcl_ResetResult(interp);\
02276           goto cleanup;}
02277 
02279 #define AY_PRINTCMDHELP(help) \
02280             if(argc > 1 && argv[1][0] == '-' && argv[1][1] == 'h'){\
02281               ay_error(AY_EOUTPUT, argv[0], help);\
02282               return TCL_OK;}
02283 
02285 #define AY_MAX(a,b) ((a) > (b) ? (a) : (b))
02286 
02287 
02290 #define AY_VERSIONSTR "1.36"
02291 #define AY_VERSIONSTRMI "0"
02292 
02293 #define AY_VERSIONMA 1
02294 #define AY_VERSION   36
02295 #define AY_VERSIONMI 0
02296 
02298 
02299 #include "aycore.h"
02300 #include "nurbs.h"
02301 #include "objects.h"
02302 #include "contrib.h"
02303 
02330 #ifdef __cplusplus
02331 }
02332 #endif 
02333 
02334 #endif 
02335