Skip to content

Commit

Permalink
interpolate fix
Browse files Browse the repository at this point in the history
  • Loading branch information
dicook committed Aug 11, 2023
1 parent 7faa4f4 commit 0b79601
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -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

Expand Down
7 changes: 5 additions & 2 deletions R/interpolate.r
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand All @@ -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

Expand Down
4 changes: 3 additions & 1 deletion man/interpolate.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 0b79601

Please sign in to comment.