Page 1 of 1

Discretize arc to lines

Posted: Thu Nov 02, 2023 10:43 am
by pederlh
Hi!
I wish to take an arc segment of a polyline and discretize it to a set number of straight lines. Does this functionality exist, or is there a quick workaround to achieve the same effect?

Thanks in advance!


QCAD version 3.28.2.2 (QCAD Professional)
macOS 14.0 Sonoma

Re: Discretize arc to lines

Posted: Thu Nov 02, 2023 10:51 am
by andrew
You can use the tool

Misc > Draw > Polygon Hull

Note that this is designed to generate polygon hulls of closed polylines. Open polylines are treated as implicitly closed for the interpretation of the inside option.

Re: Discretize arc to lines

Posted: Thu Nov 02, 2023 12:09 pm
by CVH
pederlh wrote:
Thu Nov 02, 2023 10:43 am
I wish to take an arc segment of a polyline and discretize it to a set number of straight lines.
Hi, I read that as 'I wish to take one arc segment of a polyline ...'
Then you should explode the polyline and address the single arc (or some to all acrs) with Split Entities(MS) => N equal parts.
Afterwards one can recombine the segments to one polyline.

Discretization based on segment length is another ballpark.
There is something by Shutterstock: https://www.qcad.org/rsforum/viewtopic. ... discretize
But again for arcs and rather dedicated for a custom task.

Discretization of arcs (circles) .. polyline arc-segments pops up now and then.
Given that there are build-in resources it seems rather odd that this is not a basic function.
(RArc.approximateWithLines(l,a) ; RArc.approximateWithLinesTan(l,a))

Regards,
CVH

Re: Discretize arc to lines

Posted: Thu Nov 02, 2023 1:39 pm
by pederlh
I see, both comments are very useful. It is nice to have both maximum angle and specific number of parts as options.

I'm surprised that Polygon Hull doesn't have PH as shortcut already though (and no documentation), seems like a common operation.

Re: Discretize arc to lines

Posted: Thu Nov 02, 2023 2:02 pm
by CVH
The Misc section are indeed undocumented:
andrew wrote:
Mon Jan 03, 2022 10:33 am
The "Misc" menu is the overflow section of QCAD. It is intended for complemental tools not normally part of a CAD system as well as all incomplete, untranslated, undocumented or experimental tools that might or might not be useful for someone.
The preview seems crippled and I can not figure out the transfer function between tolerance and actual segmentation.
I understand that at the inside it are N whole segments and at the outside N-1 whole segments, starting and ending with a half segment.
IMHO N should be 3 given R=50, Sweep is 97.56122825 and tol=2 but it returns 4 segments.

Probably some mathematical rounding and/or comparing preference as the sagitta would be 2.000 within 1e-9 (RS.Pointtolerance).

Regards,
CVH