Home > other >  Find x and y on arch
Find x and y on arch

Time:10-20

enter image description here

Hello all. I'm not very good with math, so I will need help writing a function in Python. There is an arch and I need to know the x and y of each pixel on the arch. All the data that I have, I have written in the picture. Let me know if anything needs to be clarified further.

CodePudding user response:

Having arc length and radius, we can find arc angle in radians

fi = L/R= 366.5/350  (60 degrees, BTW)

Half-angle

hf = fi/2 = 366.5/700   (30 degrees)

Circle center coordinates

cx = R * sin(hf) = 350*1/2 = 175
cy = R * cos(hf) = 350*0.866 = 303.1

Now we can make loop to get pixel coordinates with given resolution with starting angle -Pi/2-Pi/6 (in general case -Pi/2-hf)

for i in range(2220):
   an = -math.pi*2/3     i * 366.5/350 / 2220
   x = cx   R * math.cos(an)
   y = cy   R * math.sin(an)

To correct your code:

cx = radius * math.sin(hf)
cy = -radius * math.cos(hf)

xl.append(cx   radius * math.cos(an))
yl.append(cy - radius * math.sin(an))
  • Related