In my problem, I have a car and multiple obstacle polyshape objects, and I want to determine if the car is overlapping only one of the obstacles. I found out that the `overlaps` command is very expensive, perhaps because it also checks if the obstacles overlap each other (a check that I don't need!)
if I do something like:
table = overlaps([car obstacle3 obstacle2])
I will get a matrix that shows me all of the possible overlaps with those 3 shapes.
I'm looking for a simple solution that will give me a true or false value - if the car object overlaps one of the obstacles (or more).
Thanks in advance!

 채택된 답변

Matt J
Matt J 2020년 5월 16일
편집: Matt J 2020년 5월 16일

0 개 추천

Use the two-argument form,
Obstacles=[obstacle3 obstacle2];
criterion = sum( overlaps(car,Obstacles) ) == 1 ; %true if one and only one obstacle intersected

댓글 수: 1

Alon Osovsky
Alon Osovsky 2020년 5월 17일
Not exactly what I asked for, but I didn't know that there was a two-argument form. That helped - thanks a lot!

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

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Discrete Data Plots에 대해 자세히 알아보기

태그

질문:

2020년 5월 16일

댓글:

2020년 5월 17일

Community Treasure Hunt

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

Start Hunting!

Translated by