MATLAB Answers

hatching a 3d patch object.

4 views (last 30 days)
Leo Simon
Leo Simon on 4 Jan 2017
Commented: Leo Simon on 4 Jan 2017
I'm wondering if anybody has built code for adding cross-hatches to a 3D patch object? I see that this task is on Kesh Ikuma's todo list for hatchfill2 but have been unable to find anything on the web that actually does it. I tried to make it work with Neil Tandon's hatchfill but was unsuccessful. Thanks!

Answers (1)

Jan on 4 Jan 2017
The hatching is defined in 2D usually. E.g. the pattern is determined by the angle between the X-axis and the lines. How do you want to expand this for the 3D case? What about using the texturemap method of a surface instead of a patch?
  1 Comment
Leo Simon
Leo Simon on 4 Jan 2017
Thanks very much for the suggestion, Jan. Unfortunately, my patches are vertical, as in:
x = [ 1 , 2 , 2, 1 ];
y = [ 2 , 1 , 1, 2 ];
z = [ 0 , 0 , 1 , 1 ];
hPatch = patch(x,y,z,'b');
hPatch.FaceAlpha = 0.2;
grid on
So I don't believe I can use a surface plot. I googled around for texturemap, but it doesn't look as though it applies to patches, and, besides, matlab's examples are so far from minimal that it's really hard to understand what's going on with the option setting.
Can you suggest another way? It doesn't have to be hatching, in particular, I just need something other than a solid color to identify the patch, so that, when I'm talking about my figure in the text, I can refer in to "the something vertical strip" and obviously, color won't work for print copies.

Sign in to comment.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!