How do you fit a curve through 3D points, using splines, constrained within a volume.
Show older comments
Suppose I have an array of points in 3space,
[r1; r2; ... ; rn]
where
ri = [xi yi zi]
are it's coordinates. I want to fit a curve (a spline) in 3 dimensions between these points. However, I want the interpolated curve between points ri and rj to be constrained within a certain volume. How could I go about doing this?
EDIT: To elaborate, each pair of points exist on distinct faces of a shared tetrahedral. The interpolated curve between said points has to stay within this tetrahedral.
10 Comments
Matt J
on 24 Apr 2015
You'll need to clarify what you mean by "between points ri and rj". This is 3D, so in what way can 2 points bound a 3D region? Also, please elaborate on the shape of the volume, e.g., whether convex, as Sean was asking.
Laurence hutton-smith
on 24 Apr 2015
Matt J
on 25 Apr 2015
The interpolated curve
Originally, you said you were fitting, but now you say you're interpolating. Originally, also, you said you were fitting a line, but now you say it's a curve. We need to know definitively which it's to be.
An interpolation of the points, for example, could be done just be connecting each pair of points sharing a given tetrahedron with a line segment. Do that for all points and you get a curve that definitely stays inside the union of all the tetahedra.
Laurence hutton-smith
on 26 Apr 2015
I see. Well, you definitely cannot do what you are attempting with a cubic spline if the spline has to actually pass through the points and satisfy all the usual constraints of spline fitting (e.g., continuous derivatives at the knots). All degrees of freedom on the spline coefficients are eaten up just by satisfying those usual constraints, and you are left with no degrees of freedom with which to satisfy your tetrahedral constraints.
Laurence hutton-smith
on 26 Apr 2015
You can liberate some degrees of freedom by relaxing requirements on the splines. For example, do you need the curve to have the usual twice differentiability of cubic splines or is once-differentiability enough? What is insufficient about connecting the points with line segments? Is it simply that you need something smooth?
I think it is a tough problem, regardless.
John D'Errico
on 26 Apr 2015
Agreed, IF the interpolant is to be a smooth one.
Laurence hutton-smith
on 27 Apr 2015
Matt J
on 28 Apr 2015
Note that even once-differentiability could be impossible, depending on the locations of your ri points. For example, if one of the points lies at the corner of one of the tetrahedra, it will be impossible to pass a differentiable curve through it that doesn't exit the constrained region of the tetrahedra.
Accepted Answer
More Answers (1)
Sean de Wolski
on 24 Apr 2015
1 vote
Here are my thoughts:
If the curve you're trying to fit is linear, lsqlin can handle the inequality constraints you'll need to describe the volume (assuming it's convex). If it's nonlinear, you'll need to frame it for fmincon which can handle those constraints.
If the volume is convex to build the constraints, use vert2con or vert2lcon on the File Exchange. If it is not, I defer to Alan, Matt, or John who will hopefully chime in.
2 Comments
Laurence hutton-smith
on 24 Apr 2015
Sean de Wolski
on 24 Apr 2015
No, not quite. You can't use the equality constraints except for say an intercept.
You would still be minimizing the sum of squared errors but would have to frame the SSE calculation for fmincon.
Is the function non-linear? And is the volume convex? Those are probably good first things to know.
Categories
Find more on Quadratic Programming and Cone Programming in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


