Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def calc_center(v1,bulge,v2):
- '''
- calculates center of arc- this one works
- '''
- chord = numpy.subtract(v2,v1)
- chord_length= numpy.linalg.norm(chord)
- sagitta = (bulge*chord_length)/2.0
- inc_angle = numpy.arctan(bulge)*4.0
- radius = (chord_length/2.0)/numpy.sin(inc_angle/2.0)
- if bulge >= 0:
- perp = (numpy.cross(chord,(0,0,-1)))
- else:
- perp = (numpy.cross(chord,(0,0,1)))
- chord_mid_pt = numpy.add(numpy.multiply(chord,(.5,.5,.5)),v1)
- unit_vec = perp/ numpy.linalg.norm(perp)
- arc_center = numpy.add(numpy.multiply((radius-sagitta),unit_vec),chord_mid_pt)
- return arc_center
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement