if(~hasObstacle([floor(Xnear(1)),floor(Xnear(2))], [floor(Xnew(1)),floor(Xnew(2))])) current_no_of_nodes = size(Tree,2);
时间: 2023-11-19 17:07:01 浏览: 33
This code snippet is checking if there is no obstacle between two nodes in a tree. If there is no obstacle, then it updates the current number of nodes in the tree.
The inputs to the function `hasObstacle` are the coordinates of two points: `[floor(Xnear(1)),floor(Xnear(2))]` and `[floor(Xnew(1)),floor(Xnew(2))]`. The `floor` function is used to round off the coordinates to the nearest integer values. The `~` symbol in front of the function call is a logical NOT operator, which means it will return true if there is no obstacle between the two points.
If the `hasObstacle` function returns false (i.e., there is no obstacle), then the size of the `Tree` matrix (which stores the nodes in the tree) is updated to `current_no_of_nodes`. This means that a new node has been added to the tree.
相关推荐
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![doc](https://img-home.csdnimg.cn/images/20210720083327.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)