apw_cartesian = spherical_to_cartesian(apw_spherical[, 2:3])
t = apw_spherical[, 1]
dimension = 3
initial_knots = knots_quantile(t, dimension = dimension)
lambda_seq = exp(seq(log(1e-04), log(1), length = 3))
fit = penalized_linear_spherical_spline(t = t, y = apw_cartesian,
dimension = dimension,
initial_knots = initial_knots,
lambdas = lambda_seq)
# choose a curve that minimizes the BIC
best_index = which.min(fit$bic_list)
best_index
# obtained control points for the piecewise geodesic curve
fit[[best_index]]$control_points
Run the code above in your browser using DataLab