[ create a new paste ] login | about

Link: http://codepad.org/PfHfrJDV    [ raw code | output | fork ]

Python, pasted on Dec 1:
# r = 10
# xc = 16.29190075645217
# yc = -39.91619848709566
# dy = 9.926756580965364
# block[2] = -30
# block[4] = -35

       elif block[0] in (2, 3): # Arc moves here
                    # a circle is x^2 + y^2 = r^2
                    # (x - xc)^2 + (y - yc)^2 = r^2
                    # (y - yc) = sqrt(r^2 - (x - xc)^2)
                    # 2 solutions for a line through a circle
                    # because we split the arcs into <= 90 degree sections it 
                    # is easy to check which solution is between the arc ends
                    r = block[5]
                    xc = block[6]
                    yc = block[7]
                    # if the conditions are equal then it is the wrong solution
                    dy = math.sqrt(r**2 - (x - xc)**2)
                    y = yc + dy
                    if (y - block[2]) * (y - block[4]) > 0:
                        y = yc - dy
                        print "intercept arc, y = ", y, block
                    else: print "intercept arc, y = ", y, block
                    if (y - block[2]) * (y - block[4]) > 0:
                        print "Well, that's me stumped"
                        print x, y, block[2], block[4], xc, yc, r
                        bp()
                        continue


Output:
1
2
3
4
  Line 8
    elif block[0] in (2, 3): # Arc moves here
    ^
IndentationError: unexpected indent


Create a new paste based on this one


Comments: