0
votes

I'm dealing with Thin Plate Spline interpolation. This mathematical model allows to simulate a thin plate surface passing through points. The name thin plate spline refers indeed to a physical analogy involving the bending of a thin sheet of metal. In the physical setting, the deflection is in the z direction, orthogonal to the plane.

Goals

  • Provide a thin plate spline model in C++ passing through the a collection of points in input

  • Find the intersection between a 3d line and the model calculated at point 1.

  • Calculate the 3d surface normal at intersection point calculated on point 2.

Current Status

I successfully implemented Thin Plate Spline in c++ language, starting from these code samples found on the web:

Problems

Now I'm stuck on point 2. and 3.:

  1. I need to find intersection point(s) (if any) between a 3D line/ray and the TPS surface (my 3D line data is given by 3d coordinates and direction vector)

  2. I need to find the surface normal vector at point calculated on previous step

Any ideas? Thanks

Update

  1. I made my own TPS implementation and it is working fine so far.
  2. My surface model does not have any bounds. Ray is most likely Z-dominant, which means it will intersect TPS in most cases. Sure I'm able to calculate a rotation matrix to project the ray onto TPS. Indeed I now use this approach to find the TSP surface normal at a given point: I evaluate the TPS in some sampling points (xi,yi) around a circular neighborhood of the point of interest, I calculate the vectors connecting the point of interest and to each neighbor point, then I calculate the cross product for each connecting vector, then I the avarage all the cross products to get an estimation of the surface normal. This calculation however is done by defining a circular neighbor of a point, which means it is an approximation; I would like to have the exact surface normal analytic solution, that's why I was asking about derivative at point 3. of my topic:
  3. That's my problem now: it is difficult to me to calculate the derivarives of this equation. Seems like I'm stuck on this.
1
stackoverflow works better for questions that can be solved instead of opinions or ideas, try sharing your current code or solution.MrAn3

1 Answers

0
votes
  1. There are plenty of implementations

  2. Generally that question do not has exact answer because intersection may not exist, may be unique, or most likely, there are infinite intersections. I suggest starting by asking some questions. Does Your surface has any bounds or "general" relation to ray? Like TPS surface lies is in form of ~ z = f(x;y) and your ray direction is most likely z dominant (or you can obtain rotation matrix that can arrange that) ? Does data allows or expect for TPS surface to be folded in domain? Are you interested in closest intersection or all in some bounds? Such assumptions will allow for faster algorithm & simplification. For example if all assumptions previously mentioned holds there can be two approaches.

-You can make binary search over the ray length to find intersection.

-You can also project point onto surface and evaluate its derivative and make step in direction of derivative and project that point onto ray and use it as next projection. It should work if surface is well behaving (no folds)

  1. TPS has derivatives, so evaluate derivatives by any scheme ex analytic, numeric to obtain surface normal by definition.