Bezier Curves |
|
Use Bezier curves in your games. [More] |
To download this library for your Linux/Mac installation, enter this on your command line:
DreamDownload byond://Mightymo.BezierCurves##version=7 Emulator users, in the BYOND pager go to File | Open Location and enter this URL:byond://Mightymo.BezierCurves##version=7 |
Mightymo: (Feb 13 2015, 3:48 pm)
My plan is to change the system to use forward differencing. While this does force the curve to use discreet intervals, it allows the entire curve to be calculated using only addition after calculating several values. I believe that this will be considerably faster than my current method or even its simplification. Regardless, I do plan to make efficiency changes, although I've been a bit too busy to do so recently.
Lummox JR: (Feb 13 2015, 10:29 am)
I would recommend some modifications to the lib, if you haven't considered them already.
The short of it is that you can precalculate a lot of coefficients that you're re-calculating on each iteration, including with three calls to a factorial proc which is probably the least efficient way to go. A number of multiplication and division operations can also be simplified out. FKI: (Jan 28 2015, 6:30 am)
Nifty and easy to use. Fanned and thanks for sharing.
Mightymo: (Jan 26 2015, 4:37 pm)
I'm not entirely certain what you mean by angle. Do you mean at the critical points of the curve? Or the angle between curves of a path? Something else entirely?
Also, it is important to note that mathematically speaking, there are a lot of curves that Bezier curves cannot match, only approximate (like circles). Mightymo: (Jan 24 2015, 10:15 am)
Increment by whatever percentage fits your needs.
for(i=0; i <= 1; i += 0.01) // 1% each loop. This is arbitrary, of course. |
Copyright © 2024 BYOND Software.
All rights reserved.