Help Needed with Projecting Points onto Mesh Along Specified Axis Using MeshLib #2852
-
Hello, I am new to MeshLib and need assistance with projecting points onto a mesh along a specified axis. Specifically, I have the X and Z coordinates of a point and need to find the minimum Y such that the point (X, Y, Z) lies on the mesh. After determining this point, I need to place it inside a for i, x in enumerate(path):
point = mm.Vector3f(X, -50, Z) # -50 acts as a negative infinity
trajectory[0][i] = mm.findProjection(point, mesh).mtp # trajectory is Contours3f object I received the following error: ---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
Cell In[35], line 8
----> 8 trajectory[0][i] = mm.findProjection( point, mesh).mtp
TypeError: __setitem__(): incompatible function arguments. The following argument types are supported:
1. (self: meshlib.mrmeshpy.Contour3f, arg0: int, arg1: meshlib.mrmeshpy.Vector3f) -> None
2. (self: meshlib.mrmeshpy.Contour3f, arg0: slice, arg1: meshlib.mrmeshpy.Contour3f) -> None
Invoked with: <meshlib.mrmeshpy.Contour3f object at 0x0000022851CEC470>, 0, <meshlib.mrmeshpy.MeshTriPoint object at 0x0000022851CCE3B0> Additionally, I would like to project the point that is on the mesh to the edge of the mesh along some axis. Could someone please help me with the following:
Thank you for your assistance! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Hello!
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 edge, or edge of mesh triangulation, could you please provide some images and/or more details about 3rd question? |
Beta Was this translation helpful? Give feedback.
Hello!
findProjection
function finds closest point on mesh inMeshTriPoint
type, as far as you need to project in single direction you should userayMeshIntersect
Do you mean mesh boundary by ed…