1 year ago
#288590
lopsided
How to reconstruct a 3D curve from curvature using python
If the curvature of a line in 3D space is defined as the derivative of the tangent to the curve which in turn is the derivative of the coordinates of the curve, is it possible to reverse the procedure and reconstruct 3D curve coordinates from curvature + initial tangent vector + initial point vector?
Something like:
import numpy as np
x0 = np.array([0,0,0])
T0 = np.array([1,0,0])
K = np.zeros((100,3))
K[:, 0] = np.pi
# Integrate curvature to get tangent
Kv = (K[1:] + K[:-1]) / 2
T = np.concatenate([T0[None, ...], Kv], axis=0).cumsum(axis=0)
# Integrate tangent to get position
Tv = (1 / (N - 1)) * T / np.linalg.norm(T, axis=-1, keepdims=True)
X = np.concatenate([X0[None, ...], Tv], axis=0).cumsum(axis=0)
I know there are plenty of mistakes in the above, but if anyone can give me any pointers on if/how this could be done I would be very grateful!
python
numpy
3d
geometry
curve
0 Answers
Your Answer