def dtf_darcircle(point, radius_miles, max_segments=12): radius = distances.feet(radius_miles) if max_segments <= 0: raise Exception("max_segments must be between 1 and 360") thetas = [math.radians(a) for a in range(0, 360, 360/max_segments)] thetas.append(math.radians(360)) pts = [] for t in thetas: pts.append(distances.Point(point.x + radius*math.cos(t), point.y + radius*math.sin(t))) return dtf_polygon(pts)
def gen_darcircles(self, dtfname, radius_miles, max_segments=12): radius = distances.feet(radius_miles) if max_segments <= 0: raise Exception("max_segments must be between 1 and 360") thetas = [math.radians(a) for a in range(0, 360, 360/max_segments)] thetas.append(math.radians(360)) f = open(dtfname, "w") for p in self.points: pts = [] for t in thetas: pts.append(distances.Point(p.x + radius*math.cos(t), p.y + radius*math.sin(t))) f.write("# Center %s\n" % p) f.write(dtf.dtf_polygon(pts))