Plotting N-gons with multi-valued vertex color data
2 views (last 30 days)
Show older comments
I have had success in the past using patch() to plot triangle data with nodal colors -- where the color at the node can differ depending on which triangle is using the node at the time. Think of this as plotting the X component of a surface normal vector -- where the surface has a sharp corner. Triangles with sides along the ridge will share nodes on the ridge -- but the normal vector component depends on which triangle.
This can be achieved with:
patch(x,y,z,c);
Where x,y,z,c are all [3 x n] -- where 3 is for the nodes in the triangles, not RGB.
I have also had success using patch() to plot arbitrary n-gon's like this:
patch('Faces',con,'Vertices',p)
Where con is [npoly x maxnode]
Where maxnode is the maximum number of vertices for any polygon and con is padded with NAN for any un-used nodes.
And where p is [nvert x 3]
This ('Faces','Vertices') approach seems to work for face-valued colors (one color per face) and for vertex-valued colors (one color per vertex), but not for multi-valued vertex colors.
Is there a way to plot a mix of N-gons, but with multi-valued colors at the vertices?
My best idea is to build up the patch(x,y,z,c) approach with x,y,z,c all [maxnode x npoly], with repeated data to pad any lesser N-gons up to the maximum number of nodes.
Are there any other ways? Perhaps using the patch structure directly?
3 Comments
Answers (0)
See Also
Categories
Find more on Graphics Performance in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!