예제 #1
0
def makePlot():
    verts = []
    codes = []
    p1 = Pendulum()
    p1.stoppedPendulum(2.0, 45.0)
    codes.append(Path.MOVETO)
#begin adding other verts at time
    for time in range(1, 1000):
        vert = p1.coordAtTime(time)
        verts.append(vert)
        codes.append(Path.CURVE4)
    
    codes.pop(-1) # there is an extra CURVE4
    path = Path(verts, codes)
    fig = plt.figure()
    ax = fig.add_subplot(111)
    patch = patches.PathPatch(path, facecolor='none', lw=2)
    ax.add_patch(patch)
#xs, ys = zip(*verts)
#ax.plot(xs, ys, 'x--', lw=2, color='black', ms=10)
    ax.set_xlim(-p1.length / 5, p1.length / 5)
    ax.set_ylim(4 * p1.length / 5, p1.length)
    return plt
예제 #2
0
'''
Created on May 21, 2012

@author: Alex Kinney
'''
from Pendulum import Pendulum

if __name__ == "__main__":
    p = Pendulum()
    p.stoppedPendulum(10, 45)
    period = p.period()
    for time in range(10):
        print p.pendulumAngleAtTime(time)