Qcad's Spline algorithm

Discussion forum for C++ and script developers who are using the QCAD development platform or who are looking to contribute to QCAD (translations, documentation, etc).

Moderator: andrew

Forum rules

Always indicate your operating system and QCAD version.

Attach drawing files, scripts and screenshots.

Post one question per topic.

Post Reply
trongdong
Newbie Member
Posts: 4
Joined: Mon Jan 12, 2015 8:06 am

Qcad's Spline algorithm

Post by trongdong » Tue Jul 21, 2015 4:18 pm

Hi there,
At the moment we are using QCAD Pro (latest version). We developed a calc engine, which create entities in python code, and then compile it to DXF file using QCAD.
We have a problem with spline. Since, in python code, we use interpolation from scipy package.
http://docs.scipy.org/doc/scipy/referen ... olate.html
http://docs.scipy.org/doc/scipy/referen ... nterpolate

The problem is it doesn't give us the correct spline that appears in qcad. So, what's the algorithm did you use to build that spline?
Thank you very much!

User avatar
andrew
Site Admin
Posts: 9037
Joined: Fri Mar 30, 2007 6:07 am

Re: Qcad's Spline algorithm

Post by andrew » Tue Jul 21, 2015 6:26 pm

I assume you are referring to splines created from fit points (points that are on the spline curve).

There are various different algorithms for spline fitting. QCAD Professional uses the Teigha libraries to do the spline fitting exactly in the same way as Autocad and compatible products do it. I honestly do not know what kind of algorithm Teigha or Autocad use internally. But perhaps this is a new lead to follow..

trongdong
Newbie Member
Posts: 4
Joined: Mon Jan 12, 2015 8:06 am

Re: Qcad's Spline algorithm

Post by trongdong » Wed Jul 22, 2015 2:20 am

Hi Andrew,
Thanks for reply. Does that Teigha Libraries support us to calculate the length of spline and give exactly answer as qcad does?

User avatar
andrew
Site Admin
Posts: 9037
Joined: Fri Mar 30, 2007 6:07 am

Re: Qcad's Spline algorithm

Post by andrew » Wed Jul 22, 2015 8:49 am

You can use RSpline::getLength() to get the approximate length of the spline (based on interpolation).

Post Reply

Return to “QCAD Programming, Script Programming and Contributing”