| 431 |  | sufficient. | 
| 432 |  | The following transformation flags and | 
| 433 |  | parameters are defined: | 
| 434 | < | .TS I | 
| 434 | > | .TS | 
| 435 | > | center; | 
| 436 |  | l l. | 
| 437 |  | -t dx dy dz     translate objects along the given vector | 
| 438 |  | -rx degrees     rotate objects about the X-axis | 
| 547 |  | The following example of a simple room with a single door | 
| 548 |  | and six file cabinets shows MGF in action, with copious comments to | 
| 549 |  | help explain what's going on. | 
| 550 | + | .LP | 
| 551 |  | .DS | 
| 552 |  | # "ceiling_tile" is a diffuse white surface with 75% reflectance: | 
| 553 |  | # Create new named material context and clear it | 
| 746 |  | o | 
| 747 |  | o | 
| 748 |  |  | 
| 747 | – | i cubfurn.inc -mx -t 405 133.5 0 | 
| 748 | – | o | 
| 749 | – |  | 
| 749 |  | # Six file cabinets (36" wide each) | 
| 750 |  | # ("filecab.inc" was given as an earlier example in Section 1.2) | 
| 751 |  | o filecab.x | 
| 771 |  | For ease of reference we have broken these into five categories: | 
| 772 |  | .IP 1. | 
| 773 |  | General | 
| 774 | < | .TS I | 
| 774 | > | .TS | 
| 775 |  | lw(.75i) lw(1.75i) lw(3i). | 
| 776 |  | #       [anything ...]  a comment | 
| 777 |  | o       [name]  begin/end object context | 
| 781 |  | .TE | 
| 782 |  | .IP 2. | 
| 783 |  | Color | 
| 784 | < | .TS I | 
| 784 | > | .TS | 
| 785 |  | lw(.75i) lw(1.75i) lw(3i). | 
| 786 |  | c       [id [= [template]]]     get/set color context | 
| 787 |  | cxy     x y     set CIE (x,y) chromaticity for current color | 
| 1266 |  | Values in between are separated by | 
| 1267 |  | .I "(l_max-l_min)/(N-1)" | 
| 1268 |  | nanometers. | 
| 1269 | < | All values must be non-negative, and the spectrum outside of the | 
| 1269 | > | All values should be non-negative unless defining a component for | 
| 1270 | > | complementary color mixing, and the spectrum outside of the | 
| 1271 |  | specified range is assumed to be zero. | 
| 1272 |  | (The visible range is 380 to 780 nm.)\0 | 
| 1273 |  | The actual units and scale of the measurements do not matter, | 
| 2226 |  | p 0 0 .005 | 
| 2227 |  | v vend = | 
| 2228 |  | p 0 0 .05 | 
| 2229 | < | cyl vtip1 .0015 | 
| 2229 | > | cyl vtip1 .0015 vend | 
| 2230 |  | sph vend .0015 | 
| 2231 |  | cone vtip0 0 vtip1 .0015 | 
| 2232 |  | o | 
| 2388 |  | .SH | 
| 2389 |  | SYNOPSIS | 
| 2390 |  | .LP | 
| 2391 | < | .B cyl | 
| 2391 | > | .B ring | 
| 2392 |  | .I "vc rmin rmax" | 
| 2393 |  | .SH | 
| 2394 |  | DESCRIPTION | 
| 2567 |  | of MGF that is to be produced. | 
| 2568 |  | Since MGF is in its first major release, this is not yet a useful | 
| 2569 |  | form, but it will be when the second major release comes out. | 
| 2570 | + | This has the necessary side-effect of expanding all included files. | 
| 2571 | + | (See the | 
| 2572 | + | .UL i | 
| 2573 | + | entity.)\0 | 
| 2574 |  | .LP | 
| 2575 |  | In the second form, | 
| 2576 |  | .I mgfilt | 
| 2595 |  | .SH | 
| 2596 |  | SEE ALSO | 
| 2597 |  | .LP | 
| 2598 | < | mgf2rad, rad2mgf | 
| 2598 | > | i, mgf2rad, rad2mgf | 
| 2599 |  | .ds RH MGF2RAD | 
| 2600 |  | .bp | 
| 2601 |  | .SH | 
| 2699 |  | SEE ALSO | 
| 2700 |  | .LP | 
| 2701 |  | ies2rad(1), mgf2meta(1), obj2rad(1), oconv(1), rad2mgf(1), xform(1) | 
| 2702 | < | .ds RH | 
| 2699 | < | RAD2MGF | 
| 2702 | > | .ds RH RAD2MGF | 
| 2703 |  | .bp | 
| 2704 |  | .SH | 
| 2705 |  | NAME | 
| 2988 |  |  | 
| 2989 |  | if (ac < 4)                     /* check # arguments */ | 
| 2990 |  | return(MG_EARGC); | 
| 2991 | < | printf("face\n");               /* begin face output */ | 
| 2991 | > | printf("face\\\\n");            /* begin face output */ | 
| 2992 |  | for (i = 1; i < ac; i++) { | 
| 2993 |  | if ((vp = c_getvert(av[i])) == NULL)    /* vertex from name */ | 
| 2994 |  | return(MG_EUNDEF); | 
| 2995 |  | xf_xfmpoint(vert, vp->p);                       /* apply transform */ | 
| 2996 | < | printf("%15.9f %15.9f %15.9f\n", | 
| 2996 | > | printf("%15.9f %15.9f %15.9f\\\\n", | 
| 2997 |  | vert[0], vert[1], vert[2]);                     /* output vertex */ | 
| 2998 |  | } | 
| 2999 | < | printf(";\\n");                 /* end of face output */ | 
| 2999 | > | printf(";\\\\n");                       /* end of face output */ | 
| 3000 |  | return(MG_OK);                  /* normal exit */ | 
| 3001 |  | } | 
| 3002 |  |  | 
| 3125 |  | #define MG_E_CMIX               4               /* cmix */ | 
| 3126 |  | #define MG_E_CSPEC              5               /* cspec        */ | 
| 3127 |  | #define MG_E_CXY                6               /* cxy          */ | 
| 3128 | < | #define MG_E_CYL                7               /* cyl  */ | 
| 3128 | > | #define MG_E_CYL                7               /* cyl          */ | 
| 3129 |  | #define MG_E_ED         8               /* ed           */ | 
| 3130 |  | #define MG_E_FACE               9               /* f            */ | 
| 3131 |  | #define MG_E_INCLUDE    10              /* i            */ | 
| 3132 |  | #define MG_E_IES                11              /* ies          */ | 
| 3133 | < | #define MG_E_IR         12              /* ir           */ | 
| 3133 | > | #define MG_E_IR                 12              /* ir           */ | 
| 3134 |  | #define MG_E_MATERIAL   13              /* m            */ | 
| 3135 |  | #define MG_E_NORMAL     14              /* n            */ | 
| 3136 |  | #define MG_E_OBJECT     15              /* o            */ | 
| 3270 |  | #define MG_EUNK         1               /* unknown entity */ | 
| 3271 |  | #define MG_EARGC                2               /* wrong number of arguments */ | 
| 3272 |  | #define MG_ETYPE                3               /* argument type error */ | 
| 3273 | < | #define MG_EILL         4               /* illegal argument value */ | 
| 3273 | > | #define MG_EILL                         4               /* illegal argument value */ | 
| 3274 |  | #define MG_EUNDEF               5               /* undefined reference */ | 
| 3275 |  | #define MG_ENOFILE              6               /* cannot open input file */ | 
| 3276 |  | #define MG_EINCL                7               /* error in included file */ | 
| 3277 |  | #define MG_EMEM         8               /* out of memory */ | 
| 3278 |  | #define MG_ESEEK                9               /* file seek error */ | 
| 3279 |  | #define MG_EBADMAT      10              /* bad material specification */ | 
| 3280 | + | #define MG_ELINE                11              /* input line too long */ | 
| 3281 | + | #define MG_ECNTXT               12              /* unmatched context close */ | 
| 3282 |  |  | 
| 3283 | < | #define MG_NERRS        11 | 
| 3283 | > | #define MG_NERRS        13 | 
| 3284 |  | .DE | 
| 3285 |  | If it is inappropriate to send output to standard error, the calling | 
| 3286 |  | program should use the routines listed under | 
| 3294 |  | .SH | 
| 3295 |  | SEE ALSO | 
| 3296 |  | .LP | 
| 3297 | < | mg_fgetpos, mg_handle, mg_init | 
| 3297 | > | mg_fgetpos, mg_handle, mg_init, mg_open | 
| 3298 |  | .ds RH MG_OPEN | 
| 3299 |  | .bp | 
| 3300 |  | .SH | 
| 3364 |  | function reads the next input line from the current file, | 
| 3365 |  | returning the number of characters in the line, or zero if the | 
| 3366 |  | end of file is reached or there is a file error. | 
| 3367 | < | The function skips over escaped newlines, and keeps track of the | 
| 3367 | > | If the value returned equals MG_MAXLINE-1, | 
| 3368 | > | then the input line was too long, and you | 
| 3369 | > | should return an MG_ELINE error. | 
| 3370 | > | The function keeps track of the | 
| 3371 |  | line number in the current file context | 
| 3372 |  | .I mg_file, | 
| 3373 |  | which also contains the line that was read. | 
| 4283 |  | .SH | 
| 4284 |  | NAME | 
| 4285 |  | .LP | 
| 4286 | < | xf_xfmpoint xf_xfmvect, xf_rotvect, xf_scale - apply current | 
| 4286 | > | xf_xfmpoint, xf_xfmvect, xf_rotvect, xf_scale - apply current | 
| 4287 |  | transformation | 
| 4288 |  | .SH | 
| 4289 |  | SYNOPSIS | 
| 4312 |  | .I pold, | 
| 4313 |  | scaling, rotating and moving it to its proper location, which is put in | 
| 4314 |  | .I pnew. | 
| 4315 | < | (The two arguments may point to the same vector.)\0 | 
| 4315 | > | (As for | 
| 4316 | > | .I xf_xfmvect | 
| 4317 | > | and | 
| 4318 | > | .I xf_rotvect, | 
| 4319 | > | the two arguments may point to the same vector.)\0 | 
| 4320 |  | .LP | 
| 4321 |  | The | 
| 4322 |  | .I xf_xfmvect | 
| 4324 |  | .I vold, | 
| 4325 |  | scaling and rotating it to its proper location, which is put in | 
| 4326 |  | .I vnew. | 
| 4315 | – | (The two arguments may point to the same vector.)\0 | 
| 4327 |  | The only difference between | 
| 4328 |  | .I xf_xfmpoint | 
| 4329 |  | and | 
| 4336 |  | .I nold | 
| 4337 |  | using the current transformation, and stores the result in | 
| 4338 |  | .I nnew. | 
| 4328 | – | (The two arguments may point to the same vector.)\0 | 
| 4339 |  | No translation or scaling is applied, which is the appropriate | 
| 4340 |  | action for surface normal vectors for example. | 
| 4341 |  | .LP | 
| 4496 |  | #define  CIE_y_w                0.3333 | 
| 4497 |  | #endif | 
| 4498 |  |  | 
| 4499 | < | #define CIE_D           (       CIE_x_r*(CIE_y_g - CIE_y_b) + \\\\ | 
| 4500 | < | CIE_x_g*(CIE_y_b - CIE_y_r) + \\\\ | 
| 4499 | > | #define CIE_D           (       CIE_x_r*(CIE_y_g - CIE_y_b) + \\ | 
| 4500 | > | CIE_x_g*(CIE_y_b - CIE_y_r) + \\ | 
| 4501 |  | CIE_x_b*(CIE_y_r - CIE_y_g)     ) | 
| 4502 | < | #define CIE_C_rD        ( (1./CIE_y_w) * \\\\ | 
| 4503 | < | ( CIE_x_w*(CIE_y_g - CIE_y_b) - \\\\ | 
| 4504 | < | CIE_y_w*(CIE_x_g - CIE_x_b) + \\\\ | 
| 4502 | > | #define CIE_C_rD        ( (1./CIE_y_w) * \\ | 
| 4503 | > | ( CIE_x_w*(CIE_y_g - CIE_y_b) - \\ | 
| 4504 | > | CIE_y_w*(CIE_x_g - CIE_x_b) + \\ | 
| 4505 |  | CIE_x_g*CIE_y_b - CIE_x_b*CIE_y_g     ) ) | 
| 4506 | < | #define CIE_C_gD        ( (1./CIE_y_w) * \\\\ | 
| 4507 | < | ( CIE_x_w*(CIE_y_b - CIE_y_r) - \\\\ | 
| 4508 | < | CIE_y_w*(CIE_x_b - CIE_x_r) - \\\\ | 
| 4506 | > | #define CIE_C_gD        ( (1./CIE_y_w) * \\ | 
| 4507 | > | ( CIE_x_w*(CIE_y_b - CIE_y_r) - \\ | 
| 4508 | > | CIE_y_w*(CIE_x_b - CIE_x_r) - \\ | 
| 4509 |  | CIE_x_r*CIE_y_b + CIE_x_b*CIE_y_r     ) ) | 
| 4510 | < | #define CIE_C_bD        ( (1./CIE_y_w) * \\\\ | 
| 4511 | < | ( CIE_x_w*(CIE_y_r - CIE_y_g) - \\\\ | 
| 4512 | < | CIE_y_w*(CIE_x_r - CIE_x_g) + \\\\ | 
| 4510 | > | #define CIE_C_bD        ( (1./CIE_y_w) * \\ | 
| 4511 | > | ( CIE_x_w*(CIE_y_r - CIE_y_g) - \\ | 
| 4512 | > | CIE_y_w*(CIE_x_r - CIE_x_g) + \\ | 
| 4513 |  | CIE_x_r*CIE_y_g - CIE_x_g*CIE_y_r     ) ) | 
| 4514 |  |  | 
| 4515 |  | #define CIE_rf          (CIE_y_r*CIE_C_rD/CIE_D) |