Browse Source

Add coordinates.arc.

debian-sid
Tom Payne 14 years ago
parent
commit
ef7f424c8c
  1. 16
      igc2kmz/kml.py

16
igc2kmz/kml.py

@ -195,6 +195,22 @@ class coordinates(_SimpleElement):
coords.append(coord)
return cls(coords)
@classmethod
def arc(cls, center, radius, start, stop, error=0.1):
delta_theta = 2 * pi / int(ceil(pi / acos((radius - error) / (radius + error))))
while start < 0:
start += 2 * pi
stop += 2 * pi
while stop < start:
stop += 2 * pi
coords = []
theta = start
while theta < stop:
coords.append(center.coord_at(theta, radius + error))
theta += delta_theta
coords.append(center.coord_at(stop, radius + error))
return cls(coords)
class Data(_CompoundElement):

Loading…
Cancel
Save