union of polyshapes, problem with collinearity

6 ビュー (過去 30 日間)
Alexandra Kopaleyshvili
Alexandra Kopaleyshvili 2021 年 5 月 23 日
Hello,
I have 15 polygons (of streets) that I can merge into one using the union function.
But if I want to unite only a few of them (that are close to each other), I get:
Error using polyshape/parseCollinear (line 946)
Parameter name must be 'KeepCollinearPoints'.
Error in polyshape/parseIntersectUnionArgs (line 973)
collinear =
polyshape.parseCollinear(varargin{next_inp:end});
Error in polyshape/union (line 42)
[has_clip, collinear] = polyshape.parseIntersectUnionArgs(false,
varargin{:});
Unfortunately, I don't really understand what MatLAB wants me to do to get my unified polygon groups.
Ah, and if polygons are collinear, I'd like to keep those collinear points.
Thank you!
  2 件のコメント
Matt J
Matt J 2021 年 5 月 23 日
I suggest you attach the arguments to your call to union() in a .mat file, so the community can explore the problem.
Alexandra Kopaleyshvili
Alexandra Kopaleyshvili 2021 年 5 月 23 日
never done this before, hope it works

サインインしてコメントする。

採用された回答

Matt J
Matt J 2021 年 5 月 23 日
編集済み: Matt J 2021 年 5 月 23 日
You just had a comma separated list in there by accident. The polyshapes must be given to union() as a vector.
load(websave('t','https://www.mathworks.com/matlabcentral/answers/uploaded_files/627388/streets_185.mat'));
A=union([Streetshape_185.L2{1,1}{:,1}],'KeepCollinearPoints',true)
A =
polyshape with properties: Vertices: [3604×2 double] NumRegions: 3 NumHoles: 0
plot(A)
  1 件のコメント
Alexandra Kopaleyshvili
Alexandra Kopaleyshvili 2021 年 5 月 23 日
sometimes it's so easy. thank you so much!:)

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeElementary Polygons についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by