geo_slerp | R Documentation |
Radius interpolation by 3 points and a given radius.
The Radius interpolation will be calculated using the cp
= common centre point and the vector x1
as the starting point and the vector x2
as the end point.
geo_slerp(R, x1, x2, cp, nb_points = 10)
R |
radius |
x1 |
starting point vector |
x2 |
end point vector |
cp |
common centre point vector |
nb_points |
count of points to be generate by the function. |
The slerp calculation is done by the following formula:
Slerp(p_0,p_1,t) = \frac{sin((1 - t) \cdot \Omega)}{sin(\Omega)} \cdot p_0 + \frac{sin(t \cdot \Omega)}{sin(\Omega)} \cdot p_1
https://en.wikipedia.org/wiki/Slerp
Matrix with nrow(nb_points)
Florian Wagner florian.wagner@wagnius.ch
p <- data.frame(x1 = c(-10,-5,50),
x2 = c(-20,10,2),
cp = c(10,-10,10))|>
as.matrix()|>
t()
m <- geo_slerp(R =10,
x1 = p["x1",],
x2 = p["x2",],
cp = p["cp",],
nb_points = 20)
print(m)
#Plot 3D
library(rgl)
plot3d( m, type = "p", lwd = 2, top = TRUE,
col = rainbow(nrow(m)),
aspect = "iso")
plot3d(p, add = TRUE, col = "black")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.