{"id":6922,"library":"transformations","title":"Transformations","description":"Transformations is a Python library for calculating 4x4 matrices for translating, rotating, reflecting, scaling, shearing, projecting, orthogonalizing, and superimposing arrays of 3D homogeneous coordinates, as well as for converting between rotation matrices, Euler angles, and quaternions. It is no longer actively developed and is largely superseded by other libraries.","status":"deprecated","version":"2026.1.18","language":"en","source_language":"en","source_url":"https://github.com/cgohlke/transformations","tags":["3D","transformations","matrices","quaternions","robotics","geometry","homogeneous coordinates","math"],"install":[{"cmd":"pip install -U transformations","lang":"bash","label":"Install latest version"}],"dependencies":[{"reason":"Required for array manipulations and mathematical operations.","package":"numpy","optional":false}],"imports":[{"note":"Common practice to alias for brevity and to distinguish from other transformation libraries.","symbol":"transformations","correct":"import transformations as tf"}],"quickstart":{"code":"import numpy as np\nimport transformations as tf\n\n# Create a rotation matrix around the Z-axis by 90 degrees (pi/2 radians)\nangle = np.pi / 2\nrotation_matrix = tf.rotation_matrix(angle, [0, 0, 1])\n\n# Define a point in homogeneous coordinates (x, y, z, w=1)\npoint = np.array([1.0, 0.0, 0.0, 1.0])\n\n# Apply the transformation\ntransformed_point = np.dot(rotation_matrix, point)\n\nprint(f\"Original point: {point[:3]}\")\nprint(f\"Rotation matrix:\\n{rotation_matrix}\")\nprint(f\"Transformed point: {transformed_point[:3]}\")\n\n# Create a translation matrix\ntranslation_matrix = tf.translation_matrix([5.0, 2.0, 0.0])\n\n# Concatenate transformations (apply rotation then translation)\ncombined_matrix = np.dot(translation_matrix, rotation_matrix)\ncombined_transformed_point = np.dot(combined_matrix, point)\n\nprint(f\"\\nCombined transformation matrix:\\n{combined_matrix}\")\nprint(f\"Combined transformed point: {combined_transformed_point[:3]}\")","lang":"python","description":"This quickstart demonstrates how to create rotation and translation matrices and apply them to a 3D point using homogeneous coordinates. It also shows how to concatenate transformations."},"warnings":[{"fix":"Migrate to a more actively maintained library such as `scipy.spatial.transform` or `transforms3d` for new development. For existing code, be aware that support may be limited.","message":"The 'transformations' library is no longer actively developed and is largely superseded by other, more actively maintained modules like Pytransform3d, Scipy.spatial.transform, Transforms3d, or Numpy-quaternion. Consider using these alternatives for new projects.","severity":"deprecated","affected_versions":"2024.1.6 and later"},{"fix":"Pin the library version in your `requirements.txt` (e.g., `transformations==2026.1.18`) and thoroughly test after any upgrade. Review the `CHANGES` file on GitHub before updating.","message":"The API is explicitly stated as 'not stable yet and is expected to change between revisions.' This means minor version updates might introduce breaking changes.","severity":"breaking","affected_versions":"All versions"},{"fix":"Always verify the quaternion convention when integrating with other libraries or systems. Convert components if necessary to match the expected order.","message":"Quaternions in this library are represented as `[w, x, y, z]`. This differs from some other common libraries (e.g., older ROS `tf.transformations` used `[x, y, z, w]`), which can lead to incorrect calculations if not handled carefully.","severity":"gotcha","affected_versions":"All versions"},{"fix":"For speed-critical paths, profile your code and consider rewriting parts using a faster library or the `transformations.c` module. The core `numpy` operations are generally fast, but some high-level functions might have overhead.","message":"The Python implementation of transformations is not optimized for speed. For performance-critical applications, consider using the `transformations.c` module (if available in your distribution) or alternative libraries that offer optimized (e.g., C/Cython backed) implementations.","severity":"gotcha","affected_versions":"All versions"},{"fix":"When passing matrices to external graphics APIs, test and, if necessary, transpose the matrix (e.g., `M.T`) to ensure correct orientation and position.","message":"Transformation matrices generated by this library might require transposing when interfacing with some other graphics systems, such as OpenGL's `glMultMatrixd()`, due to differing column-major/row-major conventions.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-15T00:00:00.000Z","next_check":"2026-07-14T00:00:00.000Z","problems":[]}