Created
March 12, 2018 14:09
Revisions
-
aneasystone renamed this gist
Mar 12, 2018 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
aneasystone created this gist
Mar 12, 2018 .There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,57 @@ import pylab import bs4 def get_mcd_content(): path = 'C:/Users/aneasystone/Desktop/11.mcd' mcd = '' with open(path, 'rb') as file: mcd = file.read() return str(mcd) def parse_mcd_content(mcd): print(mcd) soup = bs4.BeautifulSoup(mcd, 'lxml') print(soup) events = soup.select('mouseevents') print(len(events)) results = [] for event in events: pos = event.find('d3p1:x') print(pos.text) results.append(int(pos.text)) return results def get_track(distance): track = [0] current = 0 mid = distance * 4 / 5 t = 0.2 v = 0 while current < distance: if current < mid: a = 2 else: a = -3 v0 = v v = v0 + a * t move = v0 * t + 1 / 2 * a * t * t current += move track.append(track[len(track)-1] + round(move)) return track # content = get_mcd_content() # results = parse_mcd_content(content) # x = range(0, len(results)) # pylab.plot(x, results, 'r') # pylab.show() # results = get_track(40) results = [0,0,0,0,0,0,1,2,3,4,5,6,7,8,9,10,11,12,13,15,17,19,21,23,25,27,29,31,33,35,37,40,43,46,49,52,55,58,61,64,67,70,73,76,80,84,88,92,96,100,104,107,110,113] print(results) x = range(0, len(results)) pylab.plot(x, results, 'r') pylab.show()