Page 1 of 1

Fixing 'illegal' curves?

Posted: Wed Oct 16, 2019 1:00 pm
by Víctor Paredes
Is there any way to remove 'illegal' curves?
Some times there are shapes that can't be filled because there's a line bent in a bad way, making some kind of loop, or there are two lines across the same points or other possibilities that escape to my mind right now.
Many times it requires a lot of trial and error to find the specific points where the problem is happening.
Do you know if a script could detect and fix those problems? or maybe just select the points with possible issues?

Thanks :)

Re: Fixing 'illegal' curves?

Posted: Wed Oct 16, 2019 9:01 pm
by hayasidist
It should be feasible to identify points that are "illogically" connected in a curve … my test harness has some curve-crawling diagnostics in it -- I'll tweak that into a stand-alone tool over the next few days. At this stage I'll aim to highlight (=select) points that are in more than 2 segments of the same curve (e.g. two separate segments of the same curve have the same pair of points). That should go someway to framing the next questions -- are there other 'illegal' configurations; is it feasible to come up with an automatic and reliable way of resolving such situations.

but/and any other ideas / input are always welcome..

Re: Fixing 'illegal' curves?

Posted: Sat Oct 19, 2019 5:43 pm
by hayasidist
Here's a first stab at this:

http://www.mediafire.com/file/wpw4mewsd ... s.lua/file

It's a menu script (I'll suggest it goes in "Draw", but wherever ..).

Run it with a vector layer active.

If it finds a point that is in the same curve twice (even if the point is hidden) it will unhide and select it.

I've run it in a few test scenarios - the "least obvious" is where two or more points are all at the same position - this can take some unpicking - but the tool actually does its job.

There are several "validly unfillable" types of curve -- the tool doesn't try to find these, but if that's a desired function, please say.

some other ideas for a further iteration of this include:
> better indication where there are multiple points at the same location;
> more diagnostic info on "rogue" curves
> working on selected curves and/or whole documents (i.e. at a granularity higher and/or lower than the active layer)




Please give it a whirl.... Feedback would be very much appreciated -- and, especially in cases where the tool fails to find a rogue curve, a copy of the layer / curve in question would be really helpful.

Re: Fixing 'illegal' curves?

Posted: Sun Oct 20, 2019 12:17 am
by DK
This script might be a hard one to test. It's only rarely I get a bad curve but when I do it's a PITA!
How do you go about creating a bad curve so we can test the script?

Cheers
D.K

Re: Fixing 'illegal' curves?

Posted: Sun Oct 20, 2019 8:29 am
by slowtiger
Freehand tool? Usually I get some loops at the beginning or close of a curve. Not a big deal to correct manually.

I think the important part is to find the troublemakers. Then highlight them, and let the user decide how to correct. As I wrote in that other post, some search for too-close points could be helpful, additional to the identical positioned ones.

Re: Fixing 'illegal' curves?

Posted: Sun Oct 20, 2019 8:29 am
by slowtiger
Freehand tool? Usually I get some loops at the beginning or close of a curve. Not a big deal to correct manually.

I think the important part is to find the troublemakers. Then highlight them, and let the user decide how to correct. As I wrote in that other post, some search for too-close points could be helpful, additional to the identical positioned ones.

Re: Fixing 'illegal' curves?

Posted: Mon Oct 21, 2019 4:22 pm
by hayasidist
here's the next rev http://www.mediafire.com/file/wpw4mewsd ... s.lua/file (same link, but repeated here)

as requested - this one also selects points that are "too close" (and the definition of "too close" depends on the zoom level of the work area - IOW if you've zoomed in and the points are individually discernible they don't get selected).

I've used an arbitrary pixel separation for "too close" -- it works "ok" on the (1920*1080) monitor I tested this on, but haven't done a rigorous test on monitors with different resolutions - so apologies in advance if this isn't quite right -- please let me know!