在MATLAB中使用plot3绘制圆锥 [英] Using plot3 for drawing cones in MATLAB
问题描述
我正在寻找一种在3D冲浪图中的特定位置绘制圆锥的方法.圆锥体是否也可以达到50%透明?
I'm looking for a way to draw a cone at a specific location in a 3D surf plot. Would it also be possible to have the cone 50% transparent?
现在,我正在使用surf
函数绘制基本的3d环境.我正在尝试使用功能plot3
在特定位置绘制具有特定尺寸的圆锥.
Right now I'm drawing a basic 3d environment using the surf
function. I'm trying to use the function plot3
to draw a cone with specific dimensions at a specific location.
推荐答案
下面的代码通过使用t=[0;1]
将圆柱体捏在零和一之间来创建圆锥体.然后使用alpha(...)功能风扇设置透明度.要重新定位圆柱体,必须在x,y或z上添加一个值或执行旋转操作(超出此答案的范围).
The following code creates a cone by pinching a cylinder between zero and one with t=[0;1]
. The alpha(...) function fan then be used to set the transparency. To reposition a cylinder you must add a value to the x,y, or z or perform a rotation (beyond the scope of this answer).
t = [0;1];
[X,Y,Z] = cylinder(t);
figure;
clf;
surf(X,Y,Z);
alpha(.5)
hold all
surf(X+1,Y,Z);
alpha(.5);
axis equal
这篇关于在MATLAB中使用plot3绘制圆锥的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!