def cornu_yx(t,mirror): # Reparamaterize for constant absolute rate of turning t = math.sqrt(abs(t)) * (1 if t > 0 else -1) y,x = cornu.eval_cornu(t) if mirror: y = -y return y,x
def cornu_yx(t, mirror): # Reparamaterize for constant absolute rate of turning t = math.sqrt(abs(t)) * (1 if t > 0 else -1) y, x = cornu.eval_cornu(t) if mirror: y = -y return y, x
phigh.append(high[-1]) return Profile(ppos, plow, phigh) def make_profile(spec): pos = [ ] low = [ ] high = [ ] for item in spec: if len(item) == 2: this_pos, this_low = item this_high = this_low else: this_pos, this_low, this_high = item pos.append(this_pos) low.append(this_low) high.append(this_high) return Profile(pos, low, high) if __name__ == '__main__': from raphs_curves import cornu for i in range(20+1): t = i / 10.0 - 0.5 y1,x1 = cornu.eval_cornu(t) y2,x2 = cornu.eval_cornu(t+1e-3) print( t, (math.atan2(y2-y1,x2-x1)+math.pi) % (2*math.pi) -math.pi ) #Angle is t^2
phigh.append(high[-1]) return Profile(ppos, plow, phigh) def make_profile(spec): pos = [] low = [] high = [] for item in spec: if len(item) == 2: this_pos, this_low = item this_high = this_low else: this_pos, this_low, this_high = item pos.append(this_pos) low.append(this_low) high.append(this_high) return Profile(pos, low, high) if __name__ == '__main__': from raphs_curves import cornu for i in range(20 + 1): t = i / 10.0 - 0.5 y1, x1 = cornu.eval_cornu(t) y2, x2 = cornu.eval_cornu(t + 1e-3) print(t, (math.atan2(y2 - y1, x2 - x1) + math.pi) % (2 * math.pi) - math.pi) #Angle is t^2