|
"Travis " <traviib.nospam.@yahoo.com> wrote in message news:fgq7bc$j6d$1@fred.mathworks.com...
> Hi all,
>
> I am trying to create a cylinder with a mesh that has
> triangular facets (instead of the four vertex default mesh
> as seen in the cylinder function). I've been successful in
> accomplishing this with a cone and using delaunay
> triangulation through the following process:
> [cx cy cz] = make_cone(); % my own function to give
> vertices.. or use cylinder with [1 0] as input args
> tri = delaunay(cx,cy);
> trimesh(tri,cx,cy,cz)
>
> This doesn't seem to work with a cylinder (the resulting
> triangulation results in a 2-D facetized circle instead of
> 3D) and I think it's because of the duplicated X and Y
> vertex values?
>
> Any idea how to create this on the 3D cylindrical surface?
>
> Thanks,
> Travis
Delaunay is a pretty big gun for something as regular
as a cylinder. Look at what cylinder gives you in the
3 return arg case:
[x y z] = cylinder
You can see pretty clearly that it's giving you a 2xN
array of coordinates. You can give this to the patch
object like this:
p = patch('vertices',[x(:) y(:) z(:)], ...
Then you just need to come up with the right values
for the patch's faces property to connect the correct
vertices. The pattern is pretty simple. It starts out like
this:
'faces', [1 3 2; 2 3 4; 3 5 4; 4 5 6; ...
You connect 2 vertices from one row to one from the other
row. Then you do the opposite. Then you move over one
and repeat. You can probably take it from there.
The section pf the doc labeled "Multifaceted Patches" will
probably be useful here.
-MPG-
|