frustum module¶
View frustum modeling as series of clipping planes
The Frustum object itself is only responsible for extracting the clipping planes from an OpenGL modelview matrix. The bulk of the frustumculling algorithm is implemented in the bounding volume objects found in the OpenGLContext.scenegraph.boundingvolume module.
 Based on code from:
 http://www.markmorley.com/opengl/frustumculling.html

class
frustum.
Frustum
[source]¶ Bases:
object
Holder for frustum specification for intersection tests
 Note:
 the Frustum can include an arbitrary number of clipping planes, though the most common usage is to define 6 clipping planes from the OpenGL modelview matrices.

classmethod
fromViewingMatrix
(matrix=None, normalize=1)[source]¶ Extract and calculate frustum clipping planes from OpenGL
The default initializer allows you to create Frustum objects with arbitrary clipping planes, while this alternate initializer provides automatic clippingplane extraction from the modelview matrix.
matrix – the combined modelview matrix normalize – whether to normalize the plane equations
to allow for sphere boundingvolumes and use of distance equations for LODstyle operations.

visible
(points, radius)[source]¶ Determine whether this sphere is visible in frustum
 frustum – Frustum object holding the clipping planes
 for the view
 matrix – a matrix which transforms the local
 coordinates to the (worldspace) coordinate system in which the frustum is defined.
This version of the method uses a purepython loop to do the actual culling once the points are multiplied by the matrix. (i.e. it does not use the frustcullaccel C extension module)

frustum.
viewingMatrix
(projection=None, model=None)[source]¶ Calculate the total viewing matrix from given data
 projection – the projection matrix, if not provided
 than the result of glGetDoublev( GL_PROJECTION_MATRIX) will be used.
 model – the modelview matrix, if not provided
 than the result of glGetDoublev( GL_MODELVIEW_MATRIX ) will be used.
 Note:
 Unless there is a valid projection and modelview matrix, the function will raise a RuntimeError