Welcome to graphwar-generator
this is a simple equation generator for graphwar, equations calculated using discrete cosine transformation
How this program works?
1. gather data from clicking using win32api
while True:
a = win32api.GetKeyState(0x01)
if int(win32api.GetAsyncKeyState(win32con.VK_RETURN)) != 0:
break
if a != state_left: # state changed
state_left = a
if a < 0:
rndtp = (round(win32gui.GetCursorPos()[0],20),round(win32gui.GetCursorPos()[1],20))#round up tuple
rndtp2 = (round(transf(origin,top_right,rndtp)[0],3),round(transf(origin,top_right,rndtp)[1],3))
listoftuples.append(rndtp2)
print(win32gui.GetCursorPos())
time.sleep(0.001)
2. generate interpolation of data using scipy
f_linear_interp = np.array([0])
f_linear_interp = interp1d(xdata,ydata)
3. generate samples and apply dct
f_linear_interp=np.array([0])
f_linear_interp = interp1d(xdata,ydata)#linear interpolation function
sample_num=50
x_sample=np.linspace(np.amin(xdata),np.amax(xdata),num=sample_num,endpoint=True)
y_linear_sample=f_linear_interp(x_sample)
dct_result=scipy.fftpack.dct(y_linear_sample)
4. calculate equation using following formula
equation_str = f"{(dct_result[0]/sample_num)/2:.10f}"
i=1
while i < sample_num:
equation_str+=f"+{dct_result[i]/sample_num:.10f}*cos({i}pi((x-{np.amin(xdata)})*({sample_num}-1)/({np.amax(xdata)}-{np.amin(xdata)})+0.5)/{sample_num})"
i+=1
more footage
Github page
You can go to edleeebinj’s github to have fun.
Other
Whenever you are bored, GitHub Pages will rebuild the joy in your mind, from the ground up.
Mashed potato
Mashed potato is a lightweight and easy-to-use food. It includes nothing.
1+1=2!?
go check out my newest graphwar fft equation generator at my github page also check out https://edleebinj.github.io/graphwar-generator/