Message Boards Message Boards

2 Replies
0 Total Likes
View groups...
Share this post:

How to enrich a region with extra drawing primitives?

Posted 10 years ago

I have a Region defined and want to display this with extra graphical primitives. Please see the following code:

In[137]:= area = RegionUnion[Disk[{0, 0}, 2], Disk[{3, 0}, 3]];
In[138]:= stuff = List[Point[{0, 0}], Point[{3, 0}], Line[{{0, 0}, {3, 0}}]];
In[139]:= Graphics[stuff]
In[140]:= DiscretizeRegion[area]

What do i have to do to get the output into one picture? I tried a lot, but i don't have a real plan. Any help is highly appreciated!

POSTED BY: Thomas Vogler
2 Replies

* Face palm *

Facepalm from Wikipedia

Show[DiscretizeRegion[area], Graphics[stuff]]

does what i want. But i don't understand why and how this works. Any pointers are welcome.

POSTED BY: Thomas Vogler

I learned something new....

MeshReigons are new objects in Mathematica 10. E.g., from your example, the Head of DiscretizeRegion

 DiscretizeRegion[area] // Head



So it is not a Graphics though its OutputForm is to display it graphically, which makes good sense. To get the graphics primitives from a MeshReigon in order to use them in a Graphics directly you can use MeshPrimitives to extract them from the MeshReigon itself as in

Graphics[{stuff, EdgeForm[{Thick, Green}], 
  MeshPrimitives[DiscretizeRegion[area], 1], FaceForm[LightPurple], 
  MeshPrimitives[DiscretizeRegion[area], 2]}]
POSTED BY: David Reiss
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
or Discard

Group Abstract Group Abstract