library(tidyverse)
group_by_in <- function(data, x, sep) {
enquo_x <- rlang::quo_name(enquo(x))
splitted <- strsplit(data[[enquo_x]], sep)
values <- unique(unlist(splitted))
which_list <- function(data, value) {
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ieee754 = function(x, precision = 'long') { | |
switch(precision, long = { | |
dig_exponent = 11L | |
exp_shift = 1023L | |
dig_mantissa = 52L | |
}, short = { | |
dig_exponent = 8L | |
exp_shift = 127L | |
dig_mantissa = 23L | |
}, stop("Valid precisions are 'long' and 'short'.")) |
#remotes::install_cran(c("anglr", "silicate"))
library(silicate)
library(anglr)
library(rgl)
## volcano is heightmap, doesn't exist in geo-space in R so we map it do the extent of
## these spatial polygons
poly <- silicate::minimal_mesh
# xmin : 0
library(anglr)
dem <- gebco
mesh <- as.mesh3d(dem, triangles = FALSE)
mesh$material$color <- colourvalues::colour_values(mesh$vb[3, ]); mesh$meshColor <- "vertices"
plot3d(mesh)
rgl::aspect3d(1, 1, .1)
## surface3d way
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require(ggplot2) | |
ggplot() + annotate(x = -10, y=1, xend = -1.38, yend=3, geom='segment', col='white') + | |
geom_segment(data = data.frame(id=1:30, x = -1.38, y = seq(3.0, 3.0, len=30), | |
xend = seq(1.1, 1.4, len=30), yend = seq(3.5, 3.0, len=30)), | |
aes(x, y, xend=xend, yend=yend, col=factor(id))) + | |
geom_segment(data = data.frame(x = -1.38, y = seq(3.0, 3.0, len=30), | |
xend = seq(1.4, 1.1, len=30), yend = seq(3.0, 3.5, len=30)), | |
aes(x, y, xend=xend, yend=yend), col='#00000080') + | |
geom_segment(data = data.frame(x = -1.38, y = seq(3.0, 3.0, len=30), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
listframe <- function(...){ | |
structure( | |
tibble(...), | |
class = c("listframe","tbl_df","tbl","data.frame") | |
) | |
} | |
lf <- listframe( | |
a = list(1,c("a","b","c"),matrix(1:4,2,2)), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# define `makeNamespace` function | |
eval(body(loadNamespace)[[c(8, 4, 4)]]) | |
ns <- makeNamespace("fake") | |
# define functions | |
ns$foo <- function() "foo!" | |
ns$bar <- function() "bar!" | |
# export some |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(tickle) | |
x11(type = 'dbcairo', antialias = 'none') | |
dev.control(displaylist = 'inhibit') | |
df = data.frame(x=runif(10,-1,1),y=runif(10,-1,1),size=rep(1,10)) | |
size <- reactive_dbl(value=6) | |
rate <- reactive_dbl(value=10) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
##___________________________________________________ | |
## | |
## Script name: render_pointcloud.R | |
## | |
## Purpose of script: | |
## render forest plot pointcloud with raytracing | |
## | |
## Author: Jens Wiesehahn | |
## Copyright (c) Jens Wiesehahn, 2023 | |
## Email: [email protected] |
sfx <- silicate::inlandwaters[6, ]
## devtools::install_github("hypertidy/anglr") ## in desperate need of reboot, alignment with wk/geos etc.
ps <- anglr::as_pslg(sfx)
tr <- triangulate(ps)
plot(tr$VP, pch = ".")
plot(tr, add = TRUE)
points(tr$VP, pch = "+")
OlderNewer