Define the tangent of a 3D mesh

Hi all,
To define the tangent of a mesh in 2D, we use the following:

n = FacetNormal(mesh)
t = as_vector((-n[1], n[0]))

But what about 3D mesh? how can we define the tangent of the mesh in this case?
Thank in advance for your help

Hi, for a 3D mesh, the tangent plane is a 2D surface. Hence, there is no unique tangent vector. You need to choose yourself a basis of 2 non colinear vectors to span the tangent plane. You can define them based on the normal vector. For instance, you can define t_1 to be always perpendicular to both n and e_x and deduce t_2 from t_1 and n. Note that you need to treat separately the case where n is aligned with e_x for the above construction to work in any case. You can find a similar construction here:

1 Like