help-3dldf
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [help-3dldf] How to z-sort the polygons of a cuboid using with_focus


From: Laurence Finston
Subject: Re: [help-3dldf] How to z-sort the polygons of a cuboid using with_focus
Date: Fri, 16 Mar 2007 17:29:33 +0100 (CET)

On Tue, 13 Mar 2007, scientist47 wrote:

> Hi guys! I just started using this cool program for my master's thesis
> report. Need a little help:
> 
> I have managed to filldraw the cuboid and other solid shapes with
> 

[...]

Just in case you're interested, I've made a few changes to your code and 
got it to work by hand using the same method described before.  The 
following sample is now at the top of `sample0.ldf'.  Savannah is back up 
again, so I've uploaded the changed files and a new snapshot.  The 
PostScript output is attached to this message.

Laurence

%% *** (3) Filldrawing a cuboid.
%%         LDF 2007.03.16.

verbatim_metapost "verbatimtex \magnification=\magstep3 etex";

picture axis_picture;
picture save_picture;

point axis_pt[];

focus f;
set f with_position (10, -5, 2)
       with_direction (0, 2, 0)
       with_distance 100;

pickup pencircle scaled (.5mm, .5mm);

axis_y_rt    := 1;
axis_z_top   := 1;
axis_x_front := 1;

axis_pt0 := (axis_y_rt, 0, 0);
axis_pt1 := (0, axis_z_top, 0);
axis_pt2 := (0, 0, -axis_x_front);

drawarrow origin -- axis_pt0 on_picture axis_picture;
drawarrow origin -- axis_pt1 on_picture axis_picture;
drawarrow origin -- axis_pt2 on_picture axis_picture;

label.bot("y", axis_pt0) axis_picture;
label.rt("z", axis_pt1) axis_picture;
label.lft("x", axis_pt2) axis_picture;

%pickup pencircle scaled (.1mm, .1mm);

beginfig(0);

cuboid c;
c := unit_cuboid;

rectangle r[];

for i = 0 upto 5:
   r[i] := get_rectangle (i) c;
%%   label(i, get_center r[i]);
endfor;

filldraw r0 with_draw_color blue with_fill_color green;
filldraw r2 with_draw_color blue with_fill_color green;
filldraw r4 with_draw_color blue with_fill_color green;

save_picture := current_picture;
clear current_picture;

output save_picture with_projection parallel_x_z;
output axis_picture with_projection parallel_x_z;

output save_picture with_focus f no_sort;

output axis_picture with_focus f no_sort;

endfig;

verbatim_metapost "end";

end;

Attachment: 3DLDFtex.ps.gz
Description: Binary data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]