Thread Subject: Triangular facets on a cylinder

Subject: Triangular facets on a cylinder

From: Travis

Date: 6 Nov, 2007 17:13:17

Message: 1 of 4

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

Subject: Triangular facets on a cylinder

From: Michael Garrity

Date: 6 Nov, 2007 19:28:10

Message: 2 of 4

"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-

Subject: Triangular facets on a cylinder

From: Travis

Date: 6 Nov, 2007 19:47:32

Message: 3 of 4

>
> 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-
>
>

That's a good idea, I will give that a shot for my cylinder.

My next step is to extend on this and create 3D bodies by
rotating a curve around an axis. These will also need to
have triangular facets. Any suggestions on facetizing more
complex 3D geometries?

Subject: Triangular facets on a cylinder

From: Travis

Date: 6 Nov, 2007 20:14:53

Message: 4 of 4

"Travis " <traviib.nospam.@yahoo.com> wrote in message
<fgqgck$scp$1@fred.mathworks.com>...
> >
> > 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-
> >
> >
>
> That's a good idea, I will give that a shot for my cylinder.
>
> My next step is to extend on this and create 3D bodies by
> rotating a curve around an axis. These will also need to
> have triangular facets. Any suggestions on facetizing more
> complex 3D geometries?
>
>

I think I found it: surf2patch seems to solve my problem
(with the 'triangles' flag)

Tags for this Thread

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

rssFeed for this Thread

Contact us at files@mathworks.com