Last active
January 2, 2018 15:46
-
-
Save rlalance/ed5ba568398ddf478de022703bd64223 to your computer and use it in GitHub Desktop.
From https://www.reddit.com/r/blender/comments/1x10ba/help_with_understanding_the_simple_deform_bend/
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static void simpleDeform_bend(const float factor, const float dcut[3], float *co) | |
{ | |
float x = co[0], y = co[1], z = co[2]; | |
float theta, sint, cost; | |
theta = x*factor; | |
sint = sin(theta); | |
cost = cos(theta); | |
if(fabsf(factor) > 1e-7f) | |
{ | |
co[0] = -(y-1.0f/factor)*sint; | |
co[1] = (y-1.0f/factor)*cost + 1.0f/factor; | |
co[2] = z; | |
} | |
if(dcut) | |
{ | |
co[0] += cost*dcut[0]; | |
co[1] += sint*dcut[0]; | |
co[2] += dcut[2]; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment