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: Wed, 14 Mar 2007 13:44:13 +0100 (CET)

Okay, I've put together a little example, which I've attached.  
Something's wrong with Savannah, so I can't upload a new snapshot, 
and I don't want to get the snapshot there out of synch with the 
one on the other server.  I've attached a new `sample0.ldf' file, 
a new `3DLDFtex.tex' file, and the output in `3DLDFtex.ps'.

The idea is to find out what faces can be seen by labelling them
and then fill them by hand.  Sorry, but that's the best I can do
at present.

On Tue, 13 Mar 2007, Laurence Finston wrote:

> Sorting isn't probably not going to work.  The only way to do what you 
> want is to fill the faces individually.  This isn't very satisfactory if 
> you're making an animation with many images.  The reasons why sorting 
> alone won't work are documented in the manual.  

Sorting doesn't work because only the minimum, maximum, or mean 
z-values of each object are checked.  The
program doesn't check whether objects overlap.  The most
straightforward way of doing this would be to test every object
against every other object.  If they overlap or intersect, it would be
necessary to divide them into smaller objects until none overlap.  I
started working on this but ran out of time and money.  It would be
possible to cull some cases where overlapping isn't possible.
However, there is no way to avoid examining every object on a
`picture'. 

I don't remember what effect the `with_surface_hiding' has, but I do
remember that I didn't finish what I was working on, i.e., dividing or
"decomposing" objects.  

The usual kind of surface hiding doesn't work this way.  This is a
vector method, whereas surface hiding is usually implemented on the
raster level.  It requires finding ways of decomposing objects, which
is one reason I've concentrated on algebraic curves.  Even finding the
intersections of the quadric curves isn't easy, and I'm no
mathematician.  Unfortunately, my personal circumstances are such that
I don't know whether I'll ever be able to implement this, although I
would like to very much.

I hope you're able to work around these limitations.

Sorry, I just noticed your code sample below.  If you still have any
questions, please feel free to ask.

Laurence


> > Hi guys! I just started using this cool program for my master's thesis
> > report. Need a little help:
> > 
> 
> I have to leave very soon to catch my bus, but I just want to give you a 
> quick answer first.  I'll explain in detail tomorrow.  
> 
> Sorting isn't probably not going to work.  The only way to do what you 
> want is to fill the faces individually.  This isn't very satisfactory if 
> you're making an animation with many images.  The reasons why sorting 
> alone won't work are documented in the manual.  
> 
> I would like nothing better than to implement proper surface hiding, but 
> it's not possible at the moment.
> 
> Will get back to you.
> 
> Laurence
> 
> 
> 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
> > 
> > output save_picture with_projection parallel_x_z;
> > 
> > but when I use
> > 
> > output save_picture with_focus f;
> > 
> > or
> > 
> > output save_picture with_focus f with_surface_hiding mean_z_sort;
> > 
> > the surfaces are not sorted, or sorted incorrectly - I'm not sure which.
> > 
> > I use the 1.2.0.0 snapshot version from 3DLDFsnp.tar.gz.
> > 
> > 
> > Per
> > 
> > ldf file source follows:
> > 
> > ---------------------------------------------------------
> > 
> > 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);
> > 
> > %polyhedron c;
> > %c := unit_icosahedron scaled 0.6;
> > cuboid c;
> > c := unit_cuboid;
> > 
> > filldraw c with_draw_color blue with_fill_color green;
> > show c;
> > 
> > save_picture := current_picture;
> > 
> > clear current_picture;
> > 
> > output save_picture with_projection parallel_x_z;
> > output save_picture with_focus f with_surface_hiding mean_z_sort;
> > output axis_picture with_focus f;
> > endfig with_focus f;
> > 
> > verbatim_metapost "end";
> > 
> > end;
> > 
> > 
> > _______________________________________________
> > help-3dldf mailing list
> > address@hidden
> > http://lists.gnu.org/mailman/listinfo/help-3dldf
> > 
> > 
> 
> 
> _______________________________________________
> help-3dldf mailing list
> address@hidden
> http://lists.gnu.org/mailman/listinfo/help-3dldf
> 

Attachment: dtemp.tar.gz
Description: Binary data


reply via email to

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