Plotting a normal plane with rotation
1 view (last 30 days)
Show older comments
I am currently trying to plot a normal plane without rotating the plane itself. The code should be able to handle any normal vector except when normal=[0 0 0]; As of now, I have managed to generate the normal plane but had no idea how to prevent the plane itself from rotating. The desired outcome is the black color box. I have attached the code below for your references. The plane is supposed to be tilted upwards instead of rotating. Thank you.
%% Starting of code
PlaneOrigin=[1 0 0]; PlaneNormal=[1 1 1];
w = null(PlaneNormal); % Find two orthonormal vectors which are orthogonal to SourcePlaneNormal [P,Q] = meshgrid(-1:1); % Provide a gridwork (you choose the size) X = PlaneOrigin(1)+w(1,1)*P+w(1,2)*Q; % Compute the corresponding cartesian coordinates Y = PlaneOrigin(2)+w(2,1)*P+w(2,2)*Q; % using the two vectors in w Z = PlaneOrigin(3)+w(3,1)*P+w(3,2)*Q; hSurface=surf(X,Y,Z); set(hSurface,'facealpha',1,'edgealpha',1,'FaceColor','green'); axis auto; axis equal;
0 Comments
Answers (0)
See Also
Categories
Find more on Surface and Mesh Plots 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!