首页 > 技术文章 > 平截锥体

QQ122252656 2015-01-18 19:53 原文

       平截锥体是一个六面体,在游戏中(虚拟现实仿真也会用到)的最大用处就是描述摄像机的视域。平截锥体最大的特征是上下两面是平行四边形。平截锥体的功能需求和应用场景相对简单,所以不需要过多的功能。
enum Frustum
{
  RIGHT       = 0,    // The RIGHT side of the frustum
  LEFT         = 1,    // The LEFT  side of the frustum
  BOTTOM  = 2,    // The BOTTOM side of the frustum
  TOP          = 3,    // The TOP side of the frustum
  BACK        = 4,    // The BACK side of the frustum
  FRONT     = 5     // The FRONT side of the frustum
}; 
每个枚举项都是一个面,可以用面描述方程解释:
enum PlaneData
{
  A = 0,        // The X value of the plane's normal
  B = 1,        // The Y value of the plane's normal
  C = 2,        // The Z value of the plane's normal
  D = 3         // The distance the plane is from the origin
};
Ax+By+Cz+D=0;
其中Vector3(A,B,C)是平面的法向量,D是原点到平面的距离。点到平面的距离可以是负的,当该点在平面的背面时,即与平面的法向量的方向相反时,该点到平面的距离为负。
参考:《游戏引擎设计与实现》

推荐阅读