rotation around an edge
3 views (last 30 days)
Show older comments
i want to determine the orientation sequences of the stl file. does anyone have an idea. i have written the code but it revolves around a specific point not the edge..you can see the image when i rotate 90 gard around y axis
figure
gm = importGeometry("Teil1.stl");
pdegplot(gm)
vertices = gm.Vertices;
%xs3 = s3.Vertices(:,1);
%ys3 = s3.Vertices(:,2);
%zs3 = s3.Vertices(:,3);
% Define the point around which to rotate the figure
point = vertices(1,:) ; % change the values according to your desired rotation point
% Rotate the figure around the specified point
gm2 = rotate(gm,90, [1 0 0], point)
figure
pdegplot(gm2)
% Rotate the figure around the specified point
gm3 = rotate(gm2,90, [0 0 1], point)
figure
pdegplot(gm3)
gm4 = rotate(gm3,90, [0 0 1], point)
figure
pdegplot(gm4)
vertices = gm.Vertices;
gm5 = rotate(gm4,90, [1 0 0], point)
figure
pdegplot(gm5)
1 Comment
DGM
on 25 Apr 2023
It's not clear to anyone which edge you're trying to rotate around, or whether the point you chose is on that edge.
Accepted Answer
Amith
on 25 Apr 2023
Hi,
From your question I understand that you wanted the image to be rotated along a particular edge instead of a point . You can use a function called
imrotate()
to do the same.
Refer the code below to apply the same according to your needs.
% Read the image
im = imread('your_image.jpg');
% Find the edge pixels along the top edge <this you can find using your
% image>
edgePixels = [1: size(im,2); ones(1,size(im,2))];
% Rotate the image by 90 degrees along the edge
rotatedIm = imrotate(im, 90, <method> , edgePixels(:,1));
% Display the rotated image
imshow(rotatedIm);
You can use this link to read more about imshow()
3 Comments
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!