Skip to content

Commit

Permalink
Merge pull request #121 from uschiLaa/master
Browse files Browse the repository at this point in the history
Fix and some simplification for interpolate
  • Loading branch information
dicook authored Aug 11, 2023
2 parents 0b79601 + 455035f commit e92c26c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
8 changes: 3 additions & 5 deletions R/interpolate.r
Original file line number Diff line number Diff line change
Expand Up @@ -54,16 +54,14 @@ interpolate <- function(basis_set, angle = 0.05, cycle = FALSE) {
while (TRUE) { # need to add final projection after generator runs out, so using break instead of while condition
new_basis[i] <- step$step <= 0
projs[, , i] <- step$proj

if (step$step == -1) break # this signals we have reached the last target
i <- i + 1
if (stop_next) break
step <- tour(angle)
if (step$step == -1) stop_next <- TRUE
}

# Trim off extra bases
projs <- projs[, , seq_len(i) - 1, drop = FALSE]
new_basis <- new_basis[seq_len(i) - 1, drop = FALSE]
projs <- projs[, , seq_len(i), drop = FALSE]
new_basis <- new_basis[seq_len(i), drop = FALSE]

attr(projs, "new_basis") <- new_basis
attr(projs, "data") <- attr(basis_set, "data")
Expand Down
3 changes: 3 additions & 0 deletions R/tour.r
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,9 @@ new_tour <- function(data, tour_path, start = NULL, ...) {
}
}
}
else {
proj[[length(proj) + 1]] <<- geodesic$ingred$interpolate(1)
}
}

if (cur_dist >= target_dist) {
Expand Down

0 comments on commit e92c26c

Please sign in to comment.