Better performance for line intersection calculations

Today I was “playing” a bit with a profiler on ModelConverterX. This gave some interesting insights in how often certain functions are called or how much time is spend in certain functions. One of the things I noticed was that while loading SCASM API macros the triangulation of the polygons took relatively a lot of time. So I decided to have a look at the code involved and found out that the calculations to determine if lines intersect were to blame for all this.

So I have rewritten this logic now and that seems indeed to have increased the speed of loading API macros quite a bit. On one of my test models it went from 1.3 to 0.5 seconds. So especially for big or complex files you can expect some increase. Some part are still not as fast as I would like, so I will continue to find places where I can improve the performance.

As a nice side effect of these changes, I have also noticed that the Ground Polygon Wizard works faster now, the slicing functionality uses the same code to do line intersections when using the boolean operations.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.