edwilliams16 wrote: ↑Mon Mar 20, 2023 6:36 pm
xxxajk wrote: ↑Mon Mar 20, 2023 1:16 pm
edwilliams16 wrote: ↑Mon Mar 20, 2023 1:33 am
- Make a uniform xy-grid over the face out to its BoundBox.
Can't use a bounding box, polygons have concave parts.
Sure you can. The only purpose of the BB is to limit the size of the search grid.
FreeCAD has no control over the speed of
isInside(). You need to go to Open Cascade for that. The best you can do here is reduce the number of required calls to it and/or to multiprocess them.
It's not that simple.
FWIW I've already tried various python "solutions" (cough) and so far, all of them increased the time.
Qt's threads/thread pools: FAIL, can't get any concurrency (GIL)
Multiprocessing module: FAIL, too much overhead (huge amounts of data)
To be quite clear here...
I'm not finding a point which is in a simplistic box, etc. I could write that myself, and actually have some 40 years ago...
To become a little more tuned in, I guess I need you (and everyone else probably) to try a small example...
Create a polygon with 4000 vertexes and try to find 800 sets of points (1600 total points) inside of it, you will be sitting there for quite a while.
Now try doing the same thing over 100-200 of these, some of which have 40,000 vertexes. Go to bed, come back in the morning, and if you don't run out of memory and swap (Have managed to reduce the memory recently) you'll unsurprisingly find it still spinning it's wheels.
It's all because of the silly GIL, which can be easily bypassed on the C++ side, and reduce a 10 minute point scan to a sub-second one, and one hour to a minute (which I could actually tolerate).
I'm not asking or looking for a "pythonic solution" because there are none, zero, zip, zilch, empty, void, and null.
I'm asking for either someone who knows OCC to point me in the right direction, or take the bull by the horns and write it once they realize how awesome it would be to do this, or to collaborate with me.
Python uses C/C++ under the hood for several reasons, and most of them is due to the GIL. It's why we have stuff like numpy...
I DO appreciate the attempts to offer something that works for very simple things. Just please try to understand the actual scope of the problem, and how useful these could be. Who knows, even cloud points might actually generate in a reasonable amount of time. (tried it, that workbench hates me, spins for an hour on the simplest things)
I'm not the usual "normal" FreeCAD user, I use it programmatically for most of the things I do. And for the few things that I don't I only use the part workbench.
Drafting? Meh, I can calculate my own lines/polygon, and I don't need to deal with the 10 clicks to set a value... if I can be bothered to find it in all of the menus. I pretty much feel the same way with all the other GUI workbench stuff, save for the Part workbench, which just works, and is super easy to understand.