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 |
774 |
|
For ease of reference we have broken these into five categories: |
775 |
|
.IP 1. |
776 |
|
General |
777 |
< |
.TS I |
777 |
> |
.TS |
778 |
|
lw(.75i) lw(1.75i) lw(3i). |
779 |
|
# [anything ...] a comment |
780 |
|
o [name] begin/end object context |
784 |
|
.TE |
785 |
|
.IP 2. |
786 |
|
Color |
787 |
< |
.TS I |
787 |
> |
.TS |
788 |
|
lw(.75i) lw(1.75i) lw(3i). |
789 |
|
c [id [= [template]]] get/set color context |
790 |
|
cxy x y set CIE (x,y) chromaticity for current color |
2987 |
|
|
2988 |
|
if (ac < 4) /* check # arguments */ |
2989 |
|
return(MG_EARGC); |
2990 |
< |
printf("face\n"); /* begin face output */ |
2990 |
> |
printf("face\\\\n"); /* begin face output */ |
2991 |
|
for (i = 1; i < ac; i++) { |
2992 |
|
if ((vp = c_getvert(av[i])) == NULL) /* vertex from name */ |
2993 |
|
return(MG_EUNDEF); |
2994 |
|
xf_xfmpoint(vert, vp->p); /* apply transform */ |
2995 |
< |
printf("%15.9f %15.9f %15.9f\n", |
2995 |
> |
printf("%15.9f %15.9f %15.9f\\\\n", |
2996 |
|
vert[0], vert[1], vert[2]); /* output vertex */ |
2997 |
|
} |
2998 |
< |
printf(";\\n"); /* end of face output */ |
2998 |
> |
printf(";\\\\n"); /* end of face output */ |
2999 |
|
return(MG_OK); /* normal exit */ |
3000 |
|
} |
3001 |
|
|
3129 |
|
#define MG_E_FACE 9 /* f */ |
3130 |
|
#define MG_E_INCLUDE 10 /* i */ |
3131 |
|
#define MG_E_IES 11 /* ies */ |
3132 |
< |
#define MG_E_IR 12 /* ir */ |
3132 |
> |
#define MG_E_IR 12 /* ir */ |
3133 |
|
#define MG_E_MATERIAL 13 /* m */ |
3134 |
|
#define MG_E_NORMAL 14 /* n */ |
3135 |
|
#define MG_E_OBJECT 15 /* o */ |
4306 |
|
.I pold, |
4307 |
|
scaling, rotating and moving it to its proper location, which is put in |
4308 |
|
.I pnew. |
4309 |
< |
(The two arguments may point to the same vector.)\0 |
4309 |
> |
(As for |
4310 |
> |
.I xf_xfmvect |
4311 |
> |
and |
4312 |
> |
.I xf_rotvect, |
4313 |
> |
the two arguments may point to the same vector.)\0 |
4314 |
|
.LP |
4315 |
|
The |
4316 |
|
.I xf_xfmvect |
4318 |
|
.I vold, |
4319 |
|
scaling and rotating it to its proper location, which is put in |
4320 |
|
.I vnew. |
4315 |
– |
(The two arguments may point to the same vector.)\0 |
4321 |
|
The only difference between |
4322 |
|
.I xf_xfmpoint |
4323 |
|
and |
4330 |
|
.I nold |
4331 |
|
using the current transformation, and stores the result in |
4332 |
|
.I nnew. |
4328 |
– |
(The two arguments may point to the same vector.)\0 |
4333 |
|
No translation or scaling is applied, which is the appropriate |
4334 |
|
action for surface normal vectors for example. |
4335 |
|
.LP |