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 |
2501 |
|
.NH |
2502 |
|
MGF Translators |
2503 |
|
.LP |
2504 |
< |
Initially, there are four translators for MGF data, but only |
2505 |
< |
one of these is distributed with the MGF parser itself, |
2506 |
< |
.I mgfilt. |
2504 |
> |
Initially, there are five translators for MGF data, but only |
2505 |
> |
two of these are distributed with the MGF parser itself, |
2506 |
> |
.I mgfilt |
2507 |
> |
and |
2508 |
> |
.I mgf2inv. |
2509 |
|
Two of the other translators, |
2510 |
|
.I mgf2rad |
2511 |
|
and |
2518 |
|
nestor.epfl.ch, or by WWW from |
2519 |
|
"http://radsite.lbl.gov/radiance/HOME.html" |
2520 |
|
.FE |
2521 |
< |
A third translator, |
2521 |
> |
The fifth translator, |
2522 |
|
.I mgf2meta, |
2523 |
|
converts to a 2-dimensional line plot, and is also |
2524 |
|
distributed with Radiance. |
2535 |
|
In future releases of MGF, this utility will also be handy for |
2536 |
|
taking new entities and producing older versions of MGF for |
2537 |
|
translators that have not yet been updated properly. |
2538 |
+ |
.LP |
2539 |
+ |
Mgf2inv converts from MGF to Inventor or VRML format. |
2540 |
+ |
Some information is lost, because these formats do not support |
2541 |
+ |
physical light sources or materials. |
2542 |
|
.ds LH Translators |
2543 |
|
.ds RH MGFILT |
2544 |
|
.bp |
2573 |
|
of MGF that is to be produced. |
2574 |
|
Since MGF is in its first major release, this is not yet a useful |
2575 |
|
form, but it will be when the second major release comes out. |
2576 |
+ |
This has the necessary side-effect of expanding all included files. |
2577 |
+ |
(See the |
2578 |
+ |
.UL i |
2579 |
+ |
entity.)\0 |
2580 |
|
.LP |
2581 |
|
In the second form, |
2582 |
|
.I mgfilt |
2601 |
|
.SH |
2602 |
|
SEE ALSO |
2603 |
|
.LP |
2604 |
< |
mgf2rad, rad2mgf |
2604 |
> |
i, mgf2inv, mgf2rad, rad2mgf |
2605 |
> |
.ds RH MGF2INV |
2606 |
> |
.bp |
2607 |
> |
.SH |
2608 |
> |
NAME |
2609 |
> |
.LP |
2610 |
> |
mgf2inv - convert from MGF to Inventor or VRML format |
2611 |
> |
.SH |
2612 |
> |
SYNOPSIS |
2613 |
> |
.LP |
2614 |
> |
.B mgf2inv |
2615 |
> |
[ |
2616 |
> |
.B "-1|-2|-vrml" |
2617 |
> |
] |
2618 |
> |
[ |
2619 |
> |
.B input .. |
2620 |
> |
] |
2621 |
> |
.SH |
2622 |
> |
DESCRIPTION |
2623 |
> |
.LP |
2624 |
> |
.I Mgf2inv |
2625 |
> |
takes one or more MGF input files and converts it to |
2626 |
> |
Inventor or VRML format. |
2627 |
> |
If the |
2628 |
> |
.I \-1 |
2629 |
> |
option is used, then Inventor 1.0 ASCII output is produced. |
2630 |
> |
If the |
2631 |
> |
.I \-2 |
2632 |
> |
option is used, then Inventor 2.0 ASCII output is produced. |
2633 |
> |
(This is the default.)\0 |
2634 |
> |
If the |
2635 |
> |
.I \-vrml |
2636 |
> |
option is used, then VRML 1.0 ASCII output is produced. |
2637 |
> |
.LP |
2638 |
> |
This converter does not work properly for light sources, since |
2639 |
> |
the output formats do not support IES-type luminaires with recorded |
2640 |
> |
distributions. |
2641 |
> |
Also, some material information may be lost because Inventor lacks |
2642 |
> |
a physically valid reflectance model. |
2643 |
> |
.SH |
2644 |
> |
EXAMPLES |
2645 |
> |
.LP |
2646 |
> |
To take an MGF file and convert it to VRML format: |
2647 |
> |
.IP |
2648 |
> |
mgf2inv -vrml myscene.mgf > myscene.iv |
2649 |
> |
.SH |
2650 |
> |
SEE ALSO |
2651 |
> |
.LP |
2652 |
> |
mgf2rad, mgfilt, rad2mgf |
2653 |
|
.ds RH MGF2RAD |
2654 |
|
.bp |
2655 |
|
.SH |
2753 |
|
SEE ALSO |
2754 |
|
.LP |
2755 |
|
ies2rad(1), mgf2meta(1), obj2rad(1), oconv(1), rad2mgf(1), xform(1) |
2756 |
< |
.ds RH |
2699 |
< |
RAD2MGF |
2756 |
> |
.ds RH RAD2MGF |
2757 |
|
.bp |
2758 |
|
.SH |
2759 |
|
NAME |
3042 |
|
|
3043 |
|
if (ac < 4) /* check # arguments */ |
3044 |
|
return(MG_EARGC); |
3045 |
< |
printf("face\n"); /* begin face output */ |
3045 |
> |
printf("face\\\\n"); /* begin face output */ |
3046 |
|
for (i = 1; i < ac; i++) { |
3047 |
|
if ((vp = c_getvert(av[i])) == NULL) /* vertex from name */ |
3048 |
|
return(MG_EUNDEF); |
3049 |
|
xf_xfmpoint(vert, vp->p); /* apply transform */ |
3050 |
< |
printf("%15.9f %15.9f %15.9f\n", |
3050 |
> |
printf("%15.9f %15.9f %15.9f\\\\n", |
3051 |
|
vert[0], vert[1], vert[2]); /* output vertex */ |
3052 |
|
} |
3053 |
< |
printf(";\\n"); /* end of face output */ |
3053 |
> |
printf(";\\\\n"); /* end of face output */ |
3054 |
|
return(MG_OK); /* normal exit */ |
3055 |
|
} |
3056 |
|
|
3179 |
|
#define MG_E_CMIX 4 /* cmix */ |
3180 |
|
#define MG_E_CSPEC 5 /* cspec */ |
3181 |
|
#define MG_E_CXY 6 /* cxy */ |
3182 |
< |
#define MG_E_CYL 7 /* cyl */ |
3182 |
> |
#define MG_E_CYL 7 /* cyl */ |
3183 |
|
#define MG_E_ED 8 /* ed */ |
3184 |
|
#define MG_E_FACE 9 /* f */ |
3185 |
|
#define MG_E_INCLUDE 10 /* i */ |
3186 |
|
#define MG_E_IES 11 /* ies */ |
3187 |
< |
#define MG_E_IR 12 /* ir */ |
3187 |
> |
#define MG_E_IR 12 /* ir */ |
3188 |
|
#define MG_E_MATERIAL 13 /* m */ |
3189 |
|
#define MG_E_NORMAL 14 /* n */ |
3190 |
|
#define MG_E_OBJECT 15 /* o */ |
3324 |
|
#define MG_EUNK 1 /* unknown entity */ |
3325 |
|
#define MG_EARGC 2 /* wrong number of arguments */ |
3326 |
|
#define MG_ETYPE 3 /* argument type error */ |
3327 |
< |
#define MG_EILL 4 /* illegal argument value */ |
3327 |
> |
#define MG_EILL 4 /* illegal argument value */ |
3328 |
|
#define MG_EUNDEF 5 /* undefined reference */ |
3329 |
|
#define MG_ENOFILE 6 /* cannot open input file */ |
3330 |
|
#define MG_EINCL 7 /* error in included file */ |
3331 |
|
#define MG_EMEM 8 /* out of memory */ |
3332 |
|
#define MG_ESEEK 9 /* file seek error */ |
3333 |
|
#define MG_EBADMAT 10 /* bad material specification */ |
3334 |
+ |
#define MG_ELINE 11 /* input line too long */ |
3335 |
+ |
#define MG_ECNTXT 12 /* unmatched context close */ |
3336 |
|
|
3337 |
< |
#define MG_NERRS 11 |
3337 |
> |
#define MG_NERRS 13 |
3338 |
|
.DE |
3339 |
|
If it is inappropriate to send output to standard error, the calling |
3340 |
|
program should use the routines listed under |
3348 |
|
.SH |
3349 |
|
SEE ALSO |
3350 |
|
.LP |
3351 |
< |
mg_fgetpos, mg_handle, mg_init |
3351 |
> |
mg_fgetpos, mg_handle, mg_init, mg_open |
3352 |
|
.ds RH MG_OPEN |
3353 |
|
.bp |
3354 |
|
.SH |
3418 |
|
function reads the next input line from the current file, |
3419 |
|
returning the number of characters in the line, or zero if the |
3420 |
|
end of file is reached or there is a file error. |
3421 |
< |
The function skips over escaped newlines, and keeps track of the |
3421 |
> |
If the value returned equals MG_MAXLINE-1, |
3422 |
> |
then the input line was too long, and you |
3423 |
> |
should return an MG_ELINE error. |
3424 |
> |
The function keeps track of the |
3425 |
|
line number in the current file context |
3426 |
|
.I mg_file, |
3427 |
|
which also contains the line that was read. |
4337 |
|
.SH |
4338 |
|
NAME |
4339 |
|
.LP |
4340 |
< |
xf_xfmpoint xf_xfmvect, xf_rotvect, xf_scale - apply current |
4340 |
> |
xf_xfmpoint, xf_xfmvect, xf_rotvect, xf_scale - apply current |
4341 |
|
transformation |
4342 |
|
.SH |
4343 |
|
SYNOPSIS |
4366 |
|
.I pold, |
4367 |
|
scaling, rotating and moving it to its proper location, which is put in |
4368 |
|
.I pnew. |
4369 |
< |
(The two arguments may point to the same vector.)\0 |
4369 |
> |
(As for |
4370 |
> |
.I xf_xfmvect |
4371 |
> |
and |
4372 |
> |
.I xf_rotvect, |
4373 |
> |
the two arguments may point to the same vector.)\0 |
4374 |
|
.LP |
4375 |
|
The |
4376 |
|
.I xf_xfmvect |
4378 |
|
.I vold, |
4379 |
|
scaling and rotating it to its proper location, which is put in |
4380 |
|
.I vnew. |
4315 |
– |
(The two arguments may point to the same vector.)\0 |
4381 |
|
The only difference between |
4382 |
|
.I xf_xfmpoint |
4383 |
|
and |
4390 |
|
.I nold |
4391 |
|
using the current transformation, and stores the result in |
4392 |
|
.I nnew. |
4328 |
– |
(The two arguments may point to the same vector.)\0 |
4393 |
|
No translation or scaling is applied, which is the appropriate |
4394 |
|
action for surface normal vectors for example. |
4395 |
|
.LP |
4550 |
|
#define CIE_y_w 0.3333 |
4551 |
|
#endif |
4552 |
|
|
4553 |
< |
#define CIE_D ( CIE_x_r*(CIE_y_g - CIE_y_b) + \\\\ |
4554 |
< |
CIE_x_g*(CIE_y_b - CIE_y_r) + \\\\ |
4553 |
> |
#define CIE_D ( CIE_x_r*(CIE_y_g - CIE_y_b) + \\ |
4554 |
> |
CIE_x_g*(CIE_y_b - CIE_y_r) + \\ |
4555 |
|
CIE_x_b*(CIE_y_r - CIE_y_g) ) |
4556 |
< |
#define CIE_C_rD ( (1./CIE_y_w) * \\\\ |
4557 |
< |
( CIE_x_w*(CIE_y_g - CIE_y_b) - \\\\ |
4558 |
< |
CIE_y_w*(CIE_x_g - CIE_x_b) + \\\\ |
4556 |
> |
#define CIE_C_rD ( (1./CIE_y_w) * \\ |
4557 |
> |
( CIE_x_w*(CIE_y_g - CIE_y_b) - \\ |
4558 |
> |
CIE_y_w*(CIE_x_g - CIE_x_b) + \\ |
4559 |
|
CIE_x_g*CIE_y_b - CIE_x_b*CIE_y_g ) ) |
4560 |
< |
#define CIE_C_gD ( (1./CIE_y_w) * \\\\ |
4561 |
< |
( CIE_x_w*(CIE_y_b - CIE_y_r) - \\\\ |
4562 |
< |
CIE_y_w*(CIE_x_b - CIE_x_r) - \\\\ |
4560 |
> |
#define CIE_C_gD ( (1./CIE_y_w) * \\ |
4561 |
> |
( CIE_x_w*(CIE_y_b - CIE_y_r) - \\ |
4562 |
> |
CIE_y_w*(CIE_x_b - CIE_x_r) - \\ |
4563 |
|
CIE_x_r*CIE_y_b + CIE_x_b*CIE_y_r ) ) |
4564 |
< |
#define CIE_C_bD ( (1./CIE_y_w) * \\\\ |
4565 |
< |
( CIE_x_w*(CIE_y_r - CIE_y_g) - \\\\ |
4566 |
< |
CIE_y_w*(CIE_x_r - CIE_x_g) + \\\\ |
4564 |
> |
#define CIE_C_bD ( (1./CIE_y_w) * \\ |
4565 |
> |
( CIE_x_w*(CIE_y_r - CIE_y_g) - \\ |
4566 |
> |
CIE_y_w*(CIE_x_r - CIE_x_g) + \\ |
4567 |
|
CIE_x_r*CIE_y_g - CIE_x_g*CIE_y_r ) ) |
4568 |
|
|
4569 |
|
#define CIE_rf (CIE_y_r*CIE_C_rD/CIE_D) |