I have this simple script:
def snap_vert(og, vv, verts, dist):
lvl = None
n0,n1,n2 = 0,1,2
for v in verts:
vd1 = og[n1]-v[n1]
vd2 = og[n2]-v[n2]
dx = abs(vv[n1]*vd2-vv[n2]*vd1)
if dx < dist:
vd0 = og[n0]-v[n0]
dy = abs(vv[n2]*vd0-vv[n0]*vd2)
if dy < dist:
dz = abs(vv[n0]*vd1-vv[n1]*vd0)
if dz < dist:
dist = max([dx,dy,dz])
lcox, lcoy, lcoz = v
lvl = vert
else:
tmp = n1
n1 = n2
n2 = tmp
else:
tmp = n1
n1 = n0
n0 = tmp
return lvl
This is a pure python code where:
vv is a Vector
og is a Vector
v is a vector list
dist is a float
(vector in this case can be an array)
But I want to optimize and test on a windows 64 bits.
For this I need to convert this .py code for .pyd with Cython.
But I’m having a lot of difficulties with compilation using python 3.4. I can not :no:
If anyone can help me doing it or, indicating a simple way to do this, I would be grateful.