3
\$\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\$

1 Answer 1

4
\$\begingroup\$

Any affine transformation of a Bezier curve can be accomplished by applying that affine 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 offset 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\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .