Package pyffi :: Package utils :: Module mathutils
[hide private]
[frames] | no frames]

Module mathutils

source code

A lightweight library for common vector and matrix operations.
Functions [hide private]
 
float_to_int(value)
Convert float to integer, rounding and handling nan and inf gracefully.
source code
 
getBoundingBox(veclist)
Calculate bounding box (pair of vectors with minimum and maximum coordinates).
source code
 
getCenterRadius(veclist)
Calculate center and radius of given list of vectors.
source code
 
vecSub(vec1, vec2)
Vector substraction.
source code
 
vecAdd(vec1, vec2) source code
 
vecscalarMul(vec, scalar) source code
 
vecDotProduct(vec1, vec2)
The vector dot product (any dimension).
source code
 
vecDistance(vec1, vec2)
Return distance between two vectors (any dimension).
source code
 
vecNormal(vec1, vec2, vec3)
Returns a vector that is orthogonal on C{triangle}.
source code
 
vecDistanceAxis(axis, vec)
Return distance between the axis spanned by axis[0] and axis[1] and the vector v, in 3 dimensions.
source code
 
vecDistanceTriangle(triangle, vert)
Return (signed) distance between the plane spanned by triangle[0], triangle[1], and triange[2], and the vector v, in 3 dimensions.
source code
 
vecNorm(vec)
Norm of a vector (any dimension).
source code
 
vecNormalized(vec)
Normalized version of a vector (any dimension).
source code
 
vecCrossProduct(vec1, vec2)
The vector cross product (in 3d).
source code
 
matTransposed(mat)
Return the transposed of a nxn matrix.
source code
 
matscalarMul(mat, scalar)
Return matrix * scalar.
source code
 
matvecMul(mat, vec)
Return matrix * vector.
source code
 
matMul(mat1, mat2)
Return matrix * matrix.
source code
 
matAdd(mat1, mat2)
Return matrix + matrix.
source code
 
matSub(mat1, mat2)
Return matrix - matrix.
source code
 
matCofactor(mat, i, j) source code
 
matDeterminant(mat)
Calculate determinant.
source code
Variables [hide private]
  __package__ = 'pyffi.utils'
Function Details [hide private]

vecDistanceAxis(axis, vec)

source code 

Return distance between the axis spanned by axis[0] and axis[1] and the vector v, in 3 dimensions. Raises ZeroDivisionError if the axis points coincide.

>>> vecDistanceAxis([(0,0,0), (0,0,1)], (0,3.5,0))
3.5
>>> vecDistanceAxis([(0,0,0), (1,1,1)], (0,1,0.5)) # doctest: +ELLIPSIS
0.70710678...