OpenGLContext.triangleutilities
index
p:\openglcontext\triangleutilities.py

Utility functions for processing triangle vertex arrays

 
Modules
            
copy
copy_reg
math
multiarray
pickle
string
types
 
Functions
            
basisVectors(vertices, components=3, ccw=1)
Calculate basis vectors for given triangle vertices
 
vertices -- x*components array of vertex
        coordinates, with x a multiple of 3, that
        is, the array shape is (x,components). If
        shape(vertices) is length 2 and the second
        component is 3 or 4, we don't reshape,
        otherwise we reshape as appropriate
components -- number of components in an
        individual coordinate, see note for
        vertices.
ccw -- whether to use counter-clock-wise
        winding
 
returns two x/3 arrays of vectors, (second
minus first, third minus second), that is,
there are two arrays of vectors, each of
which is 1/3 of the length of the original
vertices array.
centers(vertices, vertexCount=3, components=3)
Calculate polygon center for given polygon vertices
 
vertices -- x*components array of vertex
        coordinates, with x a multiple of vertexCount
vertexCount -- the number of vertices in a given polygon
components -- the number of coordinates in a given vertex
 
returns x-length array of center coordinates
 
Note: if the vertices array is not an even multiple
of vertexCount by components floats, you'll get a
ValueError raised.
normalPerFace(vertices, ccw=1)
Calculate triangle normals for given triangle vertices
 
vertices -- x*3 array of vertex
        coordinates, with x a multiple of 3
ccw -- whether to use counter-clock-wise
        winding
 
returns array of normal vectors