View Single Post
  #33   Spotlight this post!  
Unread 04-03-2012, 07:24 AM
dbeckwith's Avatar
dbeckwith dbeckwith is offline
Lead Programmer
AKA: Daniel Beckwith
FRC #3205 (The Patriots)
Team Role: Programmer
 
Join Date: Jan 2010
Rookie Year: 2009
Location: USA
Posts: 84
dbeckwith is an unknown quantity at this point
Re: Curve Driving Generator

Quote:
Originally Posted by theNerd View Post
How would I go about working with bezier curves as I have never worked with them in my life .
Bezier curves are defined by a formula that can be generalized for any degree, but for the most common, degree 3, the equation for any point along the curve is: B(t) = (1 - t)^3 * P0 + 3 * (1 - t)^2 * t * P1 + 3 * (1 - t) * t^2 * P2 + t^3 * P3 for any t between 0 and 1, inclusive. So you have four control points in a degree 3 curve which you can use to define the shape of the curve, its endpoints, and its tangents at the endpoints (the applet Ether linked to are great for seeing how these affect the curve). I'm not a math genius like Ether so I'm not really sure exactly how to implement them into your question, but in my experience with computer graphics I've found that Bezier splines are easier to control in a way that makes sense than cubic splines.

The Wikipedia article on Bezier curves has a lot of cool information on them: http://en.wikipedia.org/wiki/Bezier_curves

Also if you needed to get the slope of a Bezier curve at some point for your pathing algorithm, I found this: http://www.cs.mtu.edu/~shene/COURSES...ezier-der.html
__________________
q = (2*b) | ~(2*b);

if (life.getLemons() != null) this.lemonade = new Drink(life.getLemons());
else throw new NoLemonsException("What now?");