2
$\begingroup$

I am currently trying to write a python script for getting the controllpoints of a Bezier curve. I want to use this points in a game, so I can reconstruct the curve there.

Getting points with a python script is easy, but the only thing I can get are two (or more) points on the curve itself - this is not what I want. A Bezier-curve is defined by controlpoints where only start- and endpoint lie on a curve, and at least one point should be outside of it. Those points also make up the convex hull of the curve.

So my main question is: How can I get the "real" controlpoints of the curve? (Not only the ones with the handles, which lie on a curve).

Additional question: I can get those points from a NURBS-Curve, but can I make a NURBS curve behave like a bezier curve? (When I click the "Bezier"-Checkbox in the "Active-Spline" panel, it doesn't look to me like a proper Bezier curve, as the endpoints don't lie on the curve.

Edit

For clarification, what I would prefer to use is a Bezier curve. What I want for that curve, is 4 control points like the NURBS curve has (= the 4 points of the orange bounding polygon as seen in the NURBS-picture). (How) can I get those points for a Bezier-curve in blender?

NURBS Curve with 4 control points Bezier Curve with only 2 control points

$\endgroup$
  • 1
    $\begingroup$ You will have to give a picture with marked points that you want. Your terminology is quite different of standard and it's not clear much what you want. Bezier is made up of cubic spline segments each having 4 control points. What do you mean by "real" controlpoints? And yes you can make a BSpline (nurbs) curve behave like a Bezier. $\endgroup$ – Jaroslav Jerryno Novotny Nov 15 '15 at 16:41
  • $\begingroup$ Hello, i edited my post and added two pictures for clarification. So, basically, I want the control points of a polygon (like the orange one for the Nurbs), but for a Bezier curve. (A bezier curve also has those control points by mathematical definition. But in Blender, I seem to get only two points like in the 2nd picture.) $\endgroup$ – Luigi_Papardelle Nov 16 '15 at 13:06
4
$\begingroup$

Oh I see the confusion now. The handles of Bezier curve are the "real" control points. These points form the 4 control points for the cubic segment:

enter image description here

And that's also how you convert Bezier to BSplines - per segment. You can make a BSpline segment in Blender with Path curve with 4 points.

You get the described points with text like this:

bpy.data.curves['BezierCurve'].splines[0].bezier_points[1].handle_left
bpy.data.curves['BezierCurve'].splines[0].bezier_points[1].co
bpy.data.curves['BezierCurve'].splines[0].bezier_points[1].handle_right

Like this you get all the blue points.

$\endgroup$
  • $\begingroup$ Thanks a lot. this was absolutely what i was looking for :) $\endgroup$ – Luigi_Papardelle Nov 19 '15 at 11:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.