Archived

This topic is now archived and is closed to further replies.

ZModeler

Inserting point into spline curve

Recommended Posts

ZModeler    122
Hi. I have a spline curve and want to insert a point into this curve. I have a curve segment (from p1 to p2) with tangents vectors in these points (t1 and t2) and U value (ranging from 0 to 1). I''ve tried variouse uproaches but haven''t succeed inserting a point into this segement so the shape of curve doesn''t change. as far as i expect, tangents t1 and t2 length shoud decrese to U and (1-U) respectively, the point position is on the hands, but what about tangents in this point? the "incoming" and "outgoing" tangents'' length of new point is the actual question. anyone?

Share this post


Link to post
Share on other sites
grhodes_at_work    1385
Yeah, this is called "degree elevation" and you google on that + "spline curve" to get some links.

Your assumption that the tangent lengths should change is wrong. The tangent lengths are a function of curvature, which shouldn''t change if you properly insert a point while maintaining the same exact curve shape. The incoming and outgoing tangents should be equal, since you''re inserting a knot where the curve was at least C1 continuous (slopes on both sides in the same direction and same length), and they should be equal to the tangent of the original curve at that U.

Are you creating an interpolating spline?

Graham Rhodes
Senior Scientist
Applied Research Associates, Inc.

Share this post


Link to post
Share on other sites
ZModeler    122
yup. not exactly. Encrease of degree is not my case, since my siplines have the same degree. may be i''ve explained not too clear what i need. I have the following spline
http://www.zmodeler.com/screens/sourcecurve.gif
and want to insert new point to achieve the following:
http://www.zmodeler.com/screens/resultcurve2.gif
as was explained above, i add a point and decrese length of tangents (if i don''t do it i get something like this:
http://www.zmodeler.com/screens/resultcurve1.gif

"degree elevation" is probably what i look for, but looks like wrong curves class.

Share this post


Link to post
Share on other sites
ZModeler    122
nevermind. solution found. It came from geometrical explanation of Casteljau algorithm and some tests
--quote--
The de Casteljau algorithm can also be explained geometrically: If we divide the edges of the control polygon in the ratio (1-[`u]) to [`u], connect the resulting points by straight lines, divide the new edges again in the same ratios, and repeat this process a total of n times, then the dividing point obtained in the last step is the point on the curve corresponding to [`u].
--end_quote--

the guess was ''and what about previouse points?''. on previouse iteration the control points are obtained for this [''u].

Share this post


Link to post
Share on other sites
grhodes_at_work    1385
quote:
Original post by ZModeler
yup. not exactly. Encrease of degree is not my case, since my siplines have the same degree. may be i''ve explained not too clear what i need.


You know, I thought about that after I posted. Actually, you really want to keep the degree of splines in general to something lower than say, 7, otherwise in some circumstances there can be numerical errors evaluating the spline.


Graham Rhodes
Senior Scientist
Applied Research Associates, Inc.

Share this post


Link to post
Share on other sites