1

I have a slice of a circle (that is made of moveTo,lineTo,arc,etc) and need to find the middle point of the slice.

What is the math behind finding the point shown in the image below? Middle point of a slice

Bakudan
  • 19,134
  • 9
  • 53
  • 73
Feeney
  • 357
  • 2
  • 4
  • 12
  • 3
    Polar coordinates, half the radius, half the traverse ... ? I guess it depends on how you define "midpoint", but it seems like knowing that would mean you know the answer to the question ... – Pointy Jan 27 '12 at 14:14
  • looks more than half the radius.. again depends on how accurate the image is – 0xc0de Jan 27 '12 at 14:37
  • The image is not exact. I always think an illustration helps with this kind of question. – Feeney Jan 27 '12 at 14:58
  • @Feeney Absolutely! an image is worth hundreds of words(unless its code) – 0xc0de Jan 27 '12 at 15:11

2 Answers2

3

It looks "centroid" of the sector to me.

The co-ordinates of it (with x axis along the radius passing through the centroid and origin at the centre)

centroidX = (4/3)r(sin(A)/A)

centroidY = 0

where 'A' is the angle made by the arc at the centre(in radians) and 'r' is the radius.

EDIT:

This is sort of a formula which can be easily derived. Geometric Centroid of any shape is average(weighted mean) of all it's points. In physics, centroid(AKA centre of mass) of an object is the point at which the mass of the whole object can be assumed to be concentrated(eg, the object can be balanced on a needle at the centroid). There are formulae which can be directly used for regular shapes. For irregular shapes, it is calculated by integration.

It's basic logic is adding x co-ordinates of all the points and dividing by total no. of points, which gives x co-ordinate of the centroid and similar for y co-ordinate. As the points on a shape are not discrete, integration is used.

0xc0de
  • 8,028
  • 5
  • 49
  • 75
  • Does this use a triangle's medians to work out the centroid? Could you dissect this so I understand a bit better. Thanks – Feeney Jan 27 '12 at 15:01
  • If the shape can be completely divided into triangles, medians method can be used. So for shapes involving circles(or its parts) medians method can not be used(although practically it can be done by choosing large no. of small triangles, which is an approximation) – 0xc0de Jan 27 '12 at 15:48
  • so if A,B & C were 3 points of an angle. centroid.X = (A.x + B.x + C.x)/3; centroid.Y = (A.y + B.y + C.y)/3; – Feeney Jan 27 '12 at 17:30
  • All points in the triangle need to be used for integration/summation, not just the vertices – 0xc0de Jan 28 '12 at 07:07
  • This is now working for me: //find middle of bigSeg(chosen sector) //circleX & circleY is coOrds middle if (bigSeg == 0) {a = (5*Math.PI)/3; b=(3*Math.PI)/2; } if (bigSeg == 1) {a = (11*Math.PI)/6; b=(5*Math.PI)/3; } if (bigSeg == 2) {a = 0; b = (11*Math.PI)/6;} var angle1X = 512 + dataSlider1[bigSeg].radius * Math.cos(a); var angle1Y = 330 + dataSlider1[bigSeg].radius * Math.sin(a); var angle2X = 512 + dataSlider1[bigSeg].radius * Math.cos(b); var angle2Y = 330 + dataSlider1[bigSeg].radius * Math.sin(b); var circleX = (512 + angle1X + angle2X) / 3; var circleY = (330 + angle1Y + angle2Y) / 3; – Feeney Jan 30 '12 at 11:55
1

Let C is center point, P1 and P2 are points at circumference, and slice angle is smaller then Pi (180 deg).

One possibility:

X = C + Radius/2 * UnitVector(P1 + P2 - 2*C)

Another:

X = 1/3 * (P1 + P2 + C)

(It depends on exact requirements)

Christian Rau
  • 45,360
  • 10
  • 108
  • 185
MBo
  • 77,366
  • 5
  • 53
  • 86
  • Can you please check this? https://math.stackexchange.com/questions/4056283/how-to-find-the-middle-point-of-an-arc-slice – Irfan Mar 10 '21 at 12:10