标题说明了一切。给定一个弧(例如):
Start Point: x = 53.34, y = 52.07
End Point: x = 13.97, y = 52.07
Angle: 180 degrees
即使我在python中编写,puesdocode也是首选,因此它对其他人有用。
谢谢!
- 汤姆
答案 0 :(得分:1)
h = Sqrt( (start.x - end.x)^2 + (start.y - end.y)^2)
or
h = Math.Hypot(start.x - end.x, start.y - end.y)
R = Abs(h / (2*Sin(Angle/2)))
if angle <= Pi/2
top = end.y
left = end.x
bottom = start.y
right = start.x
else if angle <= Pi
top = start.y - R
left = end.x
bottom = start.y
right = start.x
else if angle <= 3*Pi/2
top = start.y - R
left = start.x - 2*R
bottom = end.y
right = start.x
else
top = start.y - R
left = start.x - 2*R
bottom = start.y + R
right = start.x