On Saturday, October 6, 2012 1:29:56 AM UTC-5, Sonic 414 wrote:
> I have a set of points in 2D space. I want to find the tangent in every point(Especially the first and last points) ... Thanks. :)
Somic414,
Reading the other posts I think you have some of your answer. I may be able to add something of value. However, tangents at the points are, indeed, not absolute. That is, there is no one answer, just like there is also no one curve.
First, for any method you choose, *you* will be on your own to determine the tangents at the ends. That is, you can make them anything you want. This is because virtually all these methods use the adjacent points to determine the tangents at a given point. Therefore, to get the curve to intercept the ends data points additional points must be added to the data. Some methods add these points in the background - that is unbeknownst to the user (my appendix examples for these curves do this). It sounds to me that you'll have to draw the curve, then play with the end tangents to get what you like.
Methods that "will do what you ask" are the Catmul-Rom (fixed 'curviness') and Kochanek-Bartels (K-B) (user variable 'curviness'). These methods will provide you with the tangents at each point - if you know how to extract them and my book should give you what you need to do it. The Catmul-Rom sets its own tangents based on the two adjacent points. The K-B does the same, but you have the ability to adjust them – either all in the same manner, or individually – in other words, you can make the tangent anything you want at each point.
For these you must simply add one additional point (of your choosing) at each end to help you (graphically) set the end tangent. These will be the (-1) point and the (N+1) point and they *may* be equal to the original end points.
I see that I used the term 'slope' instead of 'tangent' in the appendix.
The *CUBIC* piecewise LaGrange method I developed is similar, but I believe the others are better.
There are 2-D curves in my Appendix showing the behavior of almost every type I included.
Background and downloads are here:
http://home.comcast.net/~k9dci/site/?/page/Piecewise_Polynomial_Interpolation/
Direct download links:
Text
http://k9dci.home.comcast.net/~k9dci/Book/Manuscript_Ver_9b.pdf 1.9M
Appendix Catmul-Rom pg 153; K-B pg
http://k9dci.home.comcast.net/~k9dci/Book/Appendix_Ver_8b.pdf 1.7M
Happy fishing...
--
73, Steve, K9DCI USN (Vet) MOT (Ret) Ham (Yet)
Give a man a fish and you feed him for a day. TEACH a man to fish and you just increased your bait shop market.