Code covered by the BSD License  

Highlights from
crosshatch_poly

2.0

2.0 | 2 ratings Rate this file 5 Downloads (last 30 days) File Size: 11.99 KB File ID: #24799
image thumbnail

crosshatch_poly

by Matthew Roughan

 

21 Jul 2009 (Updated 22 Jul 2009)

crosshatch_poly fills a polygon with slanted lines at a specified angle and separation.

| Watch this File

File Information
Description

crosshatch_poly fills a polygon with slanted lines at a specified angle and separation. It is similar in concept to fill, except that the fill is a hatching, or just lines.

For example see the plot which was generated by the included file crosshatch_poly_test.m

It allows multiple overlapping hatching on different polygons, and can even be used to obtain a speckled affect. It has a fair number of options for different line styles, colors, widths, and background colors.

The one major limitation at present is that it can only be applied to convex polygons.

MATLAB release MATLAB 7.4 (R2007a)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (2)
30 Sep 2009 Olivier Planchon

As documented, only convex shapes are supported.

01 Jun 2010 David Wozabal

This seems to be a very nice function in principle.

However, I noticed that it stops working if the axis are on a different scale (in particular the angle of the hatching is always 90°, independent of the respective parameter).

EXAMPLE (modified from crosshatch_poly_test.m)
--------------------------------------------------------------------
x = 2 + [0 3 3 0];
y = 1 + [0 0 3 3];

%%%% SIMPLE EXAMPLE
figure(1)
[h,g] = crosshatch_poly(x*1000, y, 30, 0.25*1000, ...
'edgestyle', '-', 'edgecolor', 'b', 'edgewidth', 2, ...
'linestyle', '--', 'linecolor', 'r', 'linewidth', 1);
set(gca, 'xlim', [0 7*1000]);
set(gca, 'ylim', [0 7]);
axis square
-----------------------------------------------------------------------------

Please login to add a comment or rating.
Updates
22 Jul 2009

Typo in input arguments parsing is fixed. Thanks to Darren Rowland for finding it.

Tag Activity for this File
Tag Applied By Date/Time
hatch Matthew Roughan 21 Jul 2009 10:36:40
hatching Matthew Roughan 21 Jul 2009 10:36:40
fill Matthew Roughan 21 Jul 2009 10:36:40
polygons Matthew Roughan 21 Jul 2009 10:36:40
graphics Matthew Roughan 21 Jul 2009 10:36:40
specialized plots Matthew Roughan 21 Jul 2009 10:36:40
self_rating Matt Fig 21 Jul 2009 19:52:08

Contact us at files@mathworks.com