{
    "nbformat": 4,
    "nbformat_minor": 5,
    "metadata": {
        "kernelspec": {
            "display_name": "Python",
            "language": "python",
            "name": "python"
        },
        "language_info": {
            "name": "python"
        }
    },
    "cells": [
        {
            "id": "e2c0b2f3",
            "cell_type": "markdown",
            "source": "<div class='alert alert-warning'>\n\nSciPy's interactive examples with Jupyterlite are experimental and may not always work as expected. Execution of cells containing imports may result in large downloads (up to 60MB of content for the first import from SciPy). Load times when importing from SciPy may take roughly 10-20 seconds. If you notice any problems, feel free to open an [issue](https://github.com/scipy/scipy/issues/new/choose).\n\n</div>",
            "metadata": {}
        },
        {
            "id": "4bb35659",
            "cell_type": "code",
            "metadata": {},
            "execution_count": null,
            "source": "from scipy.spatial.transform import Rotation as R\nimport numpy as np",
            "outputs": []
        },
        {
            "id": "6afd5a19",
            "cell_type": "markdown",
            "source": "Represent a single rotation:\n",
            "metadata": {}
        },
        {
            "id": "cc43252c",
            "cell_type": "code",
            "metadata": {},
            "execution_count": null,
            "source": "r = R.from_rotvec([0, 0, np.pi])\nr.as_mrp()",
            "outputs": [
                {
                    "output_type": "execute_result",
                    "metadata": {},
                    "data": {
                        "text/plain": "array([0.        , 0.        , 1.         ])"
                    },
                    "execution_count": null
                }
            ]
        },
        {
            "id": "dd73aff1",
            "cell_type": "code",
            "metadata": {},
            "execution_count": null,
            "source": "r.as_mrp().shape",
            "outputs": [
                {
                    "output_type": "execute_result",
                    "metadata": {},
                    "data": {
                        "text/plain": "(3,)"
                    },
                    "execution_count": null
                }
            ]
        },
        {
            "id": "c00fb41e",
            "cell_type": "markdown",
            "source": "Represent a stack with a single rotation:\n",
            "metadata": {}
        },
        {
            "id": "5592a33e",
            "cell_type": "code",
            "metadata": {},
            "execution_count": null,
            "source": "r = R.from_euler('xyz', [[180, 0, 0]], degrees=True)\nr.as_mrp()",
            "outputs": [
                {
                    "output_type": "execute_result",
                    "metadata": {},
                    "data": {
                        "text/plain": "array([[1.       , 0.        , 0.         ]])"
                    },
                    "execution_count": null
                }
            ]
        },
        {
            "id": "467b8855",
            "cell_type": "code",
            "metadata": {},
            "execution_count": null,
            "source": "r.as_mrp().shape",
            "outputs": [
                {
                    "output_type": "execute_result",
                    "metadata": {},
                    "data": {
                        "text/plain": "(1, 3)"
                    },
                    "execution_count": null
                }
            ]
        },
        {
            "id": "51404633",
            "cell_type": "markdown",
            "source": "Represent multiple rotations:\n",
            "metadata": {}
        },
        {
            "id": "c26595df",
            "cell_type": "code",
            "metadata": {},
            "execution_count": null,
            "source": "r = R.from_rotvec([[np.pi/2, 0, 0], [0, 0, np.pi/2]])\nr.as_mrp()",
            "outputs": [
                {
                    "output_type": "execute_result",
                    "metadata": {},
                    "data": {
                        "text/plain": "array([[0.41421356, 0.        , 0.        ],\n       [0.        , 0.        , 0.41421356]])"
                    },
                    "execution_count": null
                }
            ]
        },
        {
            "id": "8f0dcde0",
            "cell_type": "code",
            "metadata": {},
            "execution_count": null,
            "source": "r.as_mrp().shape",
            "outputs": [
                {
                    "output_type": "execute_result",
                    "metadata": {},
                    "data": {
                        "text/plain": "(2, 3)"
                    },
                    "execution_count": null
                }
            ]
        }
    ]
}