Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Decompose Bspline #224

Closed
ajayre opened this issue Nov 25, 2022 · 3 comments
Closed

Decompose Bspline #224

ajayre opened this issue Nov 25, 2022 · 3 comments

Comments

@ajayre
Copy link

ajayre commented Nov 25, 2022

Hi, I have a Bezier curve of degree five

BSpline Spline = new BSpline((uint)_ControlPoints.Count / 2, 2, (uint)_Order - 1, BSplineType.CLAMPED);
Spline.ControlPoints = _ControlPoints;
Spline.Knots = _KnotVectors;
BSpline Beziers = Spline.ToBeziers();
...
if (Beziers.Degree == 5)
{
  ...

I need to break this up into Bezier curves of degree three or less. What do I need to call? Note that I am using the C# bindings generated by swig (which I don't really understand).

I see there is ts_bspline_to_beziers and this appears in the namespace TinySpline.tinysplinecsharp but how do I call it? Is there an example? Is it even the right function?

Thanks, Andy

@msteinbeck
Copy link
Owner

msteinbeck commented Nov 28, 2022

Hi @ajayre,

Hi, I have a Bezier curve of degree five [...] I need to break this up into Bezier curves of degree three or less.

You cannot reduce the degree of a spline with ToBeziers(). ToBeziers() simply "cuts" the spline into a sequence of connected Bezier curves where each Bezier curve has the same degree as the spline on which ToBeziers() was called. Degree reduction is not (yet) implemented in TinySpline. I did some research in the past and found the following paper: https://www.academia.edu/78438328/Degree_reduction_of_B%C3%A9zier_curves Section 2.1. presents an approach how to reduce the degree of a spline. Note, however, that the shape of a spline slightly changes when reducing its degree.

@ajayre
Copy link
Author

ajayre commented Nov 28, 2022

Thanks for the pointer.

@msteinbeck
Copy link
Owner

I'm closing this issue. Don't hesitate to reopen it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants