Status of numeric libraries?
Moderators: jesterKing, stiv
Status of numeric libraries?
The game engine's Python seems to include neither Numeric nor Numarray. What's the approved tool set for doing matrix arithmetic? There must be something in there. Thanks.
This is for Win2K, unfortunately. Numarray has an installer that won't recognize GameBlender's Python. So does Numeric.just install it into python and import
Is there some simple way to do this, or do I have to figure out how the Numarray installer works, how GameBlender's Python installation works, and hack them to work together?
Many GameLogic functions use matrices. getOrientation and setOrientation use 3x3 rotation matrices, and there are camera functions such as getCameraToWorld which use full 4x4 transformation matrices. So clearly the API requires the availability of basic matrix math functions.Blender GE was never intended for the High lvl
Numarray may be overkill, but a basic 2x2, 3x3, and 4x4 matrix library is essential.

 Posts: 0
 Joined: Mon Oct 18, 2004 2:10 pm
basic matrix functions
Making a simple blender game, I use the matrix and vector math features all the time, but I have some game programming experience, so what does simple mean? Matrix math is especially confusing because they BARELY touched this at school 10 years ago  I end up doing it by trial and error!
Python already has a handy "math" library I can import:
math.atan2 (to convert x and y deltas to angles  for example to convert mouse coordinates to angles)
math.sin (to convert angle to y coordinate)
math.cos (to convert angle to x coordinate)
math.pi (degrees/radians == 180/math.pi)
math.sqrt(x*x+y*y+z*z) (for normalizing vectors)
It would be nice to have helper functions for:
normalize vector or matrix
convert matrix, quarternion or vector to angle:
yaw/compass angle = angle from top view (math.atan2(x,y))
pitch/elevation angle = math.sin (z/math.sqrt(x*x+y*y+z*z))
convert angle to matrix
invert matrices
concatenate matrices
apply transformation matrix to vector/point
The last three should work with both 3x3 (orientation) and 4x4 (projection) matrices.
Python already has a handy "math" library I can import:
math.atan2 (to convert x and y deltas to angles  for example to convert mouse coordinates to angles)
math.sin (to convert angle to y coordinate)
math.cos (to convert angle to x coordinate)
math.pi (degrees/radians == 180/math.pi)
math.sqrt(x*x+y*y+z*z) (for normalizing vectors)
It would be nice to have helper functions for:
normalize vector or matrix
convert matrix, quarternion or vector to angle:
yaw/compass angle = angle from top view (math.atan2(x,y))
pitch/elevation angle = math.sin (z/math.sqrt(x*x+y*y+z*z))
convert angle to matrix
invert matrices
concatenate matrices
apply transformation matrix to vector/point
The last three should work with both 3x3 (orientation) and 4x4 (projection) matrices.
the embedded Blender Python must only know the path to the module, and (especially in case of compiled modules) it must be for the right version of Python (i.e. the one in the Blender you're using). and this is what the welldocumented (e.g. Elysiun threads) PYTHONPATH env. variable does.
if you have trouble installing numarray or some other module in mswin because of not having Python installed, why don't you just install Python first? and then set PYTHONPATH accordingly so that Blender too finds the modules installed for the regular Python.
~Toni
if you have trouble installing numarray or some other module in mswin because of not having Python installed, why don't you just install Python first? and then set PYTHONPATH accordingly so that Blender too finds the modules installed for the regular Python.
~Toni