Skip to content

Commit

Permalink
Fix bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
relund committed Jan 26, 2023
1 parent 39ee151 commit 4fa82c0
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 15 deletions.
11 changes: 6 additions & 5 deletions R/hull.R
Original file line number Diff line number Diff line change
Expand Up @@ -378,8 +378,6 @@ addRays <- function(pts, m = apply(pts,2,min)-5, M = apply(pts,2,max)+5, directi
#' facet in the hull and \code{pts} equal the input points (and dummy points) and columns:
#' \code{pt}, true if a point in the original input; false if a dummy point (a point on a ray).
#' \code{vtx}, TRUE if a vertex in the hull.
#' @importFrom rlang .data
#' @export
#'
#' @examples
#' ## 1D
Expand Down Expand Up @@ -428,6 +426,9 @@ addRays <- function(pts, m = apply(pts,2,min)-5, M = apply(pts,2,max)+5, directi
#' plotHull3D(pts, addRays = TRUE)
#' convexHull(pts, addRays = TRUE)
#' finalize3D()
#'
#' @importFrom rlang .data
#' @export
convexHull <- function(pts, addRays = FALSE, useRGLBBox = FALSE, direction = 1,
tol = mean(mean(abs(pts)))*sqrt(.Machine$double.eps)*2,
m = apply(pts,2,min)-5, M = apply(pts,2,max)+5) {
Expand Down Expand Up @@ -519,10 +520,10 @@ convexHull <- function(pts, addRays = FALSE, useRGLBBox = FALSE, direction = 1,
tmp <- dplyr::filter(set, .data$vtx | .data$pt, .preserve = TRUE)
if (nrow(set) != nrow(tmp)) {
tmp$newId <- 1:nrow(tmp)
mch <- dplyr::left_join(set, tmp, by = 'oldId') %>% dplyr::select(.data$newId)
mch <- dplyr::left_join(set, tmp, by = 'oldId') %>% dplyr::select("newId")
hull <- apply(hull, c(1,2), function(id) {if (is.na(id)) return(NA) else return(mch[id,1])} )
set <- dplyr::select(tmp, -.data$oldId, -.data$newId)
} else set <- dplyr::select(tmp, -.data$oldId)
set <- dplyr::select(tmp, -"oldId", -"newId")
} else set <- dplyr::select(tmp, -"oldId")
return(list(hull = hull, pts = set))
stop("Cannot find the vertices!")
}
Expand Down
4 changes: 2 additions & 2 deletions R/ndset.R
Original file line number Diff line number Diff line change
Expand Up @@ -1055,8 +1055,8 @@ classifyNDSet <- function(pts, direction = 1) {
set1 <- set %>% left_join(x = set, y = pts[idx,], by = paste0("z", 1:p)) # match id of duplicates
set1 <- set1 %>%
dplyr::filter(!is.na(.data$id.y)) %>%
dplyr::mutate(id.x = .data$id.y) %>% dplyr::select(.data$z1:.data$id.x)
set <- bind_rows(set, pts[idx,]) %>% arrange(id) %>% select(-id)
dplyr::mutate(id.x = .data$id.y) %>% dplyr::select("z1":"id.x")
set <- dplyr::bind_rows(set, pts[idx,]) %>% dplyr::arrange(id) %>% dplyr::select(-id)
if (nrow(set1) > 0) for (i in 1:nrow(set1)) set[set1$id.x[i],] <- set1[i, 1:(p+4)]
return(set)
}
10 changes: 3 additions & 7 deletions check.R
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
## Check package
update.packages()
update.packages(ask = FALSE)
devtools::spell_check()
spelling::update_wordlist()
devtools::check(env_vars = c(NOT_CRAN = "true", RGL_USE_NULL = "true"))
devtools::check_rhub(platforms = c("windows-x86_64-release"), interactive = F)
devtools::check_win_release(quiet = TRUE) # win-builder
# Push files to GitHub for GitHub actions check

devtools::check_rhub(interactive = F)
# devtools::check_rhub(platforms = c("windows-x86_64-release"), interactive = F)
devtools::check_win_release(quiet = TRUE) # win-builder
# Push files to GitHub for GitHub actions check
devtools::release()

# Submit to CRAN
devtools::release()
1 change: 0 additions & 1 deletion cran-comments.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ devtools::spell_check()
spelling::update_wordlist()
devtools::check(env_vars = c(NOT_CRAN = "true", RGL_USE_NULL = "true"))
devtools::check_rhub(interactive = F)
# devtools::check_rhub(platforms = c("windows-x86_64-release"), interactive = F)
devtools::check_win_release(quiet = TRUE) # win-builder
# Push files to GitHub for GitHub actions check
# Submit to CRAN
Expand Down
1 change: 1 addition & 0 deletions man/convexHull.Rd

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

0 comments on commit 4fa82c0

Please sign in to comment.