Generating bezier curve through a set of points

AI Thread Summary
The discussion focuses on generating smooth cubic Bezier curves through a set of points, similar to the 'insert curve' function in Microsoft Word. The main challenge is determining the magnitude of the control points, while ensuring that the gradient of the tangent at each point matches the gradient of the line connecting adjacent points. The user seeks a method to automatically generate control points based on existing data points, referencing external resources for guidance. There is an emphasis on using gradients to align the tangents, but the user is uncertain about calculating the control point magnitudes effectively. The conversation highlights the need for a simpler approach to derive control point magnitudes while maintaining curve smoothness.
kanki
Messages
29
Reaction score
0
Hi there,

I am now trying to write program to generate smooth curve by using cubic bezier (4 points, 2 endpoints and 2 control points) through a set of points like the 'insert curve' function in Microsoft Word.

I am wondering how do the curve compute the magnitude of the control points of each point. I noticed that the gradient of the tangent to the curve at that point is the same as the gradient of the straight line formed from prior and next point, so I can compute the gradient of the control point, but what about the magnitude? I also noticed that in the Curve function, at each point, the control point prior to the point and next to the point are of the same magnitude.

At the end points, how do i get the direction and magnitude of the control point?

Please help me out! Thanks in advance!
 
Last edited:
Technology news on Phys.org
Thanks for the link.

What if I want to generate the control points automatically like the CURVE function in microsoft word?
 
The curve function in Word accepts user input via a window + mouse, the points are not automatic - assuming I understand you correctly.
 
What i mean is, I have a set of points, but i need to connect them using bezier curve, and define new control points by something like in this example:
http://www.efg2.com/Lab/Graphics/Jean-YvesQueinecBezierCurves.htm

Although the website above did show how to get the magnitude of the control points, is there a simpler way?

Currently I'm thinking of to make use of the gradient of prior and next point so that the tangent of the curve at that point is the same as the gradient. The only problem is that I need to solve the magnitude of the control point vector.
 
Dear Peeps I have posted a few questions about programing on this sectio of the PF forum. I want to ask you veterans how you folks learn program in assembly and about computer architecture for the x86 family. In addition to finish learning C, I am also reading the book From bits to Gates to C and Beyond. In the book, it uses the mini LC3 assembly language. I also have books on assembly programming and computer architecture. The few famous ones i have are Computer Organization and...
I have a quick questions. I am going through a book on C programming on my own. Afterwards, I plan to go through something call data structures and algorithms on my own also in C. I also need to learn C++, Matlab and for personal interest Haskell. For the two topic of data structures and algorithms, I understand there are standard ones across all programming languages. After learning it through C, what would be the biggest issue when trying to implement the same data...

Similar threads

Back
Top