File: conversions.R

package info (click to toggle)
rgl 1.3.34-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 13,968 kB
  • sloc: cpp: 23,234; ansic: 7,462; javascript: 6,125; sh: 3,555; makefile: 2
file content (13 lines) | stat: -rw-r--r-- 571 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
rglToLattice <- function(rotm = par3d("userMatrix")) {
  if (!requireNamespace("orientlib", quietly = TRUE))
    stop("The orientlib package is needed for this function")
  e <- -orientlib::eulerzyx(orientlib::rotmatrix(rotm[1:3, 1:3]))@x*180/pi
  list(z = e[1], y = e[2], x = e[3])
}

rglToBase <- function(rotm = par3d("userMatrix")) {
  if (!requireNamespace("orientlib", quietly = TRUE))
    stop("The orientlib package is needed for this function")
  e <- (orientlib::eulerzyx(orientlib::rotmatrix((rotm[1:3,1:3]))))@x*180/pi
  list(theta = e[1], phi = 90 - e[3])
}