orbingol / NURBS-Python

Object-oriented pure Python B-Spline and NURBS library
https://onurraufbingol.com/NURBS-Python/
MIT License
627 stars 154 forks source link

Problem: evaluate the Hessian matrix in the XYZ coordinate #54

Closed ghost closed 5 years ago

ghost commented 5 years ago

Hi,

I'm a PhD student in mechanical engineering so my questions may appear trivial to you. But from my experience with the NURBS library, I couldn't get the Hessian matrix of a curve with respect to the XYZ coordinate. It appears to me that the NURBS evaluates the derivative in the arc-length parameterized coordinate.

For example, I used NURBS to reconstruct a circle and the 1st derivative at one point seems to be the tangent vector and then the 2nd derivative is the normal vector and the 3rd derivative seems to be the tangent vector in the "negative" direction. However, the Hessian matrix I want for the circle should be [2 0;0 2] (f: x^2+y^2 = R -> gradient: [2x;2y] -> Hessian: [2 0;0 2];

I wonder if there is a way that I can evaluate the Hessian matrix with respect to the XYZ coordinate with your NURBS library?

Thank you for your great contribution and help.

orbingol commented 5 years ago

In NURBS, derivatives are evaluated w.r.t. the parametric space; i.e. dC(u) / du where C is the B-spline curve. Curves are defined in a 1-D parametric space, u. For surfaces, it is 2-D; u and v and for volumes, it is 3-D; u, v and w. The methods take these parameters as the input but not x, y, z. The parameterization doesn't have to be dependent on the arc length but it can too.

I think, to compute dC(u) / dx, you need to find a mapping like du / dx and multiply with the derivative you have found from NURBS-Python. Then, take the derivative of the result. I remember seeing similar approach in some Isogeometric Analysis papers/books. There could be another way to do it but I would try this first.