3D JPS

0.引言

记录一下,不然久了可能就看不懂了。

1.图解Neighbor Pruning & Forced Neighbors

Alt
case3中,方向为正方体对角线。

Alt

	// nsz contains the number of neighbors for the four different types of moves:
	// no move (norm 0):        26 neighbors always added
	//                          0 forced neighbors to check (never happens)
	//                          0 neighbors to add if forced (never happens)
	// straight (norm 1):       1 neighbor always added
	//                          8 forced neighbors to check
	//                          8 neighbors to add if forced
	// diagonal (norm sqrt(2)): 3 neighbors always added
	//                          8 forced neighbors to check
	//                          12 neighbors to add if forced
	// diagonal (norm sqrt(3)): 7 neighbors always added
	//                          6 forced neighbors to check
	//                          12 neighbors to add if forced
	static constexpr int nsz[4][2] = {{26, 0}, {1, 8}, {3, 12}, {7, 12}};

straight (norm 1): 即是case1,对垂直与屏幕的平面,从当前节点检测周围8个点是不是障碍物,如果是,则下一平面的8个点即为forced neighbors,将8个均加入openset,疑问:为什么不是将下一平面的9个点均加入?哦:1 neighbor always added。

diagonal (norm sqrt(3)): 即是case3,从小正方体看,"7 neighbors always added"容易理解(7个natural neighbors),从底层图看,图中没画完全,再考虑障碍物对称情况,可能会有6个forced neighbors。“12 neighbors to add if forced”是最多12个neighbors加入openset,而不是13个。

diagonal (norm sqrt(2)): 即是case2,先看case3,再看case2其实更好理解,case2的顶层类似于case3的底层,于是有6个可能的forced neighbors,然后再看中间层的情况,同样是只画了一部分(画全了更不好理解了),对称性加上去就可以看出有2个可能的forced neighbors,故,case2一共有8个可能的forced neighbors。方向只在中间层,“3 neighbors always added”很好理解。疑问:为什么是“12 neighbors to add if forced”而不是11?

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章