File size: 1,774 Bytes
e232e39
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# 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)
}