Hope this helps. The second part provides a method for calculating the area of a sector of a circle
views:
642answers:
4
A:
Jonathan Fingland
2009-05-31 10:34:26
Cheers, it's not so much the actual area in units^2 I'm looking for but the points that define that area on the plane... I've updated the question subject to reflect this. Cheers though, good resource.
Eoin Campbell
2009-05-31 10:37:29
Are we to assume that we know point c, the angles A and B and the radii r1 and r2 and you *want* the intercept points? e.g. the point produced by adding the vector produced by A and r1 to c (to get one inner point, then Ar1+Ar2+c to get the outer point on the same path... then ditto for B side?
Jonathan Fingland
2009-05-31 10:44:16
Eoin Campbell
2009-05-31 10:55:30
A:
The area of a segment of a circle is simply the angle of the arc (in radians) times the radius. So the area of the green circle is obviously:
(B-A) * r2
1800 INFORMATION
2009-05-31 10:36:22
+3
A:
The area is the difference of the outer and inner disc parts. The area of a disc part is proportional to the angle sweep:
area = (b-a)*((r+r2)^2-r^2)/2
a
and b
must be expressed in radians.
For b-a = 2*Pi
, area = Pi*(r+r2)^2 - Pi*r^2
is the difference of the areas of the outer and inner discs.
You can generate points on the inner / outer circle using
x = cx + r * cos(t) / x = cx + (r+r2) * cos(t)
y = cy + r * sin(t) / y = cy + (r+r2) * sin(t)
Where t
varies from a
to b
.
Eric Bainville
2009-05-31 10:46:57
Eoin Campbell
2009-05-31 10:58:30
Yes, ideally the increment should correspond to some number of pixels on the outer circle. The arc length between points on the outer circle is (r+r2)*dt, where dt is the angle increment in radians.
Eric Bainville
2009-05-31 11:01:15
+1. @Eoin, see http://hyperphysics.phy-astr.gsu.edu/hbase/vect.html for vector construction/operation formulas to see where Eric's formulas some from.
Jonathan Fingland
2009-05-31 11:04:16
Eoin Campbell
2009-05-31 11:22:44
I think Eoin is using r2 for the outer radius, while you use r2+r.This might lead to confusion. Otherwise this is nicely explained.
Accipitridae
2009-06-01 07:41:48
A:
You need to draw lines (this pseudo code):
for aa from A to B
set color to required color // you could use aa in an equation with HSL to get something like your sample
x1=r*cos(aa)+x
y1=r*sin(aa)+y
x2=r1*cos(aa)+x
y2=r1*sin(aa)+y
draw line between (x1,y1) and (x2,y2)
for a small-enough increment in the angles, and small-enough radii, this should be OK.
The points you're looking for are (x1,y1) and (x2,y2) for each angle aa
Osama ALASSIRY
2009-05-31 11:20:44