diff --git a/NEWS.md b/NEWS.md index dc9c432b..d0263921 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,6 +1,7 @@ # tourr 1.0.1 * Edges now working correctly in display_groupxy +* Interpolate had an error in calculating distance between planes which is fixed # tourr 1.0.0 diff --git a/R/interpolate.r b/R/interpolate.r index 72f383d6..acdfd80b 100644 --- a/R/interpolate.r +++ b/R/interpolate.r @@ -9,11 +9,13 @@ #' @keywords hplot #' @export #' @examples -#' t1 <- save_history(flea[, 1:6], grand_tour(1), max = 10) +#' t1 <- save_history(flea[, 1:6], grand_tour(1), max = 3) #' dim(t1) #' dim(interpolate(t1, 0.01)) #' dim(interpolate(t1, 0.05)) #' dim(interpolate(t1, 0.1)) +#' t2 <- save_history(flea[, 1:6], grand_tour(2), max = 2) +#' dim(interpolate(t2, 0.05)) interpolate <- function(basis_set, angle = 0.05, cycle = FALSE) { basis_set <- as.array(basis_set) n <- dim(basis_set)[3] @@ -33,7 +35,8 @@ interpolate <- function(basis_set, angle = 0.05, cycle = FALSE) { ) # Estimate number of bases in output dists <- sapply(2:n, function(i) { - proj_dist(basis_set[[i - 1]], basis_set[[i]]) +# proj_dist(basis_set[[i - 1]], basis_set[[i]]) + proj_dist(apply(basis_set[,,i - 1], 2, c), apply(basis_set[,,i], 2, c)) }) steps <- sum(ceiling(dists / angle)) * 2 diff --git a/man/interpolate.Rd b/man/interpolate.Rd index 17f6ad4a..c67408cd 100644 --- a/man/interpolate.Rd +++ b/man/interpolate.Rd @@ -18,10 +18,12 @@ This function takes a set of bases and produces a tour by geodesically interpolating between each basis } \examples{ -t1 <- save_history(flea[, 1:6], grand_tour(1), max = 10) +t1 <- save_history(flea[, 1:6], grand_tour(1), max = 3) dim(t1) dim(interpolate(t1, 0.01)) dim(interpolate(t1, 0.05)) dim(interpolate(t1, 0.1)) +t2 <- save_history(flea[, 1:6], grand_tour(2), max = 2) +dim(interpolate(t2, 0.05)) } \keyword{hplot}