# how to set the length of a control point without changing its direction

Considering the image above, I want to manually increase the length of a bezier curve control point (C3 to newC3) by a certain value (say 0.5f) while preserving it’s original direction. How can I do this?

You normalize the vector "C4_C3" and multiply it by the new length it should have. Subtracting the coordinates of C4 with the coordinates of C3 (or the other way around) gives you the gradient between those two points. Normalizing it scales this gradient down so its length is 1. Multiplying with the new length results in a new gradient that you can add to your C4 coordinates.

normalization:

x = x / sqrt(x²+y²);
y = y / sqrt(x²+y²);


so in total:

x = c4.x - c3.x;
y = c4.y - c4.y;
x = c4.x + (x / sqrt(x²+y²)) * newLength;
y = c4.y + (y / sqrt(x²+y²)) * newLength;