Implement own Bend function I'm trying to write a mesh deformer that bends a Cube around an axis like this:



The bend degree in figure A is 90 and something like 35 in B. So if I know my desired bend degree how can I get alpha?

I know that the distance between the vertices v1 and v2 stays the same and that i basically just have to rotate the edge alpha degrees. I can't figure out where the center of the Circle has to be, so that the bend looks organic.
It's easy to work out if you consider not that case but the angle at v3 (if the "cube" were continued past v3). By the time you get to v3, the angle is simply the desired bend angle. (That's not quite right, though: because you've got alpha on the decreasing side, it's 90 degrees minus the desired angle.) You have to split that angle equally among all the segments going along the bend direction, so the angle alpha is simply 90 degrees minus (the desired angle divided by the number of vertices). So for A, where the requested angle is 90 degrees, each vertex gets a third of that angle: alpha is (90 - 30) degrees.

For cube B, if the total bend is 35 degrees, each vertex gets just over 11 degrees, so alpha is just under 79 degrees.

This doesn't generalise to an arbitrary axis, though. It only works for bends like those in your diagram. For a more general (and more useful!) tool, it makes more sense to simply apply a 2D rotation (about the axis) to each vertex independently. Exactly what rotation to apply depends on some design decisions about how the bend should behave when the axis goes through the mesh, and how strong a bend you want to allow. The crucial point is that it's not the same rotation for every vertex: the rotation is proportional to the perpendicular distance from the vertex to the neutral line of the transformation. In your example, the neutral line is the bottom edge of each cube.