hiding lines in GRAPHPAK 3d objects
Author Message
hiding lines in GRAPHPAK 3d objects

I've been using the 3D drawing feature in APL2's GRAPHPAK.  Is there a
way to hide hidden lines?  When I draw a sphere, the lines on the
other side of the sphere show through.  I'd like to make the 3-d
images more realistic.

Wed, 23 Jun 2004 14:31:48 GMT
hiding lines in GRAPHPAK 3d objects
Bernard,

I don't think Graphpak's 3d object drawing facilities support hidden line
removal.  But, I've asked one of the original developers if he has an
enhancement in his private version that does it.  I'll let you know what he
says.

David Liebtag

Wed, 23 Jun 2004 15:35:45 GMT
hiding lines in GRAPHPAK 3d objects
David Liebtag is correct: None of Graphpak's 3D functions or even the 3D
component "SKETCH-matrix" (attribute column + xyz) are designed to handle
hidden-line or -surface removal.  On the other hand, if all of the objects
that you want to render are convex polyhedra (as is your sphere).  It's very
easy to write a preparatory APL function that removes component hidden
surfaces, producing data that includes only visible surface components.
Then Graphpak's SKETCH, etc. can handle it.  (A long, long time ago -- prior
to 1972 -- I designed and visualize my very own personal geodesic dome.)

Here is what you need to do (and it's a fun project):  Define your
polyhedron as collections of convex polygons in a manner that makes
calculating polygon normal vectors easy.  (For example, using the first
three vertexes to define the normal vector.)  Be consistent in how you
define the normal vectors so that you can use the sign of a normal vector's
inner product with a view direction vector:
(x y z 1) +.x (X Y Z 1)
to determine if the polygon is facing toward the viewer (visible) or away
from the viewer (hidden).  Remove any hidden polygons or lines associated
with hidden polygons from the data.  Then, from the remaining data,
structure a standard GRAPHPAK SKETCH matrix.

The general hidden line or hidden surface removal problems are much more
difficult -- when the polyhedra are not convex.  Lots of people have used
the topic for PhD theses, some failing miserably, others fizzling.

If your problem is the general, non-convex one, and you are very serious
about your project and want to invest a great deal of time, I can think of
two options, both of which involve interfacing with other software:

1.  Prepare your data to interface with a software product that handles the
3D problem.  There's stuff out there, but you've got to look a lot to find
one that matches your requirements (\$0-1500).
2.  Take a look at how you might interface with an API that handles the
problem, which is how I have dabbled.  For example,
http://home.stny.rr.com/wniehoff/apl/opengl.htm .

But, if your problem is as simple and specialized as you have described it,
I'd recommend that you handle it the way I described handling geodesic
domes.

Walt Niehoff

P.S., Graphpak and APL proved perfectly adequate for the geometric design of
my 28-foot-diameter dome.  (Disassembled, it fit into the trunk of my 1966
Austin-Healy Sprite.)  But, I must confess that I never used APL to do a
structural analysis.  The result was that, on an occasion when I attempted
to climb it in order to test it, it collapsed.  A few years later, when I
repaired it and used it to store firewood, it collapsed again due to a snow