Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
User interface for drawing 2D mesh regions
ResourceFunction["RegionInputField"][Dynamic[var]] creates a user interface for drawing a MeshRegion which updates var. |
Draw the outline of the desired region:
In[1]:= |
Out[1]= |
Draw additional areas which will be included in the same region:
Out[1]= |
Set the SetterBar to "Remove" to subtract drawn areas from the region:
Out[1]= |
The Dynamic variable is updated with the drawn region:
In[2]:= |
Out[2]= |
RegionInputField supports the options of RegionPlot. These affect the appearance of interface but not the output Region:
In[3]:= |
Out[3]= |
The default PlotRange is {{0,1},{0,1}} which limits the coordinates that you can draw over. To create regions with larger coordinates, set the PlotRange for the RegionInputField:
In[4]:= |
Out[4]= |
A Graphics object can be provided as a background image, in which case default options such as PlotRange and ImageSize are inherited from the provided image:
In[5]:= |
Out[5]= |
"BackgroundImage" can also be an Image:
In[6]:= |
Out[6]= |
In[7]:= |
Out[7]= |
This work is licensed under a Creative Commons Attribution 4.0 International License