4
$\begingroup$

I want to draw a rectangle and have one of the edges not drawn

Manipulate[Graphics[{
{Gray,Disk[{0,0},2]},
Circle[{0,0},2+#]&/@Range[k],
EdgeForm[{Thin}], White,
Rectangle[{-2-k,2+k},{0,2+k-1}]
}],{k,2,10,1}]

enter image description here

The right edge in this case to have a visual effect of a wire unwinding, like this:

enter image description here

$\endgroup$
  • 1
    $\begingroup$ I would build my own replacement for Rectangle using an edgeless Rectangle and Line as needed, e.g. mathematica.stackexchange.com/a/10498/121 $\endgroup$ – Mr.Wizard Nov 14 '16 at 8:35
  • $\begingroup$ I wanted to see some elegant solution to not draw the edge, but thanks - overlaping Rectangle with a Line worked. $\endgroup$ – grandrew Nov 14 '16 at 9:00
0
$\begingroup$

This looks OK to me. Will it work for you?

Manipulate[
  Graphics[
    {{Gray, Disk[{0, 0}, 2]},
     AbsoluteThickness[2], Circle[{0, 0}, 2 + #] & /@ Range[k],
     White, EdgeForm[{AbsoluteThickness[2], Black}], 
       Polygon[{{0, 2 + k}, {-2 - k, 2 + k}, {-2 - k, 2 + k - 1}, {0, 2 + k - 1}}],
    {AbsoluteThickness[4], Line[{{0, 2 + k}, {0, 2 + k - 1}}]},
    Black, 
      Line[{{-.02 k, 2 + k}, {.02 k, 2 + k}}], 
      Line[{{-.02 k, 2 + k - 1}, {.02 k, 2 + k - 1}}]}],
  {k, 2, 10, 1, Appearance -> "Labeled"}]

demo

$\endgroup$
0
$\begingroup$

Try this:

Manipulate[
 Show[{
   Graphics[{{Gray, Disk[{0, 0}, 2]}, 
     Circle[{0, 0}, 2 + #] & /@ Range[k], EdgeForm[{Thin}], White, 
     Rectangle[{-2 - k, 2 + k}, {0, 2 + k - 1}]}],
   Graphics[{White, EdgeForm[White], 
     Rectangle[{-0.001, 2 + k}, {0.001, 2 + k - 1}]}]
   }], {k, 2, 10, 1}]

with the effect as follows:

enter image description here

Have fun!

$\endgroup$
  • $\begingroup$ This produces an image of unacceptable quality as the rectangle with offset also "wipes" the cirle edges a bit. I tried overlapping a white rectangle with Line[] but that is also not what I wanted to have to further manipulate. Isn't there a "proper" way to just not draw an edge? $\endgroup$ – grandrew Nov 14 '16 at 8:59
  • 1
    $\begingroup$ @grandrew "Isn't there a "proper" way to just not draw an edge?" Not that I know. You may also add points to my solution on top of the rectangle to cover the edges. Or you may alternatively add a white line on top of your rectangle and play with its thickness and length to cover the edge, but this is in fact goes into a direction that Mr. Wizard proposed. You may also add a rectangle like you did, but not only fix its bulk to be white, but also its edges: EdgeForm[White], and then on top of it you may draw a line covering those three edges of the rectangle that you need. $\endgroup$ – Alexei Boulbitch Nov 14 '16 at 9:10

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.