11-10-2020
03:55 AM
- Marcar como nuevo
- Favorito
- Suscribir
- Silenciar
- Suscribirse a un feed RSS
- Resaltar
- Imprimir
- Denunciar
11-10-2020
03:55 AM
I am using JavaScript for this development, and I am working completely outside of CAD environment. Project is 90% JavaScript and 10% Java, but help from any programming language is good with me. So far i was able to calculate extrusion vector, below is the python code, hope it might help someone.
#rotList = normal vector to the plane from three points
extrution_vector = np.array(rotList)
if abs(extrution_vector[0]) < 1/64 and abs(extrution_vector[1]) < 1/64:
ax = np.cross((0,1,0), extrution_vector)
else:
ax = np.cross((0,0,1), extrution_vector)
mx = sum([i**2 for i in ax])**.5 #calculate magnitude of ax
ax = ax * 1/mx #scale ax to have magnitude 1
ay = np.cross(extrution_vector, ax)
az = extrution_vector