Is it possible to draw a hollow circle using polygon?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
1
down vote

favorite












The question is simple. I have the following commands



r = 0.24;
R = 0.25;

unitcircle =
Table[Sin[[Theta]], Cos[[Theta]], [Theta], 2 [Pi], 0, -[Pi]/
40] // N;
incircle = r*unitcircle;
outcircle = R*unitcircle;


which define the outer points and inner points of a hollow circle. Is it possible to draw such a hollow circle using the polygon command?










share|improve this question

















  • 3




    Kind of yes, but should you? No. See Annulus and if it should be a polygon take a look at FilledCurve.
    – Kuba♦
    5 hours ago











  • But, with the command polygon no. right? something like playing with the points that you input to Polygon?
    – Msen Rezaee
    5 hours ago















up vote
1
down vote

favorite












The question is simple. I have the following commands



r = 0.24;
R = 0.25;

unitcircle =
Table[Sin[[Theta]], Cos[[Theta]], [Theta], 2 [Pi], 0, -[Pi]/
40] // N;
incircle = r*unitcircle;
outcircle = R*unitcircle;


which define the outer points and inner points of a hollow circle. Is it possible to draw such a hollow circle using the polygon command?










share|improve this question

















  • 3




    Kind of yes, but should you? No. See Annulus and if it should be a polygon take a look at FilledCurve.
    – Kuba♦
    5 hours ago











  • But, with the command polygon no. right? something like playing with the points that you input to Polygon?
    – Msen Rezaee
    5 hours ago













up vote
1
down vote

favorite









up vote
1
down vote

favorite











The question is simple. I have the following commands



r = 0.24;
R = 0.25;

unitcircle =
Table[Sin[[Theta]], Cos[[Theta]], [Theta], 2 [Pi], 0, -[Pi]/
40] // N;
incircle = r*unitcircle;
outcircle = R*unitcircle;


which define the outer points and inner points of a hollow circle. Is it possible to draw such a hollow circle using the polygon command?










share|improve this question













The question is simple. I have the following commands



r = 0.24;
R = 0.25;

unitcircle =
Table[Sin[[Theta]], Cos[[Theta]], [Theta], 2 [Pi], 0, -[Pi]/
40] // N;
incircle = r*unitcircle;
outcircle = R*unitcircle;


which define the outer points and inner points of a hollow circle. Is it possible to draw such a hollow circle using the polygon command?







graphics graphics3d polygons drawing






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked 5 hours ago









Msen Rezaee

39228




39228







  • 3




    Kind of yes, but should you? No. See Annulus and if it should be a polygon take a look at FilledCurve.
    – Kuba♦
    5 hours ago











  • But, with the command polygon no. right? something like playing with the points that you input to Polygon?
    – Msen Rezaee
    5 hours ago













  • 3




    Kind of yes, but should you? No. See Annulus and if it should be a polygon take a look at FilledCurve.
    – Kuba♦
    5 hours ago











  • But, with the command polygon no. right? something like playing with the points that you input to Polygon?
    – Msen Rezaee
    5 hours ago








3




3




Kind of yes, but should you? No. See Annulus and if it should be a polygon take a look at FilledCurve.
– Kuba♦
5 hours ago





Kind of yes, but should you? No. See Annulus and if it should be a polygon take a look at FilledCurve.
– Kuba♦
5 hours ago













But, with the command polygon no. right? something like playing with the points that you input to Polygon?
– Msen Rezaee
5 hours ago





But, with the command polygon no. right? something like playing with the points that you input to Polygon?
– Msen Rezaee
5 hours ago











3 Answers
3






active

oldest

votes

















up vote
4
down vote



accepted










Polygon is always filled (it can be filled with white). Use Circle for a "hollow" circle.



r = 0.24; R = 0.25;

