Commit 3bc018a9 authored by Nathan Coppin's avatar Nathan Coppin
Browse files

improving contact visu in 3d

parent 678bdce2
Pipeline #8208 passed with stages
in 3 minutes and 23 seconds
......@@ -95,7 +95,13 @@ def RequestData():
contacts = in_contacts.FieldData["particle_triangle_idx"]
points_t = np.ndarray((contacts.shape[0],2,3))
points_t[:,0,:] = in_particles.Points[contacts[:,1],:]
points_t[:,1,:] = np.mean(in_bnd.Points[triangles[contacts[:,0],:]],axis=1)
d0 = in_bnd.Points[triangles[contacts[:,0],:]][:,1,:] - in_bnd.Points[triangles[contacts[:,0],:]][:,0,:]
d1 = in_bnd.Points[triangles[contacts[:,0],:]][:,2,:] - in_bnd.Points[triangles[contacts[:,0],:]][:,0,:]
N = np.cross(d0,d1)
N /= np.linalg.norm(N,axis=1)[:,newaxis]
dd = in_bnd.Points[triangles[contacts[:,0],:]][:,0,:] - in_particles.Points[contacts[:,1],:]
dist = einsum('ij,ij->i', N, dd)
points_t[:,1,:] = in_particles.Points[contacts[:,1],:] + N*dist[:,newaxis]
points.append(points_t)
#merge everything
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment