当前位置: 首页>>编程示例 >>用法及示例精选 >>正文


Processing ortho()用法及代码示例

Processing, ortho()用法介绍。

用法

  • ortho()
  • ortho(left, right, bottom, top)
  • ortho(left, right, bottom, top, near, far)

参数

  • left (float) 裁剪体积的左平面
  • right (float) 裁剪体积的右平面
  • bottom (float) 裁剪体积的底平面
  • top (float) 裁剪体积的顶平面
  • near (float) 从原点到观察者的最大距离
  • far (float) 从原点到观察者的最大距离

返回

  • void

说明

设置正交投影并定义平行裁剪体积。具有相同尺寸的所有对象都显示相同的大小,无论它们是靠近还是远离相机。此函数的参数指定裁剪量,其中 left 和 right 是最小和最大 x 值,top 和 bottom 是最小和最大 y 值,near 和 far 是最小和最大 z 值。如果没有给出参数,则使用默认值:ortho(-width/2, width/2, -height/2, height/2)

例子

size(400, 400, P3D);
pixelDensity(2);
noFill();
ortho(-width/2, width/2, -height/2, height/2); // Same as ortho()
translate(width/2, height/2, 0);
rotateX(-PI/6);
rotateY(PI/3);
box(180);
Image output for example 1

相关用法


注:本文由纯净天空筛选整理自processing.org大神的英文原创作品 ortho()。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。