Need some help from a blender developer...

Compiling, libraries, modules, coding guidelines and porting

Moderators: jesterKing, stiv

Post Reply
Posts: 0
Joined: Thu Apr 05, 2012 9:07 am

Need some help from a blender developer...

Post by alzab » Thu Apr 05, 2012 9:35 am


I'm currently writing a C++ program that uses a (bezier) curve created in blender. I need to be able to export this curve from blender and evaluate it within the program. Currently I use python to export it in the form (knotx,knoty,knotz,control1x,control1y,control1z,control2x,control2y,control2z), and use De Casteljau's algorithm to evaluate points along the curve and tangents to these points, all within the program in real time.

This all works fine. However, I currently have no idea how to calculate curve "normals", exactly like blender does on the 'MINIMUM' twist setting for curves. This is important since a camera needs to lock onto this curve, and tangential information alone isn't enough to define a 3D orientation. I have to calculate these normals exactly like in blender on the minimum twist setting, since the curve needs to match a mesh that is exported separately (the camera follows the mesh, almost like a first-person rollercoaster perspective if you like).

With a bit of digging around I came across this: ... s_proposal

But this was the closest thing I found on the web to describing what blender does behind the scenes, and I'm fairly sure it's been updated since. (this proposes a new method, and mentions nothing about the 'MINIMUM' twisting setting) I've tried trawling through the source code, but to little avail as of yet, unfortunately.

SO, this is why I'm asking here. I'm dearly hoping that a blender developer can explain the algorithm behind the 'MINIMUM' twist setting for a blender curve (bezier). (Also I'm interested to know how the manual twisting of curves fits into all of this too)

Many thanks in advance!


Post Reply