image thumbnail

Hatchfill2

version 3.0.0.0 (58.3 KB) by Kesh Ikuma
Fills an area with hatching or speckling (Updating original hatchfill by Neil Tandon)

4.2K Downloads

Updated 11 Jan 2018

View License

This submission updates the popular submission (#30733) by Neil Tandon to place hatching pattern on patch objects. The main algorithm to form hatching pattern remains mostly the same as the original while more formatting options are exposed to the user and hatchfill2 brings the support for HG2 graphics system (since R2014b).
Features:
* Supported base graphics objects: PATCH, HGGROUP, AREA, BAR, and CONTOUR objects are additionally supported. Pre-HG2 (pre-R2014b) MATLAB releases are no longer supported.
* Supports 3D surfaces. Note: Hatching would not come out correctly on a curved surface.
* Four types of hatching patterns:
- 'single' single lines
- 'cross' double-crossed hatch
- 'speckle' speckling inside the patch boundary (partial support)
- 'outspeckle' speckling outside the boundary (partial support)
* User-definable options are now set via parameter name/value pair input argument interface. Options include HatchAngle, HatchDensity, HatchOffset, HatchColor, HatchLineStyle, HatchLineWidth, SpeckleMarkerStyle, and SpeckleFillColor
* Active formatting - the hatch line object listens to the changes in the patch object or axes to keep the hatching true to user options all the time (sans print support at this time)
* Basic graphics object properties (Visible, Clipping, HitTest, Interruptible, BusyAction, and UIContextMenu) of the hatch line object are synchronized to the base patch object. Only Visible property can be de-linked by setting HatchVisible option to either 'on' or 'off'.

Note:
* Speckling multi-face PATCH and HG2 CONTOUR is not implemented correctly. If anyone needs this feature fixed, post a request and I'll see what I can do.

ToDo's:
* Print support - implementing "printmode" similar to lateximage
* Multi-face speckle support - eliminating all the interior edges in gethgdata
* Legend support - HG2 is making this really challenging if not impossible. Users suggest using legendflex (FEX#31092 or at https://github.com/kakearney/legendflex-pkg). See the comments below by Drecalde & SeungHyoung Ryu for how-to. Thanks guys!!

Cite As

Kesh Ikuma (2021). Hatchfill2 (https://www.mathworks.com/matlabcentral/fileexchange/53593-hatchfill2), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2017a
Compatible with any release
Platform Compatibility
Windows macOS Linux
Acknowledgements

Inspired by: Hatchfill, lateximage

Inspired: stipple

Community Treasure Hunt

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

Start Hunting!