Spline is the NuGet package published from this repository. It exposes the
reusable spline engine without bringing the Avalonia UI layer along with it.
SplineSpline.dllSplineThe package, assembly, and public namespace are aligned as Spline. Because
the namespace and the main spline type now share the same identifier, an alias
such as using SplinePath = global::Spline.Spline; keeps consumer code clear.
Vec2BezierPath and CubicBezierSpline, TwoParamCurve, and TwoParamSplineGlobalBSplineBSplineCurveCurveGrid and TwoCubicsPolylineUtilsThe package is built from src/Spline/Spline.csproj and includes both a
NuGet package and a symbol package during dotnet pack.
using Spline;
using SplinePath = global::Spline.Spline;
var controlPoints = new[]
{
new SplinePath.CP(new Vec2(0, 0), "corner", null, null),
new SplinePath.CP(new Vec2(60, 20), "smooth", null, null),
new SplinePath.CP(new Vec2(120, 0), "corner", null, null),
};
var spline = new SplinePath(controlPoints, isClosed: false);
spline.Solve();
spline.ComputeCurvatureBlending();
BezierPath path = spline.Render();
string svg = path.ToSvgPath();
using Spline;
var fitPoints = new[]
{
new Vec2(0, 0),
new Vec2(60, 40),
new Vec2(120, 10),
new Vec2(180, 0),
};
var result = GlobalBSpline.InterpolateDetailed(
fitPoints,
startTangent: new Vec2(1, 0.2),
endTangent: new Vec2(1, -0.1));
BSplineCurve curve = result.Curve;
IReadOnlyList<Vec2> cadControlPoints = curve.ControlPoints;
IReadOnlyList<double> knots = curve.Knots;
IReadOnlyList<double> weights = curve.Weights;
string svg = curve.ToSvgPath();
Use GlobalBSpline when fit-point interpolation must produce explicit
B-spline degree/control-point/knot semantics. Use the existing Spline solver
when its curvature-oriented fairing behavior and editing model are the desired
contract.
Reach for samples/DemoSpline when you need:
CurveGrid and TwoCubicsFor a focused headless example of CAD-style interpolation, use
samples/GlobalBSplineSample.