BRepAdaptor_CompCurve::D1() parameter distribution??

Here's the place for discussion related to coding in FreeCAD, C++ or Python. Design, interfaces and structures.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Post Reply
User avatar
mfro
Posts: 666
Joined: Sat Sep 23, 2017 8:15 am

BRepAdaptor_CompCurve::D1() parameter distribution??

Post by mfro »

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 956 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
Veteran
Posts: 2598
Joined: Tue Dec 31, 2013 4:10 pm
Location: France
Contact:

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

Post by Chris_G »

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
Veteran
Posts: 1626
Joined: Thu Feb 18, 2010 1:07 am

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

Post by tanderson69 »

mfro wrote: Wed Sep 30, 2020 12:38 pmIf 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.
User avatar
mfro
Posts: 666
Joined: Sat Sep 23, 2017 8:15 am

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

Post by mfro »

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 858 times
Cheers,
Markus
User avatar
mfro
Posts: 666
Joined: Sat Sep 23, 2017 8:15 am

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

Post by mfro »

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 816 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
Veteran
Posts: 13434
Joined: Thu Jan 05, 2017 9:03 pm

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

Post by Kunda1 »

Checkout our wiki page called Source code management
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
Post Reply