當前位置: 首頁>>編程示例 >>用法及示例精選 >>正文


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()。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。