Skip to content

Commit 310a2a3

Browse files
author
Max Czapanskiy
committed
Removing 3d track
1 parent 5cc04cc commit 310a2a3

File tree

3 files changed

+0
-65
lines changed

3 files changed

+0
-65
lines changed

NAMESPACE

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,5 @@
22

33
export(read_nc)
44
export(view_cats)
5-
export(view_cats_3d)
65
import(dplyr)
76
import(ggplot2)

R/viz.R

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -54,45 +54,3 @@ make_subplot <- function(var, prh) {
5454
legend.title = element_blank())) %>%
5555
plotly::ggplotly(dynamicTicks = TRUE)
5656
}
57-
58-
#' Plot a georeferenced track in 3d
59-
#'
60-
#' @param prh A CATS PRH object
61-
#' @param width Width of the track (in meters)
62-
#'
63-
#' @return A plotly 3d mesh figure
64-
#' @export
65-
#'
66-
#' @examples
67-
#' view_cats_3d(mn200312_58, width = 10)
68-
view_cats_3d <- function(prh, width = 1) {
69-
# Calculate points for a 3d ribbon path
70-
prh$z <- -prh$z
71-
wx <- lead(prh$x) - prh$x
72-
wy <- lead(prh$y) - prh$y
73-
wz <- lead(prh$z) - prh$z
74-
wnorm <- apply(cbind(wx, wy, wz), 1, function(vec) sqrt(sum(vec^2)))
75-
wx <- wx / wnorm * width
76-
wy <- wy / wnorm * width
77-
wz <- wz / wnorm * width
78-
cosp <- cos(prh$pitch)
79-
cosr <- cos(prh$roll)
80-
sinp <- sin(prh$pitch)
81-
sinr <- sin(prh$roll)
82-
px <- head(wy * cosp * sinr - wz * cosr, -1)
83-
py <- head(wz * sinp * sinr - wx * cosp * sinr, -1)
84-
pz <- head(wx * cosr - wy * sinp * sinr, -1)
85-
x0 <- head(prh$x, -1)
86-
y0 <- head(prh$y, -1)
87-
z0 <- head(prh$z, -1)
88-
x <- c(x0 + px, x0 - px)
89-
y <- c(y0 + py, y0 - py)
90-
z <- c(z0 + pz, z0 - pz)
91-
n <- nrow(prh) - 1
92-
i <- rep(1:(n - 1), each = 2) + rep(c(0, n), n - 1) - 1
93-
j <- rep(1:(n - 1), each = 2) + rep(c(n, 1), n - 1) - 1
94-
k <- rep(2:n, each = 2) + rep(c(0, n), n - 1) - 1
95-
plotly::plot_ly(type = "mesh3d",
96-
x = x, y = y, z = z,
97-
i = i, j = j, k = k)
98-
}

man/view_cats_3d.Rd

Lines changed: 0 additions & 22 deletions
This file was deleted.

0 commit comments

Comments
 (0)