facebookresearch / habitat-sim

A flexible, high-performance 3D simulator for Embodied AI research.
https://aihabitat.org/
MIT License
2.48k stars 406 forks source link

--Region query tools #2336

Closed jturner65 closed 4 months ago

jturner65 commented 4 months ago

Motivation and Context

This PR adds functions to test for point-region membership and point collection-region membership with a weighting factor, to account for possibly nested regions. If a point is only found in a single region, its weighting in that region is 1.

Otherwise, each region is assigned a weighting that is inversely proportional to the area of a particular region containing the point. The weighting is calculated like so : `

     1 - (region_area/total_region_area)

whereregion_area` is the area of a specific region the point is found in and total_region_area is the total area of all regions that point is found in.

For collections of points that are assumed to belong to the same construct, the region membership check has been modified to give a weighting value only to the innermost (i.e. smallest area) region in nested regions. In other words, in the case of nested regions, a point is only considered found in the innermost region. the same weighting value to all regions containing a particular point. In the case of nested regions, this may result in an object being fully contained within the containing region, while only partially contained within the nested internal region.

How Has This Been Tested

Locally c++ and python tests. Python test modified to verify that with non-nested regions it returns the same result as the non-weighted versions

Types of changes

Checklist