PoreMS 0.3
  • API
  • Molecule
  • Pore
  • Workflow
  • Pore shape examples
  • Site
    • Page
        • rotate
          • rotate()
    • rotate
      • rotate()
    Source

    rotate¶

    porems.geometry.rotate(data, axis, angle, is_deg, dim=3)¶

    Rotate a vector \(\boldsymbol{a}\in\mathbb{R}^3\) along an axis \(\boldsymbol{b}\in\mathbb{R}^3\) with angle \(\alpha\in\mathbb{R}\). The rotation is performed using the rotation-matrix

    \[\begin{split}\boldsymbol{R}_\boldsymbol{n}(\alpha)=\begin{pmatrix} n_1^2 (1-\cos\alpha)+ \cos\alpha&n_1n_2(1-\cos\alpha)-n_3\sin\alpha&n_1n_3(1-\cos\alpha)+n_2\sin\alpha\\ n_2n_1(1-\cos\alpha)+n_3\sin\alpha&n_2^2 (1-\cos\alpha)+ \cos\alpha&n_2n_3(1-\cos\alpha)-n_1\sin\alpha\\ n_3n_1(1-\cos\alpha)-n_2\sin\alpha&n_3n_2(1-\cos\alpha)+n_1\sin\alpha&n_3^2 (1-\cos\alpha)+ \cos\alpha \end{pmatrix}\end{split}\]

    where \(n_i\) are the entries for the unit vector \(\boldsymbol{n}\) of the axis. The new coordinates \(\boldsymbol{c}\) are then calculated using a matrix-vector multiplication

    \[\boldsymbol{c}=\boldsymbol{R}_\boldsymbol{n}\boldsymbol{a}.\]
    Parameters:
    datalist

    Vector \(\boldsymbol{a}\)

    axisinteger, string, list

    Axis \(\boldsymbol{b}\)

    anglefloat

    Angle

    is_degbool

    True if the input is in degree

    diminteger, optional

    Number of dimensions

    Returns:
    coordlist

    Vector c as the result of the rotation

    Back to top

    © Copyright 2021, Hamzeh Kraus.
    Created using Sphinx 7.4.6.