Is it possible to draw a hollow circle using polygon?
Clash 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?
graphics graphics3d polygons drawing
add a comment |Â
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?
graphics graphics3d polygons drawing
3
Kind of yes, but should you? No. SeeAnnulus
and if it should be a polygon take a look atFilledCurve
.
â 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
add a comment |Â
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?
graphics graphics3d polygons drawing
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
graphics graphics3d polygons drawing
asked 5 hours ago
Msen Rezaee
39228
39228
3
Kind of yes, but should you? No. SeeAnnulus
and if it should be a polygon take a look atFilledCurve
.
â 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
add a comment |Â
3
Kind of yes, but should you? No. SeeAnnulus
and if it should be a polygon take a look atFilledCurve
.
â 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
add a comment |Â
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]
Graphics[EdgeForm[Black], White, Polygon[CirclePoints[#, 50]] & /@ R, r]
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]
Or,
Graphics[White, Polygon[CirclePoints[R, 50]], Red,
Polygon[CirclePoints[r, 50]], Background -> Red]
You could also use EdgeForm
to make the borders more distinct.
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
 |Â
show 1 more comment
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]]]
add a comment |Â
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]]]
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]]
]
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
]
add a comment |Â
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]
Graphics[EdgeForm[Black], White, Polygon[CirclePoints[#, 50]] & /@ R, r]
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]
Or,
Graphics[White, Polygon[CirclePoints[R, 50]], Red,
Polygon[CirclePoints[r, 50]], Background -> Red]
You could also use EdgeForm
to make the borders more distinct.
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
 |Â
show 1 more comment
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]
Graphics[EdgeForm[Black], White, Polygon[CirclePoints[#, 50]] & /@ R, r]
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]
Or,
Graphics[White, Polygon[CirclePoints[R, 50]], Red,
Polygon[CirclePoints[r, 50]], Background -> Red]
You could also use EdgeForm
to make the borders more distinct.
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
 |Â
show 1 more comment
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]
Graphics[EdgeForm[Black], White, Polygon[CirclePoints[#, 50]] & /@ R, r]
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]
Or,
Graphics[White, Polygon[CirclePoints[R, 50]], Red,
Polygon[CirclePoints[r, 50]], Background -> Red]
You could also use EdgeForm
to make the borders more distinct.
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]
Graphics[EdgeForm[Black], White, Polygon[CirclePoints[#, 50]] & /@ R, r]
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]
Or,
Graphics[White, Polygon[CirclePoints[R, 50]], Red,
Polygon[CirclePoints[r, 50]], Background -> Red]
You could also use EdgeForm
to make the borders more distinct.
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
 |Â
show 1 more comment
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
 |Â
show 1 more comment
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]]]
add a comment |Â
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]]]
add a comment |Â
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]]]
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]]]
edited 1 hour ago
answered 1 hour ago
kirma
9,45112756
9,45112756
add a comment |Â
add a comment |Â
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]]]
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]]
]
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
]
add a comment |Â
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]]]
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]]
]
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
]
add a comment |Â
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]]]
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]]
]
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
]
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]]]
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]]
]
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
]
edited 23 mins ago
answered 55 mins ago
C. E.
47.7k391193
47.7k391193
add a comment |Â
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
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
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
3
Kind of yes, but should you? No. See
Annulus
and if it should be a polygon take a look atFilledCurve
.â 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