Re: Smarter 3D listplot clipping
- To: mathgroup at smc.vnet.net
- Subject: [mg15978] Re: Smarter 3D listplot clipping
- From: Dan Truong <dtruong at irisa.fr>
- Date: Fri, 19 Feb 1999 03:27:01 -0500
- Organization: Irisa, Rennes (FR)
- References: <7ag4ib$b0i@smc.vnet.net> <36CBDED3.739F1E5B@theorie3.physik.uni-erlangen.de>
- Sender: owner-wri-mathgroup at wolfram.com
ListSurfacePlot3D is almost a nice idea, except it doesn't
work as is for my goal (I explain below how to call
ListSurfacePlot3D for those who don't know the function):
ListSurfacePlot3D[{{ {1,1,1},{2,1,1},{3,1,2},{4,1,2}},
{{1,2,1},{2,2,1},{3,2,2},{4,2,2}},
{{1,3,2},{2,3,2},{3,3,2},{4,3,2}},
{{1,4,2},{2,4,2},{3,4,2},{4,4,2}}
}
]
is OK, but
ListSurfacePlot3D[{{ {3,1,2},{4,1,2}},
{{3,2,2},{4,2,2}},
{{1,3,2},{2,3,2},{3,3,2},{4,3,2}},
{{1,4,2},{2,4,2},{3,4,2},{4,4,2}}
}
]
is not!
The difference between the 2 plots is that I removed
the points where z == 1 (our goal here).
This generates a matrix transposition error :(
when running.
We can cancel this error by leaving the unwanted
{} empty instead of removing them.
Therefore, we must move the points to make invisible
polygons (ie align the 4 points). My solution is to
do it systematically, by shifting the unwanted points
by x+1, y+1, zvalue in [[x+1,y+1]].
This is OK to hide z==1:
ListSurfacePlot3D[{
{ {3,3,2},{3,2,2},{3,1,2},{4,1,2}},
{{2,3,2},{3,3,2},{3,2,2},{4,2,2}},
{{1,3,2},{2,3,2},{3,3,2},{4,3,2}},
{{1,4,2},{2,4,2},{3,4,2},{4,4,2}}
}
]
(* algorithm is something like
If[ Z == 1, ReplacePart[tab[[i,j]],tab[[i+1,j+1]], i+1, j+1 ]
or if I find a way to apply /; on arrays something similar to:
Bar = foo /; (foo[[i,j,3]] != 1)
Bar = foo[[i+1,j+1]] /; (foo[[i,j,3]] == 1)
I am missing the () ? : operator of C
A = (b>c) ? b : c; // ie a is lowest between b and c
*)
How ListSurfacePlot3D[] works:
------------------------------
ListSurfacePlot3D[] needs a list made of rows of
{x,y,z} points.
A-B
/ /
C-D
would be done with a list like: {{C,D},{A,B}}
where C=={1,1,1} etc.
Therefore plotting the square with z=1 for all points,
ie plotting {{1,1},{1,1}} would go like:
ListSurfacePlot3D[{{{1,1,1},{2,1,1}},{{2,1,1},{2,2,1}}}];
or
ListPlot3D[{{1,1},{1,1}]; (*X,Y coodinates are implicit therefore
unalterable, note that point C == 1 only, X,Y unspecified *)