moved perspective/ortho calculation to matrix class, and cleanup of fields.js so that it can be used standalone