{
    "nbformat": 4,
    "nbformat_minor": 5,
    "metadata": {
        "kernelspec": {
            "display_name": "Python",
            "language": "python",
            "name": "python"
        },
        "language_info": {
            "name": "python"
        }
    },
    "cells": [
        {
            "id": "fcdc57e3",
            "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": "8d4d6748",
            "cell_type": "code",
            "metadata": {},
            "execution_count": null,
            "source": "from scipy.spatial.transform import Rotation as R\nimport numpy as np",
            "outputs": []
        },
        {
            "id": "e5d42fda",
            "cell_type": "markdown",
            "source": "Represent a single rotation:\n",
            "metadata": {}
        },
        {
            "id": "a93ff914",
            "cell_type": "code",
            "metadata": {},
            "execution_count": null,
            "source": "r = R.from_euler('z', 90, degrees=True)\nr.as_rotvec()",
            "outputs": [
                {
                    "output_type": "execute_result",
                    "metadata": {},
                    "data": {
                        "text/plain": "array([0.        , 0.        , 1.57079633])"
                    },
                    "execution_count": null
                }
            ]
        },
        {
            "id": "4397d995",
            "cell_type": "code",
            "metadata": {},
            "execution_count": null,
            "source": "r.as_rotvec().shape",
            "outputs": [
                {
                    "output_type": "execute_result",
                    "metadata": {},
                    "data": {
                        "text/plain": "(3,)"
                    },
                    "execution_count": null
                }
            ]
        },
        {
            "id": "b9fc15d5",
            "cell_type": "markdown",
            "source": "Represent a rotation in degrees:\n",
            "metadata": {}
        },
        {
            "id": "8c8e7e4a",
            "cell_type": "code",
            "metadata": {},
            "execution_count": null,
            "source": "r = R.from_euler('YX', (-90, -90), degrees=True)\ns = r.as_rotvec(degrees=True)\ns",
            "outputs": [
                {
                    "output_type": "execute_result",
                    "metadata": {},
                    "data": {
                        "text/plain": "array([-69.2820323, -69.2820323, -69.2820323])"
                    },
                    "execution_count": null
                }
            ]
        },
        {
            "id": "2719704f",
            "cell_type": "code",
            "metadata": {},
            "execution_count": null,
            "source": "np.linalg.norm(s)",
            "outputs": [
                {
                    "output_type": "execute_result",
                    "metadata": {},
                    "data": {
                        "text/plain": "120.00000000000001"
                    },
                    "execution_count": null
                }
            ]
        },
        {
            "id": "6a3ce6de",
            "cell_type": "markdown",
            "source": "Represent a stack with a single rotation:\n",
            "metadata": {}
        },
        {
            "id": "6f968a00",
            "cell_type": "code",
            "metadata": {},
            "execution_count": null,
            "source": "r = R.from_quat([[0, 0, 1, 1]])\nr.as_rotvec()",
            "outputs": [
                {
                    "output_type": "execute_result",
                    "metadata": {},
                    "data": {
                        "text/plain": "array([[0.        , 0.        , 1.57079633]])"
                    },
                    "execution_count": null
                }
            ]
        },
        {
            "id": "d8530e01",
            "cell_type": "code",
            "metadata": {},
            "execution_count": null,
            "source": "r.as_rotvec().shape",
            "outputs": [
                {
                    "output_type": "execute_result",
                    "metadata": {},
                    "data": {
                        "text/plain": "(1, 3)"
                    },
                    "execution_count": null
                }
            ]
        },
        {
            "id": "6116651c",
            "cell_type": "markdown",
            "source": "Represent multiple rotations in a single object:\n",
            "metadata": {}
        },
        {
            "id": "6fbf7280",
            "cell_type": "code",
            "metadata": {},
            "execution_count": null,
            "source": "r = R.from_quat([[0, 0, 1, 1], [1, 1, 0, 1]])\nr.as_rotvec()",
            "outputs": [
                {
                    "output_type": "execute_result",
                    "metadata": {},
                    "data": {
                        "text/plain": "array([[0.        , 0.        , 1.57079633],\n       [1.35102172, 1.35102172, 0.        ]])"
                    },
                    "execution_count": null
                }
            ]
        },
        {
            "id": "51b94a2e",
            "cell_type": "code",
            "metadata": {},
            "execution_count": null,
            "source": "r.as_rotvec().shape",
            "outputs": [
                {
                    "output_type": "execute_result",
                    "metadata": {},
                    "data": {
                        "text/plain": "(2, 3)"
                    },
                    "execution_count": null
                }
            ]
        }
    ]
}