Simplify Poly

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
CVH
Premier Member
Posts: 3418
Joined: Wed Sep 27, 2017 4:17 pm

Simplify Poly

Post by CVH » Tue Jun 23, 2020 8:08 pm

Andrew,

I make use of poly.simplify(Tolerance)

If I swap in units I have to keep track of it. :!:
(0,001 in Inch is not the same as 0,001 in mm)
If it is an angle tolerance, are that degrees or radians :?:

I failed in the quest for the answer. :oops:

In the GUI the Tolerance is the 'Maximum Deviation from original polyline'
AKA a distance from any node to the line segment bypassing that node.
Checked it, and it is a distance.

In RPolyline.h: ... Also a distance value RS::PointTolerance but default rather small.
bool simplify(double tolerance = RS::PointTolerance);

poly.simplify(); will be of little to no use in a real world situation.
eg. isSplineEntity section of Explode.explodeEntity of Explode.js.
There has to be a default of course and while its an absolute the minimum is the safest choise ever.

https://qcad.org/rsforum/viewtopic.php? ... ify#p16745
https://qcad.org/doc/qcad/latest/refere ... neSimplify
Speek of maximum angle deviation.

https://qcad.org/doc/qcad/3.0/developer ... 25c6837d3f
https://qcad.org/doc/qcad/3.0/developer ... 11b5405c1f
Speek of angle tolerance what is about the same in the correct context.

Simplify has two entries in QCAD ini, an angle and the last succesfully
used distance tolerance in my native format:

Code: Select all

[Simplify]
AngleTolerance=100
Tolerance="0,19"

PolylineSimplify (PRO) has an angle entry in QCAD ini:

Code: Select all

[PolylineSimplify]
AngleTolerance=10
VisibleInMenu=true
VisibleInToolBar=true
VisibleInCadToolBar=true
VisibleInMatrixPanel=true
What looks like the entries of an init section.

As Pro user, lets say I am a bit confused. :?

Regards,
CVH

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

Re: Simplify Poly

Post by andrew » Wed Jun 24, 2020 11:44 am

Stating with QCAD 3.23.0, the Ramer Douglas Peucker algorithm is used to simplify line segments of polylines, "tolerance" being the "epsilon" or maximum deviation from the original polyline. The manual will be updated.

CVH
Premier Member
Posts: 3418
Joined: Wed Sep 27, 2017 4:17 pm

Re: Simplify Poly

Post by CVH » Wed Jun 24, 2020 12:31 pm

Thanks,
CVH

CVH
Premier Member
Posts: 3418
Joined: Wed Sep 27, 2017 4:17 pm

Re: Simplify Poly

Post by CVH » Thu Dec 24, 2020 11:21 am


Post Reply

Return to “QCAD Programming, Script Programming and Contributing”