{
    "nbformat": 4,
    "nbformat_minor": 5,
    "metadata": {
        "kernelspec": {
            "display_name": "Python",
            "language": "python",
            "name": "python"
        },
        "language_info": {
            "name": "python"
        }
    },
    "cells": [
        {
            "id": "3d7d48f1",
            "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": "4a49075e",
            "cell_type": "code",
            "metadata": {},
            "execution_count": null,
            "source": "from scipy.spatial.transform import Rotation as R\nimport numpy as np",
            "outputs": []
        },
        {
            "id": "14b82216",
            "cell_type": "markdown",
            "source": "Represent a single rotation:\n",
            "metadata": {}
        },
        {
            "id": "db3b3b3d",
            "cell_type": "code",
            "metadata": {},
            "execution_count": null,
            "source": "r = R.from_rotvec([0, 0, np.pi/2])\nr.as_euler('zxy', degrees=True)",
            "outputs": [
                {
                    "output_type": "execute_result",
                    "metadata": {},
                    "data": {
                        "text/plain": "array([90.,  0.,  0.])"
                    },
                    "execution_count": null
                }
            ]
        },
        {
            "id": "75de0469",
            "cell_type": "code",
            "metadata": {},
            "execution_count": null,
            "source": "r.as_euler('zxy', degrees=True).shape",
            "outputs": [
                {
                    "output_type": "execute_result",
                    "metadata": {},
                    "data": {
                        "text/plain": "(3,)"
                    },
                    "execution_count": null
                }
            ]
        },
        {
            "id": "76016d2f",
            "cell_type": "markdown",
            "source": "Represent a stack of single rotation:\n",
            "metadata": {}
        },
        {
            "id": "bdf2ed49",
            "cell_type": "code",
            "metadata": {},
            "execution_count": null,
            "source": "r = R.from_rotvec([[0, 0, np.pi/2]])\nr.as_euler('zxy', degrees=True)",
            "outputs": [
                {
                    "output_type": "execute_result",
                    "metadata": {},
                    "data": {
                        "text/plain": "array([[90.,  0.,  0.]])"
                    },
                    "execution_count": null
                }
            ]
        },
        {
            "id": "e68b26ac",
            "cell_type": "code",
            "metadata": {},
            "execution_count": null,
            "source": "r.as_euler('zxy', degrees=True).shape",
            "outputs": [
                {
                    "output_type": "execute_result",
                    "metadata": {},
                    "data": {
                        "text/plain": "(1, 3)"
                    },
                    "execution_count": null
                }
            ]
        },
        {
            "id": "22627bf8",
            "cell_type": "markdown",
            "source": "Represent multiple rotations in a single object:\n",
            "metadata": {}
        },
        {
            "id": "e23d6b25",
            "cell_type": "code",
            "metadata": {},
            "execution_count": null,
            "source": "r = R.from_rotvec([\n[0, 0, np.pi/2],\n[0, -np.pi/3, 0],\n[np.pi/4, 0, 0]])\nr.as_euler('zxy', degrees=True)",
            "outputs": [
                {
                    "output_type": "execute_result",
                    "metadata": {},
                    "data": {
                        "text/plain": "array([[ 90.,   0.,   0.],\n       [  0.,   0., -60.],\n       [  0.,  45.,   0.]])"
                    },
                    "execution_count": null
                }
            ]
        },
        {
            "id": "34a45c0a",
            "cell_type": "code",
            "metadata": {},
            "execution_count": null,
            "source": "r.as_euler('zxy', degrees=True).shape",
            "outputs": [
                {
                    "output_type": "execute_result",
                    "metadata": {},
                    "data": {
                        "text/plain": "(3, 3)"
                    },
                    "execution_count": null
                }
            ]
        }
    ]
}