How can I rotate a curved rectangle?

1 vue (au cours des 30 derniers jours)
Laleh
Laleh le 10 Avr 2013
Modifié(e) : Adam Danz le 22 Mar 2021
I have created a curved rectangle and now I want to rotate it. I know I can not rotate using rectangle commande. I also tried to plot the rotated rectangle using "fill" but then I can not add curvature.
So, the question is, How can I plot a rotated curved rectangle?
  2 commentaires
Adam Danz
Adam Danz le 10 Jan 2021
Modifié(e) : Adam Danz le 22 Mar 2021
rectangle2() from the file exchange can rotate a curved rectangle.
rectangle2([x,y,w,h],'Curvature',[a,b],'Rotation',deg);
Examples:
Antje Nuthmann
Antje Nuthmann le 20 Mar 2021
rectangle2 works well, thanks!

Connectez-vous pour commenter.

Réponses (2)

Friedrich
Friedrich le 10 Avr 2013
HI,
so you have a set of points (x,y) describing a curved rectangle. I guess the keyword here is rotation matrix:
Create the Matrix accoringly and multiple it with your (x,y) values to get the rotated rectangle.
  6 commentaires
Laleh
Laleh le 10 Avr 2013
Yes that is my point, so what should I do now? :(
Friedrich
Friedrich le 11 Avr 2013
You need to create your own version of the rectangle function which calculates the curved rectangle from scratch. Afterwards you can plot it an rotate it.

Connectez-vous pour commenter.


Rafal Samborski
Rafal Samborski le 10 Avr 2013
Modifié(e) : Rafal Samborski le 10 Avr 2013
If it's ony about plotting try to call this after your plot function:
alpha = 30; set(gca, 'View', [alpha 90]);
  1 commentaire
Laleh
Laleh le 10 Avr 2013
After the "rectangle" command when I add your code, it rotates the axis of the plot, and does not show anything inside, just white plot!!!

Connectez-vous pour commenter.

Catégories

En savoir plus sur Line Plots dans Help Center et File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by