Skip to content

Commit

Permalink
v1.2.1.9000
Browse files Browse the repository at this point in the history
  • Loading branch information
stla committed Oct 31, 2023
1 parent 04ada80 commit decfbe0
Show file tree
Hide file tree
Showing 9 changed files with 54 additions and 49 deletions.
9 changes: 5 additions & 4 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Type: Package
Package: RCDT
Title: Fast 2D Constrained Delaunay Triangulation
Version: 1.2.1
Version: 1.2.1.9000
Authors@R: c(
person("Stéphane", "Laurent", , "laurent_step@outlook.fr", role = c("aut", "cre")),
person("Artem", "Amirkhanov", role = "cph",
Expand All @@ -16,9 +16,10 @@ License: GPL-3
URL: https://github.com/stla/RCDT
BugReports: https://github.com/stla/RCDT/issues
Imports:
colorsGen,
gplots,
graphics,
randomcoloR,
Polychrome,
Rcpp (>= 1.0.8),
rgl,
Rvcg
Expand All @@ -32,9 +33,9 @@ LinkingTo:
BH,
Rcpp,
RcppArmadillo
SystemRequirements: C++ 14
SystemRequirements: C++ 17
VignetteBuilder:
knitr
Config/testthat/edition: 3
Encoding: UTF-8
RoxygenNote: 7.2.1
RoxygenNote: 7.2.3
4 changes: 2 additions & 2 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
export(delaunay)
export(delaunayArea)
export(plotDelaunay)
importFrom(Polychrome,createPalette)
importFrom(Rcpp,evalCpp)
importFrom(Rvcg,vcgGetEdge)
importFrom(colorsGen,randomColor)
importFrom(gplots,col2hex)
importFrom(graphics,par)
importFrom(graphics,plot)
importFrom(graphics,polygon)
importFrom(graphics,segments)
importFrom(randomcoloR,distinctColorPalette)
importFrom(randomcoloR,randomColor)
importFrom(rgl,tmesh3d)
useDynLib(RCDT, .registration=TRUE)
6 changes: 6 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# RCDT 1.3.0 (2023-10-31)

The package does no longer depend on 'randomcoloR', but it now depends on
'colorsGen' and 'Polychrome'.


# RCDT 1.2.1 (2022-08-13)

* Skip a unit test on Mac; it fails for some reason.
Expand Down
16 changes: 16 additions & 0 deletions R/colors.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#' @importFrom Polychrome createPalette
#' @noRd
distinctColors <- function(n, argsList) {
f <- function(...) {
createPalette(n, ...)
}
do.call(f, argsList)
}

#' @importFrom colorsGen randomColor
rcolors <- function(n, argsList) {
f <- function(...) {
randomColor(n, ...)
}
do.call(f, argsList)
}
21 changes: 12 additions & 9 deletions R/plot.R
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,15 @@
#' \code{NULL} for no color
#' @param fillcolor controls the filling colors of the triangles, either
#' \code{NULL} for no color, a single color, \code{"random"} to get multiple
#' colors with \code{\link[randomcoloR]{randomColor}}, \code{"distinct"}
#' get multiple colors with \code{\link[randomcoloR]{distinctColorPalette}},
#' colors with \code{\link[colorsGen]{randomColor}}, \code{"distinct"}
#' get multiple colors with \code{\link[Polychrome]{createPalette}},
#' or a vector of colors, one color for each triangle; in this case the
#' the colors will be assigned in the order they are provided but after the
#' triangles have been circularly ordered (see the last example)
#' @param hue,luminosity if \code{color = "random"}, these arguments are passed
#' to \code{\link[randomcoloR]{randomColor}}
#' @param distinctArgs if \code{fillcolor = "distinct"}, a list of arguments
#' passed to \code{\link[Polychrome]{createPalette}}
#' @param randomArgs if \code{fillcolor = "random"}, a list of arguments passed
#' to \code{\link[colorsGen]{randomColor}}
#' @param lty_edges,lwd_edges graphical parameters for the edges which are not
#' border edges nor constraint edges
#' @param lty_borders,lwd_borders graphical parameters for the border edges
Expand All @@ -36,7 +38,6 @@
#' in the examples of \code{\link{delaunay}}.
#'
#' @export
#' @importFrom randomcoloR randomColor distinctColorPalette
#' @importFrom graphics plot polygon par segments
#' @importFrom gplots col2hex
#'
Expand All @@ -53,7 +54,7 @@
#' opar <- par(mar = c(0, 0, 0, 0))
#' plotDelaunay(
#' d, type = "n", xlab = NA, ylab = NA, axes = FALSE, asp = 1,
#' fillcolor = "random", luminosity = "dark", lwd_borders = 3
#' fillcolor = "random", lwd_borders = 3
#' )
#' par(opar)
#'
Expand Down Expand Up @@ -134,7 +135,9 @@
plotDelaunay <- function(
del,
col_edges = "black", col_borders = "red", col_constraints = "green",
fillcolor = "distinct", hue = "random", luminosity = "light",
fillcolor = "random",
distinctArgs = list(seedcolors = c("#ff0000", "#00ff00", "#0000ff")),
randomArgs = list(hue = "random", luminosity = "dark"),
lty_edges = par("lty"), lwd_edges = par("lwd"),
lty_borders = par("lty"), lwd_borders = par("lwd"),
lty_constraints = par("lty"), lwd_constraints = par("lwd"), ...
Expand Down Expand Up @@ -194,9 +197,9 @@ plotDelaunay <- function(
triangles <- t(del[["mesh"]][["it"]])
ntriangles <- nrow(triangles)
if(fillcolor == "random"){
colors <- randomColor(ntriangles, hue = hue, luminosity = luminosity)
colors <- rcolors(ntriangles, randomArgs)
}else if(fillcolor == "distinct"){
colors <- distinctColorPalette(ntriangles)
colors <- distinctColors(ntriangles, distinctArgs)
}else{
colors <- rep(fillcolor, ntriangles)
}
Expand Down
4 changes: 2 additions & 2 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ del <- delaunay(points, edges)
opar <- par(mar = c(0, 0, 0, 0))
plotDelaunay(
del, type = "n", asp = 1, lwd_borders = 3, col_borders = "black",
fillcolor = "random", luminosity = "dark", col_edges = "yellow",
fillcolor = "random", col_edges = "yellow",
axes = FALSE, xlab = NA, ylab = NA
)
par(opar)
Expand Down Expand Up @@ -203,7 +203,7 @@ del <- delaunay(xy, edges = rbind(edges1, edges2))
opar <- par(mar = c(0, 0, 0, 0))
plotDelaunay(
del, type = "n", col_borders = "black", lwd_borders = 2,
fillcolor = "random", luminosity = "dark", col_edges = "white",
fillcolor = "random", col_edges = "white",
axes = FALSE, xlab = NA, ylab = NA, asp = 1
)
polygon(xy[inner, ], col = "#ffff99")
Expand Down
19 changes: 11 additions & 8 deletions man/plotDelaunay.Rd

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

12 changes: 0 additions & 12 deletions src/Makevars
Original file line number Diff line number Diff line change
@@ -1,14 +1,2 @@

## With R 3.1.0 or later, you can uncomment the following line to tell R to
## enable compilation with C++11 (where available)
##
## Also, OpenMP support in Armadillo prefers C++11 support. However, for wider
## availability of the package we do not yet enforce this here. It is however
## recommended for client packages to set it.
##
## And with R 3.4.0, and RcppArmadillo 0.7.960.*, we turn C++11 on as OpenMP
## support within Armadillo prefers / requires it
CXX_STD = CXX14

PKG_CXXFLAGS = $(SHLIB_OPENMP_CXXFLAGS)
PKG_LIBS = $(SHLIB_OPENMP_CXXFLAGS) $(LAPACK_LIBS) $(BLAS_LIBS) $(FLIBS)
12 changes: 0 additions & 12 deletions src/Makevars.win
Original file line number Diff line number Diff line change
@@ -1,14 +1,2 @@

## With R 3.1.0 or later, you can uncomment the following line to tell R to
## enable compilation with C++11 (where available)
##
## Also, OpenMP support in Armadillo prefers C++11 support. However, for wider
## availability of the package we do not yet enforce this here. It is however
## recommended for client packages to set it.
##
## And with R 3.4.0, and RcppArmadillo 0.7.960.*, we turn C++11 on as OpenMP
## support within Armadillo prefers / requires it
CXX_STD = CXX14

PKG_CXXFLAGS = $(SHLIB_OPENMP_CXXFLAGS)
PKG_LIBS = $(SHLIB_OPENMP_CXXFLAGS) $(LAPACK_LIBS) $(BLAS_LIBS) $(FLIBS)

0 comments on commit decfbe0

Please sign in to comment.