{
  "__type": "IngestedDoc",
  "__tag": 4010,
  "_content": {
    "Notes": {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "4x4 rigid transformation matrices are of the form      "
            }
          ]
        },
        {
          "__type": "Code",
          "__tag": 4050,
          "value": "[       tx]\n[   R   ty]\n[       tz]\n[ 0 0 0  1]",
          "execution_status": null,
          "out": ""
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "where "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "R"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " is a 3x3 rotation matrix and "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "t = [tx, ty, tz]"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " is a 3x1 translation vector. As rotation matrices must be proper orthogonal, the rotation component is orthonormalized using singular value decomposition before initialization."
            }
          ]
        }
      ],
      "title": [],
      "level": 0,
      "target": null
    },
    "Warns": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Raises": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Yields": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Methods": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Returns": {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Parameters",
          "__tag": 4026,
          "children": [
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "transform",
              "annotation": "`RigidTransform` instance",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Object containing the rigid transform represented by the input matrix."
                    }
                  ]
                }
              ]
            }
          ]
        }
      ],
      "title": [],
      "level": 0,
      "target": null
    },
    "Summary": {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "Initialize from a 4x4 transformation matrix."
            }
          ]
        }
      ],
      "title": [],
      "level": 0,
      "target": null
    },
    "Receives": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Warnings": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Attributes": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Parameters": {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Parameters",
          "__tag": 4026,
          "children": [
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "matrix",
              "annotation": "array_like, shape (..., 4, 4)",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Transformation matrices. Each matrix[..., :, :] represents a 4x4 transformation matrix."
                    }
                  ]
                }
              ]
            }
          ]
        }
      ],
      "title": [],
      "level": 0,
      "target": null
    },
    "Extended Summary": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Other Parameters": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    }
  },
  "_ordered_sections": [
    "Summary",
    "Extended Summary",
    "Parameters",
    "Attributes",
    "Methods",
    "Returns",
    "Yields",
    "Receives",
    "Other Parameters",
    "Raises",
    "Warns",
    "Warnings",
    "Notes"
  ],
  "item_file": "/scipy/spatial/transform/_rigid_transform.py",
  "item_line": 478,
  "item_type": "staticmethod",
  "aliases": [
    "scipy.spatial.transform.RigidTransform.from_matrix"
  ],
  "example_section_data": {
    "__type": "Section",
    "__tag": 4015,
    "children": [
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "from scipy.spatial.transform import RigidTransform as Tf\nimport numpy as np\n",
        "execution_status": "success",
        "out": ""
      },
      {
        "__type": "Text",
        "__tag": 4046,
        "value": "\nCreating a transform from a single matrix:\n\n"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "m = np.array([[0, 1, 0, 2],\n              [0, 0, 1, 3],\n              [1, 0, 0, 4],\n              [0, 0, 0, 1]])\ntf = Tf.from_matrix(m)\ntf.as_matrix()\ntf.single\n",
        "execution_status": "success",
        "out": "True\n"
      },
      {
        "__type": "Text",
        "__tag": 4046,
        "value": "\nCreating a transform from an N-dimensional array of matrices:\n\n"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "m = np.tile(np.eye(4), (2, 5, 1, 1))  # Shape (2, 5, 4, 4)\ntf = Tf.from_matrix(m)\ntf.shape\ntf.single\nlen(tf)\n",
        "execution_status": "success",
        "out": "2\n"
      },
      {
        "__type": "Text",
        "__tag": 4046,
        "value": "\nMatrices with a rotation component that is not proper orthogonal are\northogonalized using singular value decomposition before initialization:\n\n"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "tf = Tf.from_matrix(np.diag([2, 2, 2, 1]))\ntf.as_matrix()\n",
        "execution_status": "success",
        "out": "array([[1., 0., 0., 0.],\n       [0., 1., 0., 0.],\n       [0., 0., 1., 0.],\n       [0., 0., 0., 1.]])\n"
      }
    ],
    "title": [],
    "level": 0,
    "target": null
  },
  "see_also": [],
  "signature": {
    "__type": "SignatureNode",
    "__tag": 4029,
    "kind": "function",
    "parameters": [
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "matrix",
        "annotation": "ArrayLike",
        "kind": "POSITIONAL_OR_KEYWORD",
        "default": {
          "__type": "Empty",
          "__tag": 4031
        }
      }
    ],
    "return_annotation": "RigidTransform",
    "target_name": "from_matrix"
  },
  "references": null,
  "qa": "scipy.spatial.transform._rigid_transform:RigidTransform.from_matrix",
  "arbitrary": [],
  "local_refs": [
    "matrix",
    "transform"
  ]
}