gluLookAt implementation in python Here is my gluLookAt matrix computation code by python (numpy) and its test code. This code cares rather comprehensiveness than efficiency, therefore, there are matrix multiplication and matrix transpose. You can remove this if you want to have more efficient code. The test compares the result of this implementation and the OpenGL's computation result with less than 1.0e-6 error. As far as I tested, the result is in the error threshold in Ubuntu 10.04, python 2.6, glx version 1.4 ----- # Copyright (C) 2010-2011 H. Yamauchi # under New (3-clause) BSD license # # get lookat matrix (gluLookAt compatible matrix) python, numpy # # \param[in] _eye eye point # \param[in] _lookat lookat point # \param[in] _up up vector # \return 4x4 gluLookAt matrix def getLookAtMatrix(_eye, _lookat, _up): ez = _eye - _lookat ez = ez / numpy.linalg.norm(ez) ex = numpy.cross(_up,...
Mathematics, programming, and a little bit of my life.