"Spline" is a class of curve generating techniques. The grid library implements 
two of these techniques to interpolate a curve through some points (b-spline 
and x-spline, differing primarily in the control variables). As a graphics 
library it has a focus on graphical output, though it does export the 
xsplinePoints() function with which you can approximate the curve with short 
line segments and proceed to do your math starting from there. There are some 
options discussed here [1].

[1] 
<https://stackoverflow.com/questions/68786700/calculate-2d-spline-path-in-r-with-customizable-number-of-interpolation-points>

On August 8, 2025 7:16:03 AM PDT, Shu Fai Cheung <shufai.che...@gmail.com> 
wrote:
>Hi All,
>
>I am new to the grid package. Please pardon me for asking a question
>that may be a trivial one.
>
>If two curves created by grid::xsplineGrob() intersect, is there any
>existing function that can find this/these point(s)?
>
>This is an example:
>
>library(grid)
>
>x1 <- c(0.25, 0.25, 0.75, 0.75)
>x2 <- c(0.05, 0.15, 0.25, 0.35)
>y1 <- c(0.25, 0.75, 0.75, 0.25)
>
>a <- xsplineGrob(x1, y1, shape = 1)
>b <- xsplineGrob(x2, y1, shape = .5)
>
>grid.draw(a)
>grid.draw(b)
>
>Specifically, I would like to find these points without drawing the
>two curves using grid.draw().
>
>I found methods to find this/these point(s) on the internet. But this
>is a frequently asked question, so I guess maybe there are existing
>functions/packages that can do this. However, I could not yet find
>any.
>
>Regards,
>Shu Fai Cheung
>
>______________________________________________
>R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
>https://stat.ethz.ch/mailman/listinfo/r-help
>PLEASE do read the posting guide https://www.R-project.org/posting-guide.html
>and provide commented, minimal, self-contained, reproducible code.

-- 
Sent from my phone. Please excuse my brevity.

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide https://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to