Now with vectors; fitting a curve to three points

I’ve previously discussed a simple approach for fitting a curve to three points. However, the previous approach was lengthy and used several geometric functions. For things like 2D triangulation, this approach is lacking in the area of performance…

So, I re-did the calculations using vector math; it’s now an order of magnitude faster. The circle can now be found using only basic math calculations and a single square root. You won’t notice a performance difference with only a single circle, but here’s a demo as a proof of concept:

Drag the green points around to see how the curve fits different sets of points.

Source Code: (View) (Download)

This entry was written by Mathew Eis , posted on Tuesday April 21 2009at 10:04 pm , filed under General . Bookmark the permalink . Post a comment below or leave a trackback: Trackback URL.

One Comment on “Now with vectors; fitting a curve to three points” - Leave your comment below:

  1. [...] I’ve posted a better version here using only vector [...]

Leave a Reply