2
\$\begingroup\$

I am using the code from the question Adding functionality to make individual anchor points of bezier continuous or non-continuous to create bezier curves (I added a line renderer).

How can I rotate the whole bezier curve (which may contain multiple cubic Bézier segments) around a point?

Please note that the rotation point could be any point including the one of the curves anchor points or control points.

\$\endgroup\$
2
\$\begingroup\$

Any linear transformation of a Bezier curve can be accomplished by applying that linear transformation to its anchor & control points.

This extends to Bezier splines, consisting of multiple Bezier curve segments.

So, to rotate a spline by the rotation R, simply rotate each anchor & control point by R.

Keep in mind that if you store your control points as offsets from the anchor points, rather than as explicit positions on their own, you'll need to transform them as vectors instead of as points (ie. if using a homogeneous matrix, the final component of the vector should be 0 instead of 1 so that it ignores translation)

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.