# `point`ではない図形を使ってみる
# ここでは十字型のSVGパスを試すことに
# データの与え方がすこし違うため
# 書きかえてみたが、思ったよりも
# 画面がうるさすぎるかも…??
rast <-
canvas("black") |>
# add_point(
# dat |>
# dplyr::select(x, y, z) |>
# as.matrix() %*%
# affiner::transform2d() %*%
# affiner::scale2d(N / 2) %*%
# affiner::translate2d(W / 2, W / 2),
# group = seq_len(nrow(dat)),
# color = dplyr::pull(dat, col) |>
# rasengan::spiral() |>
# col2rgba(),
# props = paint(
# width = 2,
# blend_mode = BlendMode$Plus,
# )
# ) |>
add_path(
rep_len("M45 10 H55 V45 H90 V55 H55 V90 H45 V55 H10 V45 H45 Z", nrow(dat)),
rsx_trans = dat |>
dplyr::reframe(pos = cbind(x, y, z)) |>
dplyr::mutate(
pos = pos %*%
affiner::transform2d() %*%
affiner::scale2d(N / 2) %*%
affiner::translate2d(W / 2, W / 2)
) |>
dplyr::reframe(
sc = .1,
rot = atan2(pos[, 2], pos[, 1]),
x = pos[, 1],
y = pos[, 2],
ax = 50,
ay = 50
),
color = dplyr::pull(dat, col) |>
rasengan::spiral() |>
col2rgba(),
props = paint(
width = 1,
blend_mode = BlendMode$Screen,
style = Style$Fill,
)
) |>
as_nativeraster() |>
aznyan::diffusion_filter(factor = 3) |>
aznyan::median_blur()
grid::grid.newpage()
grid::grid.raster(rast, interpolate = FALSE)