[new feature] Bspline knots

Info about new community or project announcements, implemented features, classes, modules or APIs. Might get technical!
PLEASE DO NOT POST HELP REQUESTS OR OTHER DISCUSSIONS HERE!
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
abdullah
Veteran
Posts: 4935
Joined: Sun May 04, 2014 3:16 pm
Contact:

Re: [new feature] Bspline knots

Post by abdullah »

wmayer wrote:There are further bugs:
  • when increasing the degree it doesn't add the new control points
  • when selecting a knot to decrease it the SW always complained that a knot was not selected (but can't reproduce this behaviour any more)
Fortunately, I saved the project.
Werner, in your project there are no alignment constraints! I see a bspline of 6th degree and a lot of unconnected circles (once upon I time I assume they were the poles).

For the first one, yes I confirm I can reproduce. I thought this was fixed. So it must be a regression. I will look into it.

For the second I have been unable to reproduce. If by chance anybody gets a way to reproduce it, I am more than happy to try to fix it.
wmayer
Founder
Posts: 20310
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: [new feature] Bspline knots

Post by wmayer »

Werner, in your project there are no alignment constraints! I see a bspline of 6th degree and a lot of unconnected circles (once upon I time I assume they were the poles).
When checking the XML structure I saw this too but don't know how the SW managed to omit the constraints.
abdullah
Veteran
Posts: 4935
Joined: Sun May 04, 2014 3:16 pm
Contact:

Re: [new feature] Bspline knots

Post by abdullah »

wmayer wrote: [*]when increasing the degree it doesn't add the new control points
https://github.com/FreeCAD/FreeCAD/pull/690
User avatar
NormandC
Veteran
Posts: 18589
Joined: Sat Feb 06, 2010 9:52 pm
Location: Québec, Canada

Re: [new feature] Bspline knots

Post by NormandC »

Thanks for the explanation Chris.

I seldom need to use B-splines in my line of work, in the commercial CAD software we use they are just called "curves", and there is no explanation about their nature. It will be important to have a good concise explanation in the wiki...
Chris_G wrote:So, modifying the degree of a curve while keeping its exact shape is a kind of "one way road".
The CAD program I use at work allows reducing the degree of a curve through an approximation, with a setting for a deviation tolerance. When no solution is found with a defined deviation, the curve remains unchanged.

I wonder if that could be a feature improvement later on? ;)
abdullah
Veteran
Posts: 4935
Joined: Sun May 04, 2014 3:16 pm
Contact:

Re: [new feature] Bspline knots

Post by abdullah »

NormandC wrote: I wonder if that could be a feature improvement later on? ;)
Definitely!

The knot reduction algorithm (not degree reduction) has a parameter of tolerance. Today it is set to 1E6. I did it so to avoid asking the user about a tolerance, with the idea that in the sketcher we can always move the poles to compensate. But it may be worth implementing something.

Well, I guess that in the meantime a lot of users will start using B-splines and face issues, identify clearly non-optimal workflows... this would help us decide what makes sense to have next in B-spline support ;)
vectro
Posts: 32
Joined: Fri Jun 30, 2017 1:55 am

Re: [new feature] Bspline knots

Post by vectro »

Hi Abdullah,

I'm playing around with this but I notice some issues. Perhaps there have been some regressions?

Code: Select all

OS: Ubuntu 17.10
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.17.13424 (Git)
Build type: None
Branch: master
Hash: 597dbf60947067852268033c32d6b78ac9ef280c
Python version: 2.7.14
Qt version: 4.8.7
Coin version: 4.0.0a
OCC version: 7.1.0
Locale: English/UnitedStates (en_US)
Apologies if some of these are expected.
  • The menubar has Increase Degree twice and is missing Increase Multiplicity. Here is what I see:
    menubar.png
    menubar.png (24.35 KiB) Viewed 2327 times
  • Increase Degree works as expected when a spline is selected. But the toolbar item also activates when a control point is selected, although it doesn't do anything (I guess it should only activate if a spline is selected?).
  • When trying to change multiplicity, I always get an error that "None of the selected elements is a knot of a B-Spline". I have tried selected everything there is to select but I still get this message.
abdullah
Veteran
Posts: 4935
Joined: Sun May 04, 2014 3:16 pm
Contact:

Re: [new feature] Bspline knots

Post by abdullah »

vectro wrote: Fri Mar 16, 2018 11:38 pm Hi Abdullah,

I'm playing around with this but I notice some issues. Perhaps there have been some regressions?

Code: Select all

OS: Ubuntu 17.10
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.17.13424 (Git)
Build type: None
Branch: master
Hash: 597dbf60947067852268033c32d6b78ac9ef280c
Python version: 2.7.14
Qt version: 4.8.7
Coin version: 4.0.0a
OCC version: 7.1.0
Locale: English/UnitedStates (en_US)
Apologies if some of these are expected.
  • The menubar has Increase Degree twice and is missing Increase Multiplicity. Here is what I see:
    menubar.png
  • Increase Degree works as expected when a spline is selected. But the toolbar item also activates when a control point is selected, although it doesn't do anything (I guess it should only activate if a spline is selected?).
  • When trying to change multiplicity, I always get an error that "None of the selected elements is a knot of a B-Spline". I have tried selected everything there is to select but I still get this message.
Thanks for your report.

Menu => Yes, it is a bug, must be corrected. A ticket in the tracker should be created so that I do not forget.

Increase Degree => The standard FreeCAD way is to enable a tool requiring a selection when there is a selection. So that part of the behaviour is ok. However there is no pop-up notifying that you have to select a bspline. That is a bug. A ticket would be welcome.

Modify multiplicity => Increase multiplicity works fine here. You have to select a knot, you will see the multiplicity changing. However, "Decrease multiplicity" systematically shows me a pop up with an "unknown c++ exception". This is a bug. A ticket would be welcome.

OS: Ubuntu 16.04.4 LTS
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.17.13452 (Git)
Build type: None
Branch: master
Hash: 34633c144de9133c1f9aeb7da783f369cae9bfaf
Python version: 2.7.12
Qt version: 4.8.7
Coin version: 4.0.0a
OCC version: 7.1.0


EDIT: Knot multiplicity decrease worked after I just upgraded (FreeCAD and OCCT):

OS: Ubuntu 16.04.4 LTS
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.18.13671 (Git)
Build type: None
Branch: master
Hash: c36026358222da48a1a8ab3eec87a4a4a5166b7e
Python version: 2.7.12
Qt version: 4.8.7
Coin version: 4.0.0a
OCC version: 7.2.0
vectro
Posts: 32
Joined: Fri Jun 30, 2017 1:55 am

Re: [new feature] Bspline knots

Post by vectro »

abdullah
Veteran
Posts: 4935
Joined: Sun May 04, 2014 3:16 pm
Contact:

Re: [new feature] Bspline knots

Post by abdullah »

Those are easy and I had some time. I added them to one mega pull request that is waiting in the pipeline:
https://github.com/FreeCAD/FreeCAD/pull/1437
Post Reply