forum.alglib.net
http://forum.alglib.net/

Fastest "curve over set of points" (no polynoms)
http://forum.alglib.net/viewtopic.php?f=2&t=587
Page 1 of 1

Author:  UL7AAjr [ Mon Jun 11, 2012 10:43 am ]
Post subject:  Fastest "curve over set of points" (no polynoms)

Hello!

Time to time, I'm working on "curve over set of points". And few days ago I found very easy and fast way to build a curve over points. Not sure that it's new one, but never seen it before. Of course, it can be another invention of bicycle. So, would be interesting to know: Is it something new or not?
Now algorithm. It works by generating two additional point on every segment in one pass. It processes corner by corner.

Attachment:
logic.jpg
logic.jpg [ 31.61 KiB | Viewed 4740 times ]



Let see how it processes one corner with three points A B C.
1. Calculate location of additional point "e" located on segment [AB]. Distance from "B " to "e" is 1/3 of segment [AB] length.
2. Calculate location of additional point "f" located on segment [BC]. Distance from "B " to "f" is 1/3 of segment [BC] length.
3. Find a pseudo centroid point "D" of triangle [eBf]. At first time, I just use real centroid, but for best results it should be shifted.
4. Calculate distance and direction to shift "D" point to position of "B" point. Use calculated values to shift "e" and "f" , it produces "A1" and "C1" points.
5. "A1", "B" and "C1" points - is new points of curve.
Here is results (two passes)

Attachment:
demo.jpg
demo.jpg [ 68.49 KiB | Viewed 4740 times ]


And with nodes
Attachment:
demo1.jpg
demo1.jpg [ 45.85 KiB | Viewed 4740 times ]


Best regards,
Igor Tyugay.

PS: there is no any problems to use same logic to work with 3D curves.

Page 1 of 1 All times are UTC
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/