jigsawR / R /RcppExports.R
pjt222's picture
Upload folder using huggingface_hub
e232e39 verified
Raw
History Blame Contribute Delete
1.77 kB
# Generated by using Rcpp::compileAttributes() -> do not edit by hand
# Generator token: 10BE3573-1514-4C36-9D1C-5A225CD40393
#' Generate batch of deterministic random numbers
#'
#' Uses sine-based RNG matching the JavaScript jigsaw generator.
#' Much faster than calling R's random() function repeatedly.
#'
#' @param seed Starting seed value
#' @param count Number of random values to generate
#' @param min_val Minimum value (default 0.0)
#' @param max_val Maximum value (default 1.0)
#' @return NumericVector of random values
#' @keywords internal
random_batch_cpp <- function(seed, count, min_val = 0.0, max_val = 1.0) {
.Call(`_jigsawR_random_batch_cpp`, seed, count, min_val, max_val)
}
#' Compute cubic Bezier curve points in batch
#'
#' Vectorized implementation of cubic Bezier interpolation.
#' Computes points along the curve defined by P0, CP1, CP2, P1.
#'
#' @param p0 Start point as c(x, y)
#' @param cp1 First control point as c(x, y)
#' @param cp2 Second control point as c(x, y)
#' @param p1 End point as c(x, y)
#' @param n_points Number of points to generate
#' @return NumericMatrix with x and y columns
#' @keywords internal
bezier_batch_cpp <- function(p0, cp1, cp2, p1, n_points) {
.Call(`_jigsawR_bezier_batch_cpp`, p0, cp1, cp2, p1, n_points)
}
#' Translate SVG path coordinates by (dx, dy)
#'
#' Character-by-character parsing without regex for better performance.
#' Handles M, L, C, A, and Z commands.
#'
#' @param path_string SVG path d attribute string
#' @param dx X translation
#' @param dy Y translation
#' @return Translated SVG path string
#' @keywords internal
svg_translate_cpp <- function(path_string, dx, dy) {
.Call(`_jigsawR_svg_translate_cpp`, path_string, dx, dy)
}