Re-Ordering X,Y Data to define the bottom shape

38 views Asked by At

I have data that is the definition of the shape of a bridge opening. I have developed code that cuts the bridge opening with a horizontal line as if it were the water level, including the intersection points on the bridge piers and walls. I want to ensure the shape is always the bounding shape and not being cut diagonal. When I use Sort, and Plot the data I get a Zig Zaw Shape...So the sequence of Co-ords I get from another process is A, the sequence I need is B... ? How do I ensure the Vertical Points on the left & right sides are sequences such that the Zig Zaw is avoided ?

def Plot_Poly(Poly):
    """
    PLOTS THE DATA From the XS Files
    """
    import matplotlib.pyplot as plt

    #============ PLOT ROUTINE FOR CROSS SECTIONS ==============
    print 'About to Plot'
    plt.clf() # Clear any Previous Plots...
    plt.ylabel('Station Elevation (mAHD)')
    plt.xlabel('Station Distance (m)')
    plt.plot([row[0] for row in Poly],[row[1] for row in Poly],marker='o',linestyle='--',dashes=(5,10))  # Plot the Time Series
    plt.show()
    return()


A = [[0,0.95],[0,0],[1,0.95],[1,0.0],[2,0.95],[2,0],[3,0.95],[3,0.0],[4.0,0.95],[4,0],[5,0.95],[5,0.0]]
Plot_Poly(A)
B = [[0,0.95],[0,0],[1,0],[1,0.95],[2,0.95],[2,0],[3,0],[3,0.95],[4.0,0.95],[4,0],[5,0],[5,0.95]]
Plot_Poly(B)
0

There are 0 answers