use crate::face_varying::{all_linear_copy_corners, pack, smooth_doo_sabin};
use crate::{
FaceVaryingChannel, FaceVaryingInterpolation, KernelError, SchemeOptions, StencilTable,
};
use super::stencils::{DooSabinLevelData, vertex_stencils_from_level};
pub(crate) fn fvar_stencils_once(
parent: &DooSabinLevelData,
child: &DooSabinLevelData,
channel: &FaceVaryingChannel,
mode: FaceVaryingInterpolation,
options: &SchemeOptions,
) -> Result<StencilTable, KernelError> {
let stencils = match mode {
FaceVaryingInterpolation::Linear => all_linear_copy_corners(&child.mesh, channel),
FaceVaryingInterpolation::SmoothWithLinearBoundaries
| FaceVaryingInterpolation::SmoothWithLinearCorners
| FaceVaryingInterpolation::Smooth => {
let pos = vertex_stencils_from_level(parent, options);
smooth_doo_sabin(&parent.mesh, &child.mesh, &pos, channel)
}
};
Ok(pack(&stencils))
}