File Exchange

image thumbnail

rotatedObject: Rotate any 2D object by handle, vertex list, or bounding box

version (6.38 KB) by Brett Shoelson
Easily rotate any 2D object: rectangles, ellipses, imrois, xy-coordinates


Updated 30 Jan 2018

View Version History

View License

Rotate any 2D object (specified by its vertices or by handle(s) to an imroi object) by angle theta (in degrees), about any center of rotation.
Create rotated rectangle or ellipse specified by its (unrotated) bounding box.
Specify center of rotation by point, or by corner or centroid of bounding box.
Includes shortcut functions rotateRectangle and rotateEllipse for convenience.

Cite As

Brett Shoelson (2021). rotatedObject: Rotate any 2D object by handle, vertex list, or bounding box (, MATLAB Central File Exchange. Retrieved .

Comments and Ratings (4)

Brett Shoelson

@Ahmed: xnew and ynew are outputs of the rotatedObject function. width and height should remain unchanged. Unless I am misunderstanding your question...

ahmed shahin

thanks very much for your code, i am asking for if after orientation i would like to get a new rectangular points [xnew,ynew, width , height],

Brett Shoelson

@ramesh: if you've found a bug in my code, I need more to go on than that to have any hope of fixing it. Can you show me how you're calling it, and what is going wrong?

Ramesh kancharapu

your code is not working can you please update it will be great help
thank you

MATLAB Release Compatibility
Created with R2014b
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

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

Start Hunting!