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 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.

Comments and Ratings (2)

@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?

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


Providing missing function vertToPos(); necessary for one of the examples. Thanks to Gary for pointing out the omission.

Updated license

Extends, replaces the original rotatedRectangle file.

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