How to rotate points on 2D coordinate systems

633 views (last 30 days)
I have some points on a 2D Cartesian coordinate system. I want to rotate all these points 90 degrees counterclockwise. What is the best solution? (When I work with 3D coordinates, I use “view” to change the view direction, but apparently, it doesn’t work with 2D coordinates)

Accepted Answer

John Chilleri
John Chilleri on 6 Feb 2017
Hello,
You can rotate your points with a rotation matrix:
Here's a simple implementation,
% Create rotation matrix
theta = 90; % to rotate 90 counterclockwise
R = [cosd(theta) -sind(theta); sind(theta) cosd(theta)];
% Rotate your point(s)
point = [3 5]'; % arbitrarily selected
rotpoint = R*point;
The rotpoint is the 90 degree counterclockwise rotated version of your original point.
Hope this helps!

More Answers (1)

Asma Rahmani
Asma Rahmani on 16 Jul 2018
heyy, i want to divise an image with matrix rotation to 6 segments (theta=60degrees),the point is to incrimente a new segment with the last segment.can u help me please

Community Treasure Hunt

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

Start Hunting!