BRepAdaptor_CompCurve::D1() parameter distribution??

Here's the place for discussion related to coding in FreeCAD, C++ or Python. Design, interfaces and structures.
mfro
Posts: 45
Joined: Sat Sep 23, 2017 8:15 am

BRepAdaptor_CompCurve::D1() parameter distribution??

Postby mfro » Wed Sep 30, 2020 12:38 pm

In this Post I was suggesting to extend the "Map Parameter" attachment (that only allows single curves right now) to also allow Wires (I have shown an animation in that post to show why).

I now implemented this and did some testing. It works.

Kind of.

If just BRepAdaptor_CompCurve::D1() would return parameter values that are evenly distributed along the wire. Which it doesn't:
RollerChain.png
RollerChain.png (68.95 KiB) Viewed 375 times
Anybody knows if this is a feature or am I doing something wrong. Or should I consider this a bug?
Cheers,
Markus
User avatar
Chris_G
Posts: 1583
Joined: Tue Dec 31, 2013 4:10 pm
Location: France
Contact:

Re: BRepAdaptor_CompCurve::D1() parameter distribution??

Postby Chris_G » Wed Sep 30, 2020 1:07 pm

IMHO you must not assume any specific parametrisation.
This is not a bug. It is up to you to compute the right sequence of parameters to get your "constant speed" samples.

EDIT : GCPnts_UniformAbscissa may be useful
User avatar
tanderson69
Posts: 1545
Joined: Thu Feb 18, 2010 1:07 am

Re: BRepAdaptor_CompCurve::D1() parameter distribution??

Postby tanderson69 » Wed Sep 30, 2020 1:37 pm

mfro wrote:
Wed Sep 30, 2020 12:38 pm
If just BRepAdaptor_CompCurve::D1() would return parameter values that are evenly distributed along the wire. Which it doesn't:
It might. There are several constructors for BRepAdaptor_CompCurve. I searched freecads code base and the only BRepAdaptor_CompCurve constructor I found, was the constructor using the single parameter wire. So I can only guess that using another constructor and passing true for 'KnotByCurvilinearAbcissa' parameter would give you what you want. You can also specify the parametric range.
mfro
Posts: 45
Joined: Sat Sep 23, 2017 8:15 am

Re: BRepAdaptor_CompCurve::D1() parameter distribution??

Postby mfro » Wed Sep 30, 2020 2:43 pm

tanderson69 wrote:
Wed Sep 30, 2020 1:37 pm
... So I can only guess that using another constructor and passing true for 'KnotByCurvilinearAbcissa' parameter would give you what you want...
Good guess, hit the spot, many thanks!

RollerChain.png
RollerChain.png (70.45 KiB) Viewed 277 times
Cheers,
Markus
mfro
Posts: 45
Joined: Sat Sep 23, 2017 8:15 am

Re: BRepAdaptor_CompCurve::D1() parameter distribution??

Postby mfro » Wed Sep 30, 2020 6:05 pm

Thanks to tanderson69, the roller chain can now be properly animated using plain Assembly 4 functionality and a little expression trickery (that probably needs revisiting to improve performance), no extra code needed.
Peek 2020-09-30 19-57.gif
Peek 2020-09-30 19-57.gif (455.87 KiB) Viewed 235 times
Could anybody offhand give some guidance on the FreeCAD pull/enhancement request process, please?
I don't want to collide with anything with my very first contribution...
Cheers,
Markus
User avatar
Kunda1
Posts: 9223
Joined: Thu Jan 05, 2017 9:03 pm

Re: BRepAdaptor_CompCurve::D1() parameter distribution??

Postby Kunda1 » Thu Oct 01, 2020 4:25 am

Checkout our wiki page called Source code management
Alone you go faster. Together we go farther
Want to contribute back to FC? Checkout:
#lowhangingfruit | Use the Source, Luke. | How to Help FreeCAD | How to report FC bugs and features