Bezier curves via subdivision
BlitzMax Forums/BlitzMax Programming/Bezier curves via subdivision
| ||
Hi, I must admit that I don't understand bezier curves. I was told by an online contact that a bezier curve may be approximated via subdivision of the sides of a polyline. Can anyone confirm this? Maybe provide an example too if possible... |
| ||
Yes you can. It's a much easier approach to implement also. As for examples, I'm not at a computer with blitzmax to play around with it. But look up LaPlace vector and that should get your started. My graphics professor probably has some stuff still on the web regarding subdivision. Here is one of his papers http://anglee.org/6491/proj1/Project1Report.pdf#search=%22laplace%20vector%20jarek%22 here is a student's project illustrating the process http://www-static.cc.gatech.edu/~lena007/cs4451/p1d.html |
| ||
Yeah, indeed you can subdivide. But for speed, look up `forward differencing` bezier curve routines, they are much faster. |
| ||
Ah great thanks for the information! |
| ||
Well I'm having issues with implimentation, I thought lists would be a good choice to hold data because of their flexable nature. However, when I try to save a values to a list, it acts as though it were expecting an object rather than a float. Also how do I refer to an index in a list? |
| ||
lists hold objects. They can't hold primitives. You would have to make a type that wraps around a float in order to hold it in there. Considering you would have to have atleast 2 dimensions for this to work, why not make a 2D vector class? Check the documentation on indexing into an list, it's in there. |
| ||
@Ryan, Not sure what you would like to do but if you want to make trajectories with your splines maybe you could use Matt's spline editor : http://www.blitzbasic.com/Community/posts.php?topic=52906 It is then not difficult to use them with a Type of your own if you want to have several objects going along the same curve. |
| ||
Link to Matt's spline editor is dead. :( |
| ||
ah, then try this one : ( hope Matt doesn't mind the direct linking ) http://www.shmup-dev.com/attachments/splinemagic.exe |
| ||
Try this: http://www.blitzbasic.com/codearcs/codearcs.php?code=1760 |