I’ve been trying to achieve an effect like the one that is achieved here., I’ve mostly been able to get it to work, but there’s this strange offset that I’m not really sure why it’s there. Here’s the code I’ve written so far.
vec3 v;
vec3 p0 {1,0,0}, p1 {-1, 0, 0};TOGGLE(DBG);
SLIDER(pox);
SLIDER(p1x);
SLIDER(bend_factor, 0.001…1);
SLIDER(pivot);vec3 gen(float t){
p0.x = pox;
p1.x = p1x;float lineLength = abs(p0.x - p1.x);
float radius = (lineLength / (bend_factor * two_pi) );float arcLength = (bend_factor * two_pi);
vec3 circCenter = { p0.x + (lineLength * pivot), p0.y + radius, 0};
float adjust = (1-bend_factor) * half_pi;
float angle = (pi + adjust) + arcLength * tri( 2 * t);v.x = radius * cos(angle) + circCenter.x;
v.y = radius * sin(angle) + circCenter.y;if(t < 0.5) return v;
else return blend((t*2), {pox, -0.1,0}, {p1x, -0.1,0});
}