Skip to content

Commit

Permalink
pointsinside: defer check for Rvcg until committed to use it
Browse files Browse the repository at this point in the history
* closes #454
  • Loading branch information
jefferis committed Jan 22, 2021
1 parent 42ca544 commit efb5bf4
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions R/hxsurf.R
Original file line number Diff line number Diff line change
Expand Up @@ -709,10 +709,7 @@ pointsinside<-function(x, surf, ...) UseMethod('pointsinside')
#' @rdname pointsinside
pointsinside.default<-function(x, surf, ..., rval=c('logical','distance',
'mesh3d', 'consistent_logical')) {
if(!requireNamespace('Rvcg', quietly = TRUE))
stop("Please install suggested library Rvcg to use pointsinside")
rval=match.arg(rval)

if(rval=='logical') {
# use optimised contains_points approach
return(contains_points(surf, x, ...))
Expand All @@ -723,6 +720,9 @@ pointsinside.default<-function(x, surf, ..., rval=c('logical','distance',
"with boundingbox objects!")
}

if(!requireNamespace('Rvcg', quietly = TRUE))
stop("Please install suggested library Rvcg to use pointsinside")

if(!inherits(surf,'mesh3d')) {
surf=as.mesh3d(surf, ...)
}
Expand Down

0 comments on commit efb5bf4

Please sign in to comment.