Projecting onto triangle - nonlinear simultaneous equation

34 Views Asked by At

I am trying to project a point $p$ onto a triangulated mesh. I have a vertices of a triangle $v_0, v_1, v_2$ and vertex normals $n_0, n_1, n_2$ and envisage the point as extruded a distance $\eta$ from the surface according to a weighted sum of the normals; with weights given by the barycentric coordinates $(1-\beta-\gamma, \beta, \gamma)$ of the projected point. The problem gives a 3 coordinate vector equation for the 3 unknowns ($\beta, \gamma, \eta$) so in that respect it is solvable when non-singular; however, it is nonlinear in $\eta$ paired with the other terms.

$p-v_0 = \beta (v_1-v_0) + \gamma (v_2-v_0) + \eta n_0 + \eta [\beta (n_1 - n_0) + \gamma (n_2 - n_0)]$

I can do a linear mix of the equations to cancel out the nonlinear terms leaving a single linear equation in $\beta$, $\gamma$, and $\eta$ or alternatively to cancel out the terms not in $\eta$, but find myself unsure how to proceed.

Geometrically I can see cases where there would be multiple solutions, but these will be at distances further than what I am concerned about.