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 [ 31.61 KiB | Viewed 4738 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 [ 68.49 KiB | Viewed 4738 times ]
And with nodes
Attachment:
demo1.jpg [ 45.85 KiB | Viewed 4738 times ]
Best regards,
Igor Tyugay.
PS: there is no any problems to use same logic to work with 3D curves.