0

Intro

Say I have a 3D point, a normal and a triangle mesh of a tetraeder:

pt = np.array([0,0,0.5])
normal = np.array([1,1,0])
vertices_tetr = np.array([0,0,0],[0,1,1],[1,0,1],[1,1,0])
faces_tetr = np.array([0,1,2],[0,2,3],[0,1,3],[1,2,3]) 

Link to .ply file of tetraeder can be found here.

Question

What would be a good method to project the 3D point to the mesh along the given normal?

Additional info

Efficiency is appreciated if the solution is not too complicated. If there's a good library for this then that's also an option.

Extra clarification: I am not looking for the closest point of the mesh, but really the projection of the 3D point on one of the faces of the mesh along the given normal.Thus as shown in the picture below with p, the original point, n the normal and p', the projected point.

tetraeder with unprojected and projected point

Tomerikoo
  • 18,379
  • 16
  • 47
  • 61
ThaNoob
  • 520
  • 7
  • 23
  • Can you solve this with pen and paper? What is your programming related question? This seems more like a math question – Tomerikoo Apr 26 '21 at 08:46
  • It is a combination of both, I asked it here because I wanted to know if there were specific python libraries for this problem. I need a solution to the mathematical problem that can be solved in Python. – ThaNoob Apr 26 '21 at 08:48
  • Does this answer your question? [3D Line-Plane Intersection](https://stackoverflow.com/q/5666222/6045800). There are two answers in Python and I believe the transition from point and normal to line is quite easy – Tomerikoo Apr 26 '21 at 08:49
  • [this answer](https://stackoverflow.com/a/39424162/6045800) also uses numpy and a point and direction. The definition of the plane is a bit different but if you could translate your plane to that it would be the optimal solution for you – Tomerikoo Apr 26 '21 at 08:51
  • Thanks for the replies, the problem is slightly more complicated then a simple 3D line plane intersection. The triangles are not planes but really triangles, if you would apply the referenced algorithm then you would find intersections for all triangles that are not parallel to the normal. To summarize: I do not only need to project the point but also know if the point lies in the triangle. (Having such an algorithm would already allow for a brute force method, just iterating over all triangles in the mesh). – ThaNoob Apr 26 '21 at 08:57
  • Oh well, I might not fully understand your problem, was just trying to be helpful :) Good luck! – Tomerikoo Apr 26 '21 at 09:00
  • Well you understood part of it :) You could see the solution as two steps: 1. Project point to plane of triangle & 2. Check if point lies in triangle You solved part 1, but part 2 remains to be solved. – ThaNoob Apr 26 '21 at 09:02
  • Again, only to my understanding, isn't that the easy part? Or at least another possible existing question on SO? Anyway, here are a few more links that might help you in the research: [projecting points onto a plane given by a normal and a point](https://stackoverflow.com/q/35656166/6045800) ; [How may I project vectors onto a plane defined by its orthogonal vector in Python?](https://stackoverflow.com/q/17915475/6045800) ; [What's the fastest way of checking if a point is inside a polygon in python](https://stackoverflow.com/q/36399381/6045800) – Tomerikoo Apr 26 '21 at 09:10

0 Answers0