symmetry axis and plane
6 views (last 30 days)
Show older comments
I am learning matlab and I try to find n symmetry axis and plane of matrix (qx3) in which mass center is in origin and the points is not lie on one line. The function for findcnaxis is following but I can not get exactly results. function Y=findcnaxis(X,n,tol) if nargin==2 tol=1e-4; end s=size(X); for i = 1:s(1) R=rotate(X(i,:),-2*pi/n); Z=X*R; if isequalxy(X,Z)==1 Y(i,:)=X(i,:); end end Y=Y(1:s(1),:); function R = rotate(u,theta) % n = u/norm(u); c = cos(theta); s = sin(theta); R = [c+n(1)^2*(1-c) n(1)*n(2)*(1-c)-n(3)*s n(1)*n(3)*(1-c)+n(2)*s;... n(2)*n(1)*(1-c)+n(3)*s c+n(2)^2*(1-c) n(2)*n(3)*(1-c)-n(1)*s;... n(3)*n(1)*(1-c)-n(2)*s n(3)*n(2)*(1-c)+n(1)*s c+n(3)^2*(1-c)]; function b=isequalxy(X,Y,tol); if nargin==2 tol=1e-4; end Xs=sortrows(X); Ys=sortrows(Y); c=abs(Xs(:)-Ys(:)); b=all(c(:))<tol;
Someone can help me advice. Thank you very much in advance.
0 Comments
Answers (0)
See Also
Categories
Find more on Computational Geometry in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!