7
$\begingroup$

I want to make a figure like this This is made in geogebra

In Mathematica 9, to fill it with a grid inside (and necessary without part of the grid outside), but to generate this picture, I need to graph two semicircles and a rectangle, so I don't know if its possible to do in Mathematica.

$\endgroup$
  • $\begingroup$ Have a look at the Circle and Disk commands. They have the possibility to include the third argument specifying the angles of the Circle/Disk opening. I would build first a rectangle and two half-disks at both ends, all with the Gray color and same Gray boundares. Then I would add on top two black lines and two half-circles, all in black in order to make the boundary in black. This does not address the grid part though. $\endgroup$ – Alexei Boulbitch Feb 8 '15 at 8:16
  • $\begingroup$ What do you mean by "grid"? $\endgroup$ – Jens Feb 8 '15 at 18:05
  • $\begingroup$ Like the notebooks' pages, like this: etc.usf.edu/clipart/42600/42677/grid_42677_lg.gif $\endgroup$ – MonsieurGalois Feb 12 '15 at 22:26
12
$\begingroup$

This should give you a head-start:

Mathematica graphics

With[{r = 0.025,
  x1 = 1.5,
  thick = 0.002},
 Graphics[{

   (* gray field *)
   LightGray,
   Disk[{x1, 0}, 1, {-Pi/2, Pi/2}],
   Disk[{-x1, 0}, 1, {Pi/2, 3 Pi/2}], Rectangle[{-x1, -1}, {x1, 1}],
   Black, Thickness[thick], 
   Line[{{{-x1, 1}, {x1, 1}}, {{-x1, -1}, {x1, -1}}}],
   Circle[{x1, 0}, 1, {-Pi/2, Pi/2}],
   Circle[{-x1, 0}, 1, {Pi/2, 3 Pi/2}],

   (* Lines *)
   Line[{{Cos[2.7], Sin[2.7]} - {x1, 0}, {-x1, 0}, {x1, 0}}],
   Line[{{-.3, 1}, {-.3, -1}}],

   (* Points and Label *)
   EdgeForm[Black], FaceForm[Red], 
   Disk[{-x1, 0}, r],
   Text[Style["LPK", 5, Red], {-x1, .08}],
   FaceForm[ColorData[1, 9]], Disk[{-.3, 0}, r],
   FaceForm[Darker@Gray], Disk[{-.3, 1}, r],
   FaceForm[Green], Disk[{x1, 0}, r],
   }]
 ]
$\endgroup$
1
$\begingroup$

StadiumShape can be used instead of two semicircles and a rectangle to render the gray field:

stadium = {LightGray, EdgeForm[Gray], StadiumShape[{{-1, 0}, {2, 0}}, 1]};
cols = {Red, Blue, Green, Black};
disks = Thread[{EdgeForm@Gray, cols, Disk[#, .03]&/@ {{-1, 0}, {0, 0}, {2, 0}, {0, 1}}}];
lines = {Gray, Line/@{{{Cos[5 Pi/6]-1, Sin[5 Pi/6]}, {-1,0}, {2,0}}, {{0,-1}, {0,1}}}};
rectangle = {Opacity[.25, Blue], EdgeForm[Thin], Rectangle[{0, 0}, {.15, .15}]};
labels = {Opacity[1], Black, 
  Text[Style[Subscript[d, 1], 10, Italic], 3 {Cos[5 Pi/6] - 1, Sin[5 Pi/6]}/4, Right], 
  Text[Style[Subscript[d, 2], 10, Italic], Offset[{-10, 10}, {0, .5}]], 
  Text[Style[Subscript[d, 3], 10, Italic], Offset[{-10, -10}, {0, -.5}]], 
  Text[Style[L, 10, Italic], Offset[{0, -10}, {1, 0}]], 
  Text[Style[G, 10, Italic], Offset[{10, 10}, {0, 1}]], 
  Text[Style[ATM, 10, Green], Offset[{10, 10}, {2, 0}]], 
  Text[Style[LPK, 10, Red], Offset[{10, 10}, {-1, 0}]]};

Graphics[{stadium, lines, disks, labels, rectangle}, Axes -> False, ImageSize -> 600]

enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.