Basic information on Beziers.

Started by
2 comments, last by LilBudyWizer 19 years, 7 months ago
I’ve come to this site looking for information on the starting-point of Bezier curves because I have been assigned to recreate a curve editor. I don’t know why I got this assignment, but whatever. So, I searched many topics under many groups in this forum. The problem is, everytime anyone posted here asking for help on Bezier curves, the next post always (without fail) stated something along the lines of, “Bezier curves aren’t what you want. Try Catmull-ROM/Cubic Splines/Etc.…”. Then the topic-starter says “Okay thanks,” and that ends the thread. So, I walk away from each thread completely empty-handed. I can’t dive much deeper because I am on office hours. So, can anyone help me get a handle on the concept of Bezier curves/how they work/basic formulas/anything? A tutorial somewhere that explains what each tangent actually does and how they are used to create the curve into the next node? I don’t need much more than an overview and probably not too technically deep insight. I have the source code of their original editor, which helps some, but sifting through the parts of code that deal with their Beziers and trying to eliminate the parts that deal with other miscellaneous areas of the interface is not a good way to get a solid base on bezier curves (though I will be utilizing it as a learning resource along with any help from these forums anyway). Please don’t tell me I need to use some other form of curve. Not only am I REQUIRED to use Bezier curves, I also have to do them in a specific way (to match their game engine). Thank you. L. Spiro [Edited by - YogurtEmperor on September 20, 2004 2:24:53 AM]

I restore Nintendo 64 video-game OST’s into HD! https://www.youtube.com/channel/UCCtX_wedtZ5BoyQBXEhnVZw/playlists?view=1&sort=lad&flow=grid

Advertisement
Most people use cubic bezier curves. However, find out what type of bezier curve the guys who wrote your engine are using. Most likely it's cubic (ie. it has 4 control points). Each cubic bezier curve represents a segment of an entire spline/path under most engines.

The cubic bezier curve has 4 control points. The curve passes through the first point and the last point. The line from the 1st point to the 2nd point represents the tangent of the curve at the 1st point and the line from the 4th point to the 3rd point represents the tangent of the curve at the 4th point.

A point on the cubic bezier curve is represented by the following parametric equations:

x = [1.(1-t)^3.x0] + [3.(1-t)^2.(t).x1] + [3.(1-t).(t)^2.x2] + [1.(t)^3.x3]

and similarly for y

y = [1.(1-t)^3.y0] + [3.(1-t)^2.(t).y1] + [3.(1-t).(t)^2.y2] + [1.(t)^3.y3]

and this works for any dimension you need. (sorry about the shocking ascii equations - just write them out and you will see a pattern). t ranges from 0..1. If you substitute 0 for t in the equations you will get (x0,y0), if you substitute 1 for t in the equations you will get (x3,y3).

So, to recreate the curve, you simply sample a couple of points for t in the range 0..1 and draw them (or draw lines between them). But the implementation is up to you.

Also, here is a link you should follow:
http://astronomy.swin.edu.au/~pbourke/curves/bezier/

In general, just do a search on google for 'bezier' or 'bezier curve' or something like that.

Hope that helped
do unto others... and then run like hell.
I think it has helped (haven’t had time to get into it much yet) but since I am not hip with today’s definitions on Bezier curves I can’t say exactly what type they are using.

Each control point has two tangents, but those tangents only affect the lines between it and the next control point.
It isn’t like some I have seen where if you modify the left tangent point, the line is modified on BOTH sides of the control point.

In other words, each control point has a left and right tangent, and moving the left tangent only changes the line to the left of the control point, creating sharp edges at the control point if necessary.

I don’t think this describes a 4-point tangent system you mentioned (I believe it is 2-point).

I restore Nintendo 64 video-game OST’s into HD! https://www.youtube.com/channel/UCCtX_wedtZ5BoyQBXEhnVZw/playlists?view=1&sort=lad&flow=grid

No, the endpoints of a segment are the 1st and 4th control points. The second and third control points control those tangents. The editor most likely draws the tangents and has a handle at the end of them for manipulating the shape of the curve. Those handles are the second and third control points.
Keys to success: Ability, ambition and opportunity.

This topic is closed to new replies.

Advertisement