# Has anyone created bezier splines?

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 01/11/2012 at 13:55, xxxxxxxx wrote:

User Information:
Cinema 4D Version:   13
Platform:   Windows  ;
Language(s) :     C++  ;

---------
This is probably a long shot.
But has anyone ever created their own bezier type spline code in C++?

I'd like to learn how to draw a 2D cubic bezier spline in the screen matrix space. Using the C4D Draw2Dline() function to draw the initial base line to start off from.
I know how to create the 2Dline. But converting that line into a cubic bezier line is proving to be very difficult.

I've looked around for C++ examples. But they are hard to find.
And when I do find one. The maths used are over my head.
I tend to grasp math formulas much better when they are written as C++ code. Instead of written in math notation with all those crazy weird symbols. So most tutorials out there are too hard for me to understand  the math involved.

-ScottA

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 08/11/2012 at 00:42, xxxxxxxx wrote:

Do you need a specific type of spline, or do you just want something "splinelike"? In the second case, I would suggest that you look into subdivision techniques. The math behind, e.g., catmull-clark surfaces tends (in my opinion) to be a bit easier than that for explicit spline curves and surfaces. Although most texts on subdivision techniques focus on surfaces, it is fairly straightforward to translate the concepts to curves as well.

A few years ago I gave a lecture about splines and surfaces at my university. You can find the lecture notes here:

http://www.it.uu.se/edu/course/homepage/grafik1/vt09/Lectures/Lecture13.pdf

The notes are quite math-heavy, but maybe you can find something useful in there anyway.

Best regards
/Filip

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 08/11/2012 at 08:44, xxxxxxxx wrote:

Thanks Filip.

I think I'm most interested in cubic splines. Because what I want to do is be able to draw a multi-segment spline(multiple lines)  that are smooth. But I don't really need to have the handles for each point.

Your notes pretty much shows the same info I'm finding through Google. Which gives me good overall generalized theory. But not enough to write the C++ code.
I'm starting basically from zero. So I need lots of hand holding and someone to start from zero and not skip ahead as if I already know how to do it. And nobody on the internet has done a beginners hand holding type of tutorial on how to create splines in C++.
Imagine looking at the formulas for spline and saying to yoursef. Why the heck are they using time(t) in the equation? That's how green I am at this.

So far I've only managed to draw a single 2Dspline(multiple lines) on the screen using the SDK Draw functions.
I have a master array. And when the LMB is clicked it creates a new array containing the mouse XY coords. in it. And inserts it into the master array. Then I do a loop to draw the lines using those points connecting to each other end-to-end. And that works fine so far.
But then I get stuck on the smoothing of the points where the lines connect to each other.

-ScottA