overlaps() with only two polyshap objects

1 vue (au cours des 30 derniers jours)
Alon Osovsky
Alon Osovsky le 16 Mai 2020
Commenté : Alon Osovsky le 17 Mai 2020
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!

Réponse acceptée

Matt J
Matt J le 16 Mai 2020
Modifié(e) : Matt J le 16 Mai 2020
Use the two-argument form,
Obstacles=[obstacle3 obstacle2];
criterion = sum( overlaps(car,Obstacles) ) == 1 ; %true if one and only one obstacle intersected
  1 commentaire
Alon Osovsky
Alon Osovsky le 17 Mai 2020
Not exactly what I asked for, but I didn't know that there was a two-argument form. That helped - thanks a lot!

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Elementary Polygons dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by