Faster polygon operations than polyshape

Is there a faster method to handle vast amounts of polyshape operations? In my thesis, I need to perform large number of boolean operations of FoV of multiple satellites. I tried using a MEX version of GPC-Library. Though individual operations (binary operations with just two polygons) seemed faster, when working with polygon vectors, polyshape again become comparable in performance. Besides this the MEX code also become unstable and crashes MATLAB as I call it repeatedly. Any suggestions would be appriceated.
P.s. I use polyshape due to level of accuracy required for work, instead of approximated spherical point and operations on them.

댓글 수: 1

Jayanth Suresh
Jayanth Suresh 2023년 6월 20일
@JackCrusoe47 I am looking for ways to speed up my polyshape operations too. Do you have a rough estimate on the kind of time savings you got with the code you were using?

댓글을 달려면 로그인하십시오.

답변 (1개)

Bruno Luong
Bruno Luong 2020년 12월 6일

1 개 추천

댓글 수: 5

JackCrusoe47
JackCrusoe47 2020년 12월 8일
Thank you.
In then end I used a modified version of Angus J's code too.
I used : New Polygon Clipping and Offsetting by Erik Johnson and then modified it allow multiple boolean operation and hole definition closely resembling Polygon Clipper - Sebastian Hölz method. I needed to use all the functionalities of polyshape (diff, intersect, xor and union + overlaps and isinterior (I used the mex version of INPOLYGON - Bruno Luong ).
As you can probably guess, I'm still not used to writing my own mex function builds (except using Matlab coder).
JackCrusoe47
JackCrusoe47 2020년 12월 8일
@ Bruno Luong . Sorry. I should thank you also for your function, Inpolygon. I didn't realisize it was your code. I was able to speed up several parts of my thesis using your function. Thank you.
Bruno Luong
Bruno Luong 2020년 12월 8일
Ah your are welcome. I'm glad to learn the code is helpful.
Tian Dong
Tian Dong 2022년 4월 28일
편집: Tian Dong 2022년 4월 28일
Hi Bruno,
I hope this message find you well. I came across this thread as I was searching for a way to speed up union polyshapes. I am putting polybuffer around a set of links (see figure below). Method 1(left figure): store XY coordinates of all links in one array, then make a polyshape. output is not ideal. Method 2 (right figure): generate a polyshape for each link, then union. output is very ideal, but about 20 times slower than Method 1. I wonder if you can help me out here. Thank you.
In term of the clipper software, do I need to write a MEX Function based on C++ or C# to translate the software to use it in MATLAB, how would the outputs from software work with polyshape in MATLAB? I do not have any experenice in C languages or wrting MEX. any tipps there? Thank you so much.
Bruno Luong
Bruno Luong 2022년 4월 28일
The clipper provide a mex-ready cpp file. All you need is the C compiler supported by your MATLAB version.
The package is provided with an mfile with H1 line. The calling is well documented.

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Polygonal Shapes에 대해 자세히 알아보기

제품

릴리스

R2020b

질문:

2020년 12월 6일

댓글:

2023년 6월 20일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by