Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to rotate a curve ? #41

Open
rob-777 opened this issue Apr 13, 2022 · 2 comments
Open

How to rotate a curve ? #41

rob-777 opened this issue Apr 13, 2022 · 2 comments

Comments

@rob-777
Copy link

rob-777 commented Apr 13, 2022

How can I rotate a curve ?

@ChenxingWang93
Copy link

To rotate a curve You can follow these steps:

  1. Consider your curve the parabolic arc C(u) = a_{0} + a_{1}u + a_{2}u^2

  2. Define the Matrix: Decide the point that you want to rotate. The point can be any point in the coordinate system.

  3. Rotate the Matrix: Use a rotation matrix to perform the rotation. You can also define the angle of rotation & the axis of rotation (e.g., x-axis, y-axis, z-axis), For 2D, you use 2x2 rotation matrix, for 3D, you use 3x3 rotation matrix.

Here is a brief explanation in pseudo-code for rotating a curve around the origin by an angle theta

/* Define curve points (x, y) */
curve_points[(x0, y0), (x1, y1), (x2, y2)]

/* Define angle of rotation */
theta = x degrees

/* Define rotation matrix */
rotation_matrix = [[cos(theta), -sin(theta)],
                                [sin(theta), cos(theta)]]

/* Rotate each curve point */
rotated_curve = []
for x, y in curve_points:
      x_new = x * cos(theta) - y * sin(theta)
      y_new = x * sin(theta) + y * cos(theta)
      rotated_curve.append((x_new, y_new))

: ) Not sure is right

@tordokken
Copy link

tordokken commented Feb 20, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants