Message Boards Message Boards

5 Replies
10 Total Likes
View groups...
Share this post:

improved Disk[] function by including a radial range

Posted 10 years ago


The basic Graphics entity

Disk[{x, y}, r, {[Theta]i, [Theta]f}]Disk[{x,y},[Ellipsis],{Subscript[[Theta], 1],Subscript[[Theta], 2]}]

is also expressed as follows: Disk[{x, y}, {rx, ry}, {[Theta]i, [Theta]f}]

What I wish is for the Mathematica development team to upgrade the functionality of Disk by overloading this new version:

Disk[{x, y}, {r, ri, rf}, {[Theta]i, [Theta]f}]

Instead of the above elegant way, I must do the following:

r := Sqrt[x^2 + y^2];

[Theta] := ArcTan[x, y] + Pi;

RegionPlot[  ri < r < rf && [Theta]i < [Theta] < [Theta]f, {x, -rf,  rf}, {y, -rf, rf}]

This does not address the theta sign change near the -ve x-axis

Any thoughts, Thanks, JH

POSTED BY: Jihad AlSadah
5 Replies

Found it!

ParametricPlot[r {Cos[t], Sin[t]}, {r, 2.1, 2.5}, {t, 0, Pi}]

Thanks again, JH

POSTED BY: Jihad AlSadah

Thank you, JH

POSTED BY: Jihad AlSadah

Hello, Give it a try... It should be pretty fast for about 2^8 disks.... WCC

POSTED BY: W. Craig Carter


So, you hide part of a full disk by a smaller disk with background color. This should work for a small number of disks.

However, for a graphical project that uses 2^3 or 2^4 such segments it becomes too taxi this way.

RegionPlot does the job but it is slow to compute. I think that the function Disk could use a new improvement.

Thank you, JH

POSTED BY: Jihad AlSadah

Hello, How about something like this:

annulus[point : {x_, y_}, radii : {ri_, ro_}, color_: Black] := 
  GraphicsGroup[{color, Disk[point, ro], White, Disk[point, ri]}]


annulus[{1, 2}, {3, 5}]
annulus[{1, 6}, {4, 4.2}, Yellow]

This assumes that the background is white. You would need to use Show[] to combine it with other graphics. You could modify this to use limits for theta as well.

POSTED BY: W. Craig Carter
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
or Discard

Group Abstract Group Abstract