Graphics[Circle[0, 0, #] & /@ r, R]


enter image description here



Graphics[EdgeForm[Black], White, Polygon[CirclePoints[#, 50]] & /@ R, r]


enter image description here



Note that since the polygons are filled, the smaller circle must be drawn on top (last) to be seen.



EDIT: For a red background, either



Graphics[White, Annulus[0, 0, r, R], Background -> Red]


enter image description here



Or,



Graphics[White, Polygon[CirclePoints[R, 50]], Red, 
Polygon[CirclePoints[r, 50]], Background -> Red]


enter image description here



You could also use EdgeForm to make the borders more distinct.






share|improve this answer






















  • thanks a lot for the answer
    – Msen Rezaee
    5 hours ago










  • @MsenRezaee the question is, what do you expect to see if there is e.g. a red background.
    – Kuba♦
    4 hours ago










  • @Kuba I expect to see red everywhere except on the thin surface of my circle
    – Msen Rezaee
    4 hours ago











  • @MsenRezaee that is unclear for me. What should be between those black edges, and what should be inside the inner edge.
    – Kuba♦
    4 hours ago










  • @Kuba in the case of a red background, I expect to see red outside the outer edge and inside the inner edge. But not on the thin surface of the circle.
    – Msen Rezaee
    4 hours ago

















up vote
1
down vote













FilledCurve can be used to achieve polygons (but also Bezier curves and B-splines) with holes (here formed by a two very circle-like polygons). It's a bit convoluted in this case. Red line on background for illustrative purposes:



Graphics[Thick, Red, Line[.25 -1, -1, 1, 1],
FaceForm@White, EdgeForm@Black,
FilledCurve[
List@*Line /@
Table[r Sin[a], Cos[a], r, .24, .25, a, 0, 2 Pi, Pi/50]]]


enter image description here






share|improve this answer





























    up vote
    1
    down vote













    Here's one way:



    outer = CirclePoints[2, 100];
    AppendTo[outer, First[outer]];
    inner = CirclePoints[1, 100];
    AppendTo[inner, First[inner]];
    Graphics@Polygon[Join[inner, Reverse[outer]]]


    Mathematica graphics



    A hollow annulus is trickier:



    Graphics[
    FaceForm,
    EdgeForm[Black],
    Polygon[Join[inner, Reverse[outer]]],
    White, Thickness[0.01],
    Line[1.03 First[inner], 0.985 First[outer]]
    ]


    Mathematica graphics



    I couldn't get away with just a polygon for this one, I had to cover up the line from where the inner circle connects to the outer. Had I done this with a polygon it would still be two polygons and not one. We can also draw another polygon like the first one here above in white to make the first one appear hollow.



    As an aside, I see that Annulus has been mentioned but no one has shown how to make it hollow as far as I can tell:



    Graphics[
    FaceForm,
    EdgeForm[Black],
    Annulus
    ]


    Mathematica graphics






    share|improve this answer






















      Your Answer




      StackExchange.ifUsing("editor", function ()
      return StackExchange.using("mathjaxEditing", function ()
      StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix)
      StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["$", "$"], ["\\(","\\)"]]);
      );
      );
      , "mathjax-editing");

      StackExchange.ready(function()
      var channelOptions =
      tags: "".split(" "),
      id: "387"
      ;
      initTagRenderer("".split(" "), "".split(" "), channelOptions);

      StackExchange.using("externalEditor", function()
      // Have to fire editor after snippets, if snippets enabled
      if (StackExchange.settings.snippets.snippetsEnabled)
      StackExchange.using("snippets", function()
      createEditor();
      );

      else
      createEditor();

      );

      function createEditor()
      StackExchange.prepareEditor(
      heartbeatType: 'answer',
      convertImagesToLinks: false,
      noModals: false,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: null,
      bindNavPrevention: true,
      postfix: "",
      onDemand: true,
      discardSelector: ".discard-answer"
      ,immediatelyShowMarkdownHelp:true
      );



      );













       

      draft saved


      draft discarded


















      StackExchange.ready(
      function ()
      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmathematica.stackexchange.com%2fquestions%2f182093%2fis-it-possible-to-draw-a-hollow-circle-using-polygon%23new-answer', 'question_page');

      );

      Post as a guest






























      3 Answers
      3






      active

      oldest

      votes








      3 Answers
      3






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes








      up vote
      4
      down vote



      accepted










      Polygon is always filled (it can be filled with white). Use Circle for a "hollow" circle.



      r = 0.24; R = 0.25;

      Graphics[Circle[0, 0, #] & /@ r, R]


      enter image description here



      Graphics[EdgeForm[Black], White, Polygon[CirclePoints[#, 50]] & /@ R, r]


      enter image description here



      Note that since the polygons are filled, the smaller circle must be drawn on top (last) to be seen.



      EDIT: For a red background, either



      Graphics[White, Annulus[0, 0, r, R], Background -> Red]


      enter image description here



      Or,



      Graphics[White, Polygon[CirclePoints[R, 50]], Red, 
      Polygon[CirclePoints[r, 50]], Background -> Red]


      enter image description here



      You could also use EdgeForm to make the borders more distinct.






      share|improve this answer






















      • thanks a lot for the answer
        – Msen Rezaee
        5 hours ago










      • @MsenRezaee the question is, what do you expect to see if there is e.g. a red background.
        – Kuba♦
        4 hours ago










      • @Kuba I expect to see red everywhere except on the thin surface of my circle
        – Msen Rezaee
        4 hours ago











      • @MsenRezaee that is unclear for me. What should be between those black edges, and what should be inside the inner edge.
        – Kuba♦
        4 hours ago










      • @Kuba in the case of a red background, I expect to see red outside the outer edge and inside the inner edge. But not on the thin surface of the circle.
        – Msen Rezaee
        4 hours ago














      up vote
      4
      down vote



      accepted










      Polygon is always filled (it can be filled with white). Use Circle for a "hollow" circle.



      r = 0.24; R = 0.25;

      Graphics[Circle[0, 0, #] & /@ r, R]


      enter image description here



      Graphics[EdgeForm[Black], White, Polygon[CirclePoints[#, 50]] & /@ R, r]


      enter image description here



      Note that since the polygons are filled, the smaller circle must be drawn on top (last) to be seen.



      EDIT: For a red background, either



      Graphics[White, Annulus[0, 0, r, R], Background -> Red]


      enter image description here



      Or,



      Graphics[White, Polygon[CirclePoints[R, 50]], Red, 
      Polygon[CirclePoints[r, 50]], Background -> Red]


      enter image description here



      You could also use EdgeForm to make the borders more distinct.






      share|improve this answer






















      • thanks a lot for the answer
        – Msen Rezaee
        5 hours ago










      • @MsenRezaee the question is, what do you expect to see if there is e.g. a red background.
        – Kuba♦
        4 hours ago










      • @Kuba I expect to see red everywhere except on the thin surface of my circle
        – Msen Rezaee
        4 hours ago











      • @MsenRezaee that is unclear for me. What should be between those black edges, and what should be inside the inner edge.
        – Kuba♦
        4 hours ago










      • @Kuba in the case of a red background, I expect to see red outside the outer edge and inside the inner edge. But not on the thin surface of the circle.
        – Msen Rezaee
        4 hours ago












      up vote
      4
      down vote



      accepted







      up vote
      4
      down vote



      accepted






      Polygon is always filled (it can be filled with white). Use Circle for a "hollow" circle.



      r = 0.24; R = 0.25;

      Graphics[Circle[0, 0, #] & /@ r, R]


      enter image description here



      Graphics[EdgeForm[Black], White, Polygon[CirclePoints[#, 50]] & /@ R, r]


      enter image description here



      Note that since the polygons are filled, the smaller circle must be drawn on top (last) to be seen.



      EDIT: For a red background, either



      Graphics[White, Annulus[0, 0, r, R], Background -> Red]


      enter image description here



      Or,



      Graphics[White, Polygon[CirclePoints[R, 50]], Red, 
      Polygon[CirclePoints[r, 50]], Background -> Red]


      enter image description here



      You could also use EdgeForm to make the borders more distinct.






      share|improve this answer














      Polygon is always filled (it can be filled with white). Use Circle for a "hollow" circle.



      r = 0.24; R = 0.25;

      Graphics[Circle[0, 0, #] & /@ r, R]


      enter image description here



      Graphics[EdgeForm[Black], White, Polygon[CirclePoints[#, 50]] & /@ R, r]


      enter image description here



      Note that since the polygons are filled, the smaller circle must be drawn on top (last) to be seen.



      EDIT: For a red background, either



      Graphics[White, Annulus[0, 0, r, R], Background -> Red]


      enter image description here



      Or,



      Graphics[White, Polygon[CirclePoints[R, 50]], Red, 
      Polygon[CirclePoints[r, 50]], Background -> Red]


      enter image description here



      You could also use EdgeForm to make the borders more distinct.







      share|improve this answer














      share|improve this answer



      share|improve this answer








      edited 3 hours ago

























      answered 5 hours ago









      Bob Hanlon

      55.6k23589




      55.6k23589











      • thanks a lot for the answer
        – Msen Rezaee
        5 hours ago










      • @MsenRezaee the question is, what do you expect to see if there is e.g. a red background.
        – Kuba♦
        4 hours ago










      • @Kuba I expect to see red everywhere except on the thin surface of my circle
        – Msen Rezaee
        4 hours ago











      • @MsenRezaee that is unclear for me. What should be between those black edges, and what should be inside the inner edge.
        – Kuba♦
        4 hours ago










      • @Kuba in the case of a red background, I expect to see red outside the outer edge and inside the inner edge. But not on the thin surface of the circle.
        – Msen Rezaee
        4 hours ago
















      • thanks a lot for the answer
        – Msen Rezaee
        5 hours ago










      • @MsenRezaee the question is, what do you expect to see if there is e.g. a red background.
        – Kuba♦
        4 hours ago










      • @Kuba I expect to see red everywhere except on the thin surface of my circle
        – Msen Rezaee
        4 hours ago











      • @MsenRezaee that is unclear for me. What should be between those black edges, and what should be inside the inner edge.
        – Kuba♦
        4 hours ago










      • @Kuba in the case of a red background, I expect to see red outside the outer edge and inside the inner edge. But not on the thin surface of the circle.
        – Msen Rezaee
        4 hours ago















      thanks a lot for the answer
      – Msen Rezaee
      5 hours ago




      thanks a lot for the answer
      – Msen Rezaee
      5 hours ago












      @MsenRezaee the question is, what do you expect to see if there is e.g. a red background.
      – Kuba♦
      4 hours ago




      @MsenRezaee the question is, what do you expect to see if there is e.g. a red background.
      – Kuba♦
      4 hours ago












      @Kuba I expect to see red everywhere except on the thin surface of my circle
      – Msen Rezaee
      4 hours ago





      @Kuba I expect to see red everywhere except on the thin surface of my circle
      – Msen Rezaee
      4 hours ago













      @MsenRezaee that is unclear for me. What should be between those black edges, and what should be inside the inner edge.
      – Kuba♦
      4 hours ago




      @MsenRezaee that is unclear for me. What should be between those black edges, and what should be inside the inner edge.
      – Kuba♦
      4 hours ago












      @Kuba in the case of a red background, I expect to see red outside the outer edge and inside the inner edge. But not on the thin surface of the circle.
      – Msen Rezaee
      4 hours ago




      @Kuba in the case of a red background, I expect to see red outside the outer edge and inside the inner edge. But not on the thin surface of the circle.
      – Msen Rezaee
      4 hours ago










      up vote
      1
      down vote













      FilledCurve can be used to achieve polygons (but also Bezier curves and B-splines) with holes (here formed by a two very circle-like polygons). It's a bit convoluted in this case. Red line on background for illustrative purposes:



      Graphics[Thick, Red, Line[.25 -1, -1, 1, 1],
      FaceForm@White, EdgeForm@Black,
      FilledCurve[
      List@*Line /@
      Table[r Sin[a], Cos[a], r, .24, .25, a, 0, 2 Pi, Pi/50]]]


      enter image description here






      share|improve this answer


























        up vote
        1
        down vote













        FilledCurve can be used to achieve polygons (but also Bezier curves and B-splines) with holes (here formed by a two very circle-like polygons). It's a bit convoluted in this case. Red line on background for illustrative purposes:



        Graphics[Thick, Red, Line[.25 -1, -1, 1, 1],
        FaceForm@White, EdgeForm@Black,
        FilledCurve[
        List@*Line /@
        Table[r Sin[a], Cos[a], r, .24, .25, a, 0, 2 Pi, Pi/50]]]


        enter image description here






        share|improve this answer
























          up vote
          1
          down vote










          up vote
          1
          down vote









          FilledCurve can be used to achieve polygons (but also Bezier curves and B-splines) with holes (here formed by a two very circle-like polygons). It's a bit convoluted in this case. Red line on background for illustrative purposes:



          Graphics[Thick, Red, Line[.25 -1, -1, 1, 1],
          FaceForm@White, EdgeForm@Black,
          FilledCurve[
          List@*Line /@
          Table[r Sin[a], Cos[a], r, .24, .25, a, 0, 2 Pi, Pi/50]]]


          enter image description here






          share|improve this answer














          FilledCurve can be used to achieve polygons (but also Bezier curves and B-splines) with holes (here formed by a two very circle-like polygons). It's a bit convoluted in this case. Red line on background for illustrative purposes:



          Graphics[Thick, Red, Line[.25 -1, -1, 1, 1],
          FaceForm@White, EdgeForm@Black,
          FilledCurve[
          List@*Line /@
          Table[r Sin[a], Cos[a], r, .24, .25, a, 0, 2 Pi, Pi/50]]]


          enter image description here







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited 1 hour ago

























          answered 1 hour ago









          kirma

          9,45112756




          9,45112756




















              up vote
              1
              down vote













              Here's one way:



              outer = CirclePoints[2, 100];
              AppendTo[outer, First[outer]];
              inner = CirclePoints[1, 100];
              AppendTo[inner, First[inner]];
              Graphics@Polygon[Join[inner, Reverse[outer]]]


              Mathematica graphics



              A hollow annulus is trickier:



              Graphics[
              FaceForm,
              EdgeForm[Black],
              Polygon[Join[inner, Reverse[outer]]],
              White, Thickness[0.01],
              Line[1.03 First[inner], 0.985 First[outer]]
              ]


              Mathematica graphics



              I couldn't get away with just a polygon for this one, I had to cover up the line from where the inner circle connects to the outer. Had I done this with a polygon it would still be two polygons and not one. We can also draw another polygon like the first one here above in white to make the first one appear hollow.



              As an aside, I see that Annulus has been mentioned but no one has shown how to make it hollow as far as I can tell:



              Graphics[
              FaceForm,
              EdgeForm[Black],
              Annulus
              ]


              Mathematica graphics






              share|improve this answer


























                up vote
                1
                down vote













                Here's one way:



                outer = CirclePoints[2, 100];
                AppendTo[outer, First[outer]];
                inner = CirclePoints[1, 100];
                AppendTo[inner, First[inner]];
                Graphics@Polygon[Join[inner, Reverse[outer]]]


                Mathematica graphics



                A hollow annulus is trickier:



                Graphics[
                FaceForm,
                EdgeForm[Black],
                Polygon[Join[inner, Reverse[outer]]],
                White, Thickness[0.01],
                Line[1.03 First[inner], 0.985 First[outer]]
                ]


                Mathematica graphics



                I couldn't get away with just a polygon for this one, I had to cover up the line from where the inner circle connects to the outer. Had I done this with a polygon it would still be two polygons and not one. We can also draw another polygon like the first one here above in white to make the first one appear hollow.



                As an aside, I see that Annulus has been mentioned but no one has shown how to make it hollow as far as I can tell:



                Graphics[
                FaceForm,
                EdgeForm[Black],
                Annulus
                ]


                Mathematica graphics






                share|improve this answer
























                  up vote
                  1
                  down vote










                  up vote
                  1
                  down vote









                  Here's one way:



                  outer = CirclePoints[2, 100];
                  AppendTo[outer, First[outer]];
                  inner = CirclePoints[1, 100];
                  AppendTo[inner, First[inner]];
                  Graphics@Polygon[Join[inner, Reverse[outer]]]


                  Mathematica graphics



                  A hollow annulus is trickier:



                  Graphics[
                  FaceForm,
                  EdgeForm[Black],
                  Polygon[Join[inner, Reverse[outer]]],
                  White, Thickness[0.01],
                  Line[1.03 First[inner], 0.985 First[outer]]
                  ]


                  Mathematica graphics



                  I couldn't get away with just a polygon for this one, I had to cover up the line from where the inner circle connects to the outer. Had I done this with a polygon it would still be two polygons and not one. We can also draw another polygon like the first one here above in white to make the first one appear hollow.



                  As an aside, I see that Annulus has been mentioned but no one has shown how to make it hollow as far as I can tell:



                  Graphics[
                  FaceForm,
                  EdgeForm[Black],
                  Annulus
                  ]


                  Mathematica graphics






                  share|improve this answer














                  Here's one way:



                  outer = CirclePoints[2, 100];
                  AppendTo[outer, First[outer]];
                  inner = CirclePoints[1, 100];
                  AppendTo[inner, First[inner]];
                  Graphics@Polygon[Join[inner, Reverse[outer]]]


                  Mathematica graphics



                  A hollow annulus is trickier:



                  Graphics[
                  FaceForm,
                  EdgeForm[Black],
                  Polygon[Join[inner, Reverse[outer]]],
                  White, Thickness[0.01],
                  Line[1.03 First[inner], 0.985 First[outer]]
                  ]


                  Mathematica graphics



                  I couldn't get away with just a polygon for this one, I had to cover up the line from where the inner circle connects to the outer. Had I done this with a polygon it would still be two polygons and not one. We can also draw another polygon like the first one here above in white to make the first one appear hollow.



                  As an aside, I see that Annulus has been mentioned but no one has shown how to make it hollow as far as I can tell:



                  Graphics[
                  FaceForm,
                  EdgeForm[Black],
                  Annulus
                  ]


                  Mathematica graphics







                  share|improve this answer














                  share|improve this answer



                  share|improve this answer








                  edited 23 mins ago

























                  answered 55 mins ago









                  C. E.

                  47.7k391193




                  47.7k391193



























                       

                      draft saved


                      draft discarded















































                       


                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function ()
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmathematica.stackexchange.com%2fquestions%2f182093%2fis-it-possible-to-draw-a-hollow-circle-using-polygon%23new-answer', 'question_page');

                      );

                      Post as a guest













































































                      Comments

                      Popular posts from this blog

                      What does second last employer means? [closed]

                      Installing NextGIS Connect into QGIS 3?

                      One-line joke