Understanding implicit surface plot behavior

3 views (last 30 days)
Matt J
Matt J on 11 Mar 2021
Edited: Matt J on 11 Mar 2021
Here is some code that plots an implicit infinite, tilted cylinder.
Q=diag([0,1,1]./3^2);
axis([-5 5 -5 5 -5 5])
h1=fimplicit3(@(x,y,z) quadform(x,y,z,Q) ,'EdgeColor','none','FaceAlpha',0.3);
view([-2,11])
xlabel X, ylabel Y, zlabel Z
T=makehgtform('axisrotate',[0 1 0],pi/4);
h1.Parent=hgtransform('Matrix',T);
My first question is, why doesn't the cylinder, which is infinite, extend to the axis limits?
My second question is, below is the same code again, except at the very end, we double the extent of the axes. Why does the cylinder become invisible when this is done?
figure;
axis([-5 5 -5 5 -5 5])
h2=fimplicit3(@(x,y,z) quadform(x,y,z,Q) ,'EdgeColor','none','FaceAlpha',0.3);
view([-2,11])
xlabel X, ylabel Y, zlabel Z
T=makehgtform('axisrotate',[0 1 0],pi/4);
h2.Parent=hgtransform('Matrix',T);
axis([-5 5 -5 5 -5 5]*2) %<----makes the cylinder disappear!
function d=quadform(x,y,z, Q)
xyz=[x(:).'; y(:).'; z(:).'];
d=reshape( (sum((Q*xyz).*xyz)-1), size(x));
end

Answers (0)

Community Treasure Hunt

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

Start Hunting!