I'm writing a vtk_patch function, that draws filled polygones. I could need a little help, since it does not work as expected. Convex patched are drawn ok (http://ocgmod1.marine.usf.edu/Octaviz/convex_patch.png) with the command:
vtk_patch([0 1 2 2.2 2 1 0 -.2 0],[0 -0.2 0 1 2 2.2 2 1 0 ],'g')
But concave patches (http://ocgmod1.marine.usf.edu/Octaviz/concave_patch.png) are problematic:
vtk_patch([0 1 2 1.8 2 1 0 0.2 0],[0 0.2 0 1 2 1.8 2 1 0 ],'b')
The right black triangle, should be gray (the background color) and in the lower part should be a transparent zone too.
I've been meaning to take a careful look at your suggested function, but I just haven't had the time yet. The key is to be very careful with the formation of the triangle cells. The problem you report is typical of misformed cells. I wonder if you can use the existing vtk_surf or vtk_trisurf within vtk_patch to perform the rendering. You should be able to send a carefully ordered set of points to vtk_surf to get what you want.
Jonathan
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi folks,
I'm writing a vtk_patch function, that draws filled polygones. I could need a little help, since it does not work as expected. Convex patched are drawn ok (http://ocgmod1.marine.usf.edu/Octaviz/convex_patch.png) with the command:
vtk_patch([0 1 2 2.2 2 1 0 -.2 0],[0 -0.2 0 1 2 2.2 2 1 0 ],'g')
But concave patches (http://ocgmod1.marine.usf.edu/Octaviz/concave_patch.png) are problematic:
vtk_patch([0 1 2 1.8 2 1 0 0.2 0],[0 0.2 0 1 2 1.8 2 1 0 ],'b')
The right black triangle, should be gray (the background color) and in the lower part should be a transparent zone too.
The source of vtk_patch is at:
http://ocgmod1.marine.usf.edu/Octaviz/vtk_patch.m
Any help is appreciated.
Alex
I've been meaning to take a careful look at your suggested function, but I just haven't had the time yet. The key is to be very careful with the formation of the triangle cells. The problem you report is typical of misformed cells. I wonder if you can use the existing vtk_surf or vtk_trisurf within vtk_patch to perform the rendering. You should be able to send a carefully ordered set of points to vtk_surf to get what you want.
Jonathan