Group Abstract Group Abstract

Message Boards Message Boards

improved Disk[] function by including a radial range

GROUPS:

Hi,

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
Answer
1 month ago

Hello, How about something like this:

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

e.g.,

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
Answer
1 month ago

Hello,

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
Answer
1 month ago

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

POSTED BY: W. Craig Carter
Answer
1 month ago

Thank you, JH

POSTED BY: Jihad AlSadah
Answer
1 month ago

Found it!

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

Thanks again, JH

POSTED BY: Jihad AlSadah
Answer
1 month ago