The hardware and bandwidth for this mirror is donated by dogado GmbH, the Webhosting and Full Service-Cloud Provider. Check out our Wordpress Tutorial.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]dogado.de.
Ten C++ functions are exposed by this package:
std::string rgb2hex(double r, double g, double b);
std::string rgba2hex(double r, double g, double b, double a);
std::string hsluv2hex(double h, double s, double l);
std::string hsluv2hex(double h, double s, double l, double alpha);
std::string hsv2hex(double h, double s, double v);
std::string hsv2hex(double h, double s, double v, double alpha);
std::string hsl2hex(double h, double s, double l);
std::string hsl2hex(double h, double s, double l, double alpha);
std::string hsi2hex(double h, double s, double i);
std::string hsi2hex(double h, double s, double i, double alpha);
r, g, b ∈ [0, 255] (red, green, blue)
a, alpha ∈ [0, 1] (opacity)
h ∈ [0, 360] (hue)
s,l,v,i ∈ [0, 100] (saturation, lightness, value, intensity)
The LinkingTo field in the DESCRIPTION file should look like
LinkingTo:
Rcpp,
RcppColors
Then, in your C++ file, you can call the above functions like this:
#include <RcppColors.h>
std::string mycolor = RcppColors::rgb2hex(0.0, 128.0, 255.0);
Fourteen color maps are available in R.
library(RcppColors)
library(Bessel)
<- y <- seq(-4, 4, len = 1500)
x # complex grid
<- outer(y, x, function(x, y) complex(real = x, imaginary = y))
W # computes Bessel values
<- matrix(BesselY(W, nu = 3), nrow = nrow(W), ncol = ncol(W))
Z # maps them to colors
<- colorMap1(Z)
image # plot
<- par(mar = c(0,0,0,0), bg = "#15191E")
opar plot(
c(-100, 100), c(-100, 100), type = "n",
xlab = "", ylab = "", axes = FALSE, asp = 1
)rasterImage(image, -100, -100, 100, 100)
par(opar)
library(RcppColors)
library(Carlson)
library(rgl)
library(Rvcg)
<- vcgSphere(subdivision = 8)
mesh
<- apply(mesh$vb[-4L, ], 2L, function(xyz){
color if(sum(xyz == 0) >= 2){
<- NA_complex_
z else{
}<- xyz[1]
a <- xyz[2]
b <- xyz[3]
c <- Carlson_RJ(a, b, c, 1i, 1e-5)
z
}colorMap1(z)
})
$material <- list(color = color)
mesh
open3d(windowRect = c(50, 50, 562, 562), zoom = 0.75)
bg3d("whitesmoke")
shade3d(mesh)
library(RcppColors)
library(jacobi)
library(rgl)
library(Rvcg)
<- vcgSphere(subdivision = 8)
mesh
<- apply(mesh$vb[-4L, ], 2L, function(xyz){
color <- xyz[1]
a <- xyz[2]
b <- xyz[3]
c <- wzeta(a + 1i* b, tau = (1i+c)/2)
z colorMap1(z)
})
$material <- list(color = color)
mesh
open3d(windowRect = c(50, 50, 562, 562), zoom = 0.75)
bg3d("palevioletred2")
shade3d(mesh)
library(RcppColors)
<- Vectorize(function(x, y, tau0 = 0, gamma = 2.5){
ikeda for(k in 1L:5L){
<- tau0 - 6.0/(1.0 + x*x + y*y)
tau <- 0.97 + gamma * (x*cos(tau) - y*sin(tau))
newx <- gamma * (x*sin(tau)+y*cos(tau))
y <- newx
x
}<- complex(real = x, imaginary = y)
z colorMap1(z, reverse = c(TRUE, FALSE, FALSE))
})
<- y <- seq(-3, 3, len = 3000)
x <- outer(y, x, function(x, y) ikeda(x, y))
image
<- par(mar = c(0,0,0,0), bg = "#002240")
opar plot(
c(-100, 100), c(-100, 100), type = "n",
xlab = "", ylab = "", axes = FALSE, asp = 1
)rasterImage(image, -100, -100, 100, 100)
par(opar)
library(RcppColors)
library(jacobi)
<- Vectorize(function(q){
f if(Mod(q) > 1 || (Im(q) == 0 && Re(q) <= 0)){
<- NA_complex_
z else{
}<- EisensteinE(6, q)
z
}colorMap2(z, bkgcolor = "#002240")
})
<- y <- seq(-1, 1, len = 2000)
x <- outer(y, x, function(x, y){
image f(complex(real = x, imaginary = y))
})
<- par(mar = c(0,0,0,0), bg = "#002240")
opar plot(
c(-100, 100), c(-100, 100), type = "n",
xlab = "", ylab = "", axes = FALSE, asp = 1
)rasterImage(image, -100, -100, 100, 100)
par(opar)
library(RcppColors)
library(jacobi)
<- Vectorize(function(q){
f if(Mod(q) >= 1){
NA_complex_
else{
}<- -1i * log(q) / pi
tau if(Im(tau) <= 0){
NA_complex_
else{
}kleinj(tau) / 1728
}
}
})
<- y <- seq(-1, 1, len = 3000)
x <- outer(y, x, function(x, y){
Z f(complex(real = x, imaginary = y))
})<- colorMap2(1/Z, bkgcolor = "#002240", reverse = c(T,T,T))
image
<- par(mar = c(0,0,0,0), bg = "#002240")
opar plot(
c(-100, 100), c(-100, 100), type = "n",
xlab = "", ylab = "", axes = FALSE, asp = 1
)rasterImage(image, -100, -100, 100, 100)
par(opar)
library(RcppColors)
library(jacobi)
library(rgl)
library(Rvcg)
library(pracma)
<- vcgSphere(8)
mesh <- cart2sph(t(mesh$vb[-4L, ]))
sphcoords <- sphcoords[, 1L] / pi
theta <- sphcoords[, 2L] / pi * 2
phi <- wsigma(theta + 1i * phi, tau = 2+2i)
Z <- colorMap1(Z, reverse = c(TRUE, FALSE, TRUE))
color $material <- list(color = color)
mesh
open3d(windowRect = c(50, 50, 562, 562), zoom = 0.75)
bg3d("lightgrey")
shade3d(mesh)
# Klein-Fibonacci map ####
library(jacobi)
library(RcppColors)
# the modified Cayley transformation
<- function(z) (1i*z + 1) / (z + 1i)
Phi <- function(z) {
PhiInv + (2i*z) / (1i - z)
1i
}# background color
<- "#ffffff"
bkgcol # make the color mapping
<- function(x, y) {
f <- complex(real = x, imaginary = y)
z <- PhiInv(z)
w ifelse(
Mod(z) > 0.96,
NA_complex_,
ifelse(
< 0,
y -1/w, w
)
)
}<- seq(-1, 1, length.out = 2048)
x <- seq(-1, 1, length.out = 2048)
y <- outer(x, y, f)
Z <- kleinj(Z) / 1728
K <- K / (1 - K - K*K)
G <- colorMap4(G, bkgcolor = bkgcol)
image # plot
<- par(mar = c(0,0,0,0), bg = bkgcol)
opar plot(
c(-1, 1), c(-1, 1), type = "n",
xlab = NA, ylab = NA, axes = FALSE, asp = 1
)rasterImage(image, -1, -1, 1, 1)
# now we add the Dedekind tessellation (the white lines)
library(PlaneGeometry)
<- function(x) abs(x - floor(x)) < x * 1e-6
isInteger abline(h = 0, col = "white", lwd = 2)
<- 150L
N for(n in 1L:N) {
if(isInteger(n/2) && ((n/2L) %% 2L == 1L)) {
next
}for(p in 1:n) {
<- sqrt(n*n - p*p + 4L)
q <- (isInteger(q) && isInteger(q/2) && (n %% 2L == 1L)) ||
cases isInteger(q) && isInteger(q/4) && (n %% 4L == 0L))
(if(cases) {
<- Circle$new(center = c(q, p)/n, radius = 2/n)
circ draw(circ, border = "white", lwd = 2)
<- Circle$new(center = c(-q, p)/n, radius = 2/n)
circ draw(circ, border = "white", lwd = 2)
<- Circle$new(center = c(q, -p)/n, radius = 2/n)
circ draw(circ, border = "white", lwd = 2)
<- Circle$new(center = c(-q, -p)/n, radius = 2/n)
circ draw(circ, border = "white", lwd = 2)
}
}
}par(opar)
library(RcppColors)
library(jacobi)
<- Vectorize(function(z){
f wsigma(z, omega = c(1, 0.25 + 1i))
})
<- y <- seq(-5, 5, length.out = 512)
x <- outer(y, x, function(x, y){
Z f(complex(real = x, imaginary = y))
})
<- colorMap5(Z, bkgcolor = "#002240")
image
<- par(mar = c(0,0,0,0), bg = "#002240")
opar plot(
c(-100, 100), c(-100, 100), type = "n", xaxs="i", yaxs="i",
xlab = NA, ylab = NA, axes = FALSE, asp = 1
)rasterImage(image, -100, -100, 100, 100)
par(opar)
These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.
Health stats visible at Monitor.