找回密码
 快速注册
搜索
查看: 49|回复: 0

perspective & orthographic projection

[复制链接]

3149

主题

8386

回帖

6万

积分

$\style{scale:11;fill:#eff}꩜$

积分
65391
QQ

显示全部楼层

hbghlyj 发表于 2023-2-19 23:11 |阅读模式
GeoGebra 3D的默认投影为 正交投影 (orthographic)
Screenshot (2).png
Asymptote: Crash Course - Current projection
假设你漂浮在一个向各个方向无限延伸的三维宇宙中。明亮的光源照亮了场景。你可以在这个宇宙中自由移动,使你能够以不同的视角看待一切。
此时,出现了一个巨大的网格,上面有一个球体。从您的角度来看,它看起来像这样:
size(300);  import three;  currentprojection = perspective(1.7,0.5,0.6); currentlight = Viewport;  for (int i=-20; i<=10; i+=1)     draw((i,-20,0)--(i,10,0)); for (int j=-20; j<=10; j+=1)     draw((-20,j,0)--(10,j,0));  draw(scale(2,2,2)*unitsphere, red);
这就是透视投影的样子。基本上,就好像你漂浮在这个宇宙中,用你自己的眼睛看着这个物体。近的物体比远的物体大,平行线汇聚,最重要的是,不会头晕。

现在,假设你戴着眼镜,它削弱了你的透视感,取而代之的是一个不同的世界,一个平行线保持平行、距离较近的物体与距离较远的物体大小相同的世界。这就是你会看到的:
size(300);  import three;  currentprojection = orthographic(1.7,0.5,0.6); currentlight = Viewport;  for (int i=-20; i<=10; i+=1)     draw((i,-20,0)--(i,10,0)); for (int j=-20; j<=10; j+=1)     draw((-20,j,0)--(10,j,0));  draw(scale(2,2,2)*unitsphere, red);
这是正交投影。 这不是自然的,但是当您希望无论距离如何,所有内容都具有相同的比例时,它非常有用。

所以现在我们已经弄清楚透视和正交投影到底是什么,让我们来看看如何在Asymptote中做到这一点。

声明投影很容易:
   // Perspective
   currentprojection = perspective(camera=(x,y,z));
   // Orthographic
   currentprojection = orthographic(camera=(x,y,z));

Here, camera=(x,y,z) states the position of the camera, whose viewpoint the reader sees the drawing from. In our hypothetical universe, this would be the exact same thing as defining your position. Asymptote dictates that the $z$-axis faces up, which, needless to say, is interesting:
size(200);import three; currentprojection = orthographic(-1,-2,1); draw((0,0,0)--X, EndArrow3); draw((0,0,0)--Y, EndArrow3); draw((0,0,0)--Z, EndArrow3); label("$x$", X, X); label("$y$", Y, Y); label("$z$", Z, Z);
In any case, use currentprojection lightly. Asymptote will try to find the best projection for you, so only use it if you want to see your drawing from a different angle, or if you want to change the mode (e.g. perspective to orthographic).

手机版|悠闲数学娱乐论坛(第3版)

GMT+8, 2025-3-4 15:39

Powered by Discuz!

× 快速回复 返回顶部 返回列表