Graphic intersection: how to trigger a colour change

조회 수: 1 (최근 30일)
john_arle
john_arle 2019년 11월 4일
답변: Amrtanshu Raj 2021년 9월 13일
Dear all,
I am plotting real time trajectories on a map full of obstacles.
The obstacles are polygons and my domain is 2D.
I would like to color in red trajectories of bodies that cross an obstacle,
to show that this is unphysical. Of course, that part of the trajectory has to change colour.
Any suggestions?
Trajectories are plotted in real time according to a running simulation.
I believe that checking at every iteration whether all the trajectories coincide with the contour of the
obstacles would kill the performance.

답변 (1개)

Amrtanshu Raj
Amrtanshu Raj 2021년 9월 13일
Hi,
First you can use a occupancyMap for storing the obstacle and the map.
Then there can be multiple ways to check if a trajectory is valid on not based on your use case.
  1. You can use the isStateValid or the checkPathValidity function to check if the trajectory is valid.
  2. You can also use the checkOccupancy function to check if all the points on the trajectory are obstacle free. To interpolate between the trajectory waypoints, the raycast function can be used.
Hope this helps

카테고리

Help CenterFile Exchange에서 Surfaces and Volumes에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by