首页 > 文档 > perspective()角度
2017
08-07

perspective()角度

Name

perspective()角度

   

Examples

perspective()角度 - 第1张  | Processing编程艺术perspective()角度 - 第2张  | Processing编程艺术perspective()角度 - 第3张  | Processing编程艺术

// Re-creates the default perspective

size(100, 100, P3D);

noFill();

float fov = PI/3.0;

float cameraZ = (height/2.0) / tan(fov/2.0);

perspective(fov, float(width)/float(height),

cameraZ/10.0, cameraZ*10.0);

translate(50, 50, 0);

rotateX(-PI/6);

rotateY(PI/3);

box(45);

Description

Sets a perspective projection applying foreshortening, making distant objects appear smaller than closer ones. The parameters define a viewing volume with the shape of truncated pyramid. Objects near to the front of the volume appear their actual size, while farther objects appear smaller. This projection simulates the perspective of the world more accurately than orthographic projection. The version of perspective without parameters sets the default perspective and the version with four parameters allows the programmer to set the area precisely. The default values are: perspective(PI/3.0, width/height, cameraZ/10.0, cameraZ*10.0) where cameraZ is ((height/2.0) / tan(PI*60.0/360.0));

设置应用收缩的透视投影, 使远处的对象看起来比较近的物体小。这些参数定义一个具有截断金字塔形状的查看卷。靠近卷前面的对象显示其实际大小, 而更远的对象则显得较小。这个投射比正交投影更准确地模拟世界的透视。没有参数的透视图的版本设置了默认的透视图, 并且具有四参数的版本允许程序员精确地设置该区域。默认值为: 透视 (pi/3.0, 宽度/高度, cameraZ/10.0, cameraZ * 10.0), 其中 cameraZ (高度/2.0)/tan (pi * 60.0/360.0));

Syntax

perspective()

perspective(fovy, aspect, zNear, zFar)

Parameters

fovy

float: field-of-view angle (in radians) for vertical direction

垂直方向的视角度 (以弧度表示)

aspect

float: ratio of width to height

宽度与高度的比值

zNear

float: z-position of nearest clipping plane

最近修剪平面的 z 位置

zFar

float: z-position of farthest clipping plane

最近修剪平面的 z 位置

Returns

void



最后编辑:
作者:卡萨布兰卡
这个作者貌似有点懒,什么都没有留下。

留下一个回复

你的email不会被公开。