Skip to content

Help Needed with Projecting Points onto Mesh Along Specified Axis Using MeshLib #2852

Answered by Grantim
doknicilija98 asked this question in Q&A
Discussion options

You must be logged in to vote

Hello!

findProjection function finds closest point on mesh in MeshTriPoint type, as far as you need to project in single direction you should use rayMeshIntersect

for i, x in enumerate(path):
    point = mm.Vector3f(X, -50, Z)  # -50 acts as a negative infinity
    line = mm.Line3f(point,mm.Vector3f(0,1,0)) # ray for intersection
    # point on mesh, note that mm.rayMeshIntersect(mesh,line) may return None if mesh was not intersected with the ray
    meshPoint = mm.rayMeshIntersect(mesh,line).mtp # (1)
    cartesianPoint = mesh.triPoint(meshPoint) # (2) cartesian point for Contours3f 
    trajectory[0][i] = cartesianPoint  # trajectory is Contours3f object 

Do you mean mesh boundary by ed…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@doknicilija98
Comment options

@Grantim
Comment options

Answer selected by doknicilija98
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants