Compare 4752394 ... +0 ... 0131112

Coverage Reach

No flags found

Use flags to group coverage reports by test type, project and/or folders.
Then setup custom commit statuses and notifications for each flag.

e.g., #unittest #integration

#production #enterprise

#frontend #backend

Learn more about Codecov Flags here.

Showing 2 of 4 files from the diff.
Newly tracked file
R/mesh_pal.R created.
Other files ignored by Codecov
NAMESPACE has changed.
DESCRIPTION has changed.

@@ -0,0 +1,37 @@
Loading
1 +
.quad_to_edge <- function(x) {
2 +
  if (is.null(x)) return(NULL)
3 +
  cbind(x[1:2, ], x[2:3, ], x[c(3, 1)])
4 +
}
5 +
.tri_to_edge <- function(x) {
6 +
  if (is.null(x)) return(NULL)
7 +
  cbind(x[1:2, ], x[2:3, ], x[3:4, ], x[c(4, 1), ])
8 +
9 +
}
10 +
11 +
mesh_pal <- function(x, col, ..., meshColor = NULL, pal_dim = 3L)  {
12 +
  if (missing(col)) {
13 +
    col <- hcl.colors(24)
14 +
  }
15 +
  if (is.null(meshColor)) {
16 +
    meshColor <- x$meshColor
17 +
  }
18 +
  scl <- function(x) {
19 +
    x <- c(x)
20 +
    x <- x[!is.na(x)]
21 +
    (x - min(x))/diff(range(x))
22 +
  }
23 +
24 +
  idx <- TRUE
25 +
  if (meshColor == "faces") {
26 +
    idx <- c(x$it, x$ib)
27 +
    out <- col[1 + scl(x$vb[pal_dim, idx]) * length(col)]
28 +
29 +
  }
30 +
  if (meshColor == "edges") {
31 +
    idx <- c(.tri_to_edge(x$it), .quad_to_edge(x$ib))
32 +
33 +
    out <- col[1 + scl(colMeans(matrix(x$vb[pal_dim, idx], 2))) * length(col)]
34 +
  }
35 +
  ## else vertices
36 +
  out
37 +
}

@@ -24,6 +24,7 @@
Loading
24 24
#' @export
25 25
#' @aliases image_raster image_stars
26 26
#' @export
27 +
#' @importFrom grDevices hcl.colors
27 28
#' @examples
28 29
#' set.seed(28)
29 30
#' vals <- sort(rnorm(100))

Learn more Showing 1 files with coverage changes found.

New file R/mesh_pal.R
New
Loading file...
Files Coverage
R -5.13% 94.33%
Project Totals (6 files) 94.33%
Loading