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:
GeometricTools library (great quality both on code style and documentation)
TPSDemo by Jarno Elonen
Problems
Now I'm stuck on point 2. and 3.:
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)
I need to find the surface normal vector at point calculated on previous step
Any ideas? Thanks
Update
- I made my own TPS implementation and it is working fine so far.
- 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:
- That's my problem now: it is difficult to me to calculate the derivarives of this equation. Seems like I'm stuck on this.