Maple第六章 二维与三维图形(2)

# (本人使用maple2023.0版本!!!)(参考《Maple教程》何青 王丽芬 编著)
# 6.2三维图形
# 在maple中绘制二元函数的图像,可以得到三维空间中的曲面,利用plot3d命令进行绘制,同样也可以使用图形生成器交互式生成图像
# plot3d的用法和plot很类似
# 6.1.0导入及基本操作
> plot3d(sin(x*y), x = -2 .. 2, y = -2 .. 2);

# 我们输出图形之后,可以:
# 1.选中图像,右键,选项中可以调整三维图像的绘制方式;
# 2.选中图像,在右侧上下文菜单面板中调整图像的绘制方式.(旧版本中只有第一种方式)
# 3.通过代码实现
> setoptions3d(style = patch);
> plot3d(x^2 - y^2, x = -1 .. 1, y = -1 .. 1, axes = boxed);

# 使图像旋转:
# 1.鼠标放到图像上时候,鼠标变成可以旋转图形的箭头,左键点击移动就可以旋转图像,非常方便
# 2.利用orientation=[a,b]进行旋转,标准状态下视角度数为[45,45]
> plot3d(sin(x*y), x = 0 .. 7, y = 0 .. 7, axes = framed, grid = [60, 60], scaling = constrained, orientation = [-45, 60]);

# 6.1.1参数方程
# 还是常规操作,通过球的参数方程绘制球的图像
> plot3d([sin(phi)*cos(theta), cos(phi)*cos(theta), sin(theta)], phi = 0 .. Pi, theta = 0 .. 2*Pi, scaling = constrained);

> with(plots);
> tubeplot([2*sin(t), 2*cos(t), t/3], t = -1.5*Pi .. 2*Pi, orientation = [45, 68]);

> tubeplot([-t^1.5/5, 3*cos(t), 3*sin(t)], t = 0 .. 8*Pi, radius = t/8, scaling = constrained, orientation = [107, 56], grid = [60, 15]);


# 6.1.2球面坐标
# 球面坐标(Cartesian)高数中有讲过,这里不再赘述,下面是一些实例,对应命令可以使用spherplot
> sphereplot((4/3)^(theta*sin(phi)), theta = -1 .. 2*Pi, phi = 0 .. Pi, scaling = constrained, style = patch);

# 同样的,sphereplot命令也可以绘制参数方程图形,如:
> sphereplot([exp(s) + t, cos(s + t), t^2], s = 0 .. 2*Pi, t = -2 .. 2, scaling = constrained, style = patch);


# 6.2.3柱面坐标
# 通常利用Cartesian z~坐标,使用命令cylinderplot
> cylinderplot(theta, theta = 0 .. 4*Pi, z = -1 .. 1);

# 柱坐标也同样可以绘制圆锥,原理是令r等于z,令theta遍历圆周即可
> cylinderplot(z, theta = 0 .. 2*Pi, z = 0 .. 1);

# 同样适合参数方程,这里不再绘制了
# 6.2.4三维空间离散数据图形
# style=point选项可以变为离散数据
> plot3d([sin(s)*cos(t), cos(s)*sin(t), t], s = 0 .. 2*Pi, t = 0 .. Pi, grid = [80, 20], shading = none, scaling = constrained, style = point);

# 也可以绘制离散数据
> data := [seq(evalf([t/100, sin(t/40), cos(t/40)]), t = 0 .. 1000)];
> pointplot3d(data, axes = boxed);

# 也可以使用listplot3d或者surfdata命令进行绘制
> listplot3d([[0, 0, 1, 0, 0], [0, 0, 1, 2, 2], [0, 1, 2, 1, 0], [0, 2, 3, 2, 0]], axes = frame, style = hidden, color = black, orientation = [45, 11]);

> setoptions3d(style = hidden, color = black);
> data1 := [seq([seq([i, j, evalf(cos(sqrt(i^2 + j^2)/2))], i = -5 .. 5, 0.5)], j = -5 .. 5)];
> surfdata(data1, axes = frame, labels = [x, y, z]);

# 在seq命令中给出参数范围后可以设置步长,可以使得到的图像更精细,网格更小.
# 在maple教程这本书中采用的mapleV版本上使用的是seq2这个命令,但是我在实际操作中并不能使用该命令,在检索中也搜不到seq2这个命令,旧版本的maple中seq命令没办法修改步长,在2023.0这个版本中可以修改步长,也就不再需要seq2这个命令了.
# 6.2.5曲面的着色
# 最后关于图像的着色,分为以下四个部分:
# 1.shading从控制曲面着色的几种算法中选择一种着色
# 2.color定义一个函数,可以按照x,y坐标进行颜色着色,color和shading不能同时使用,但是可以互相代替
# 3.light指定一个或者几个光源进行照射曲面,产生不同的着色效果,也可以使用多个光源进行照射
# 4.ambientlight环绕光源照射
# 比较简单,可以帮助我们更好的绘制图像.
> p := plot3d([sin(s)*cos(t), cos(s)*cos(t), sin(t)], s = 0 .. Pi, t = 0 .. 2*Pi, scaling = constrained, color = white, orientation = [38, 75], style = patch);

> display(p, light = [60, 45, 1, 0, 0], light = [60, -45, 0, 1, 0], light = [135, 0, 0, 0, 1]);


 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值