Skip to content

Instantly share code, notes, and snippets.

@rlalance
Last active January 2, 2018 15:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rlalance/ed5ba568398ddf478de022703bd64223 to your computer and use it in GitHub Desktop.
Save rlalance/ed5ba568398ddf478de022703bd64223 to your computer and use it in GitHub Desktop.
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