Skip to content

Commit

Permalink
Fix for issue #181 (PR #182)
Browse files Browse the repository at this point in the history
* Changes geometry computation eps to 1e-5 
* specialized is_inside routine for Shoebox rooms
  • Loading branch information
fakufaku authored Aug 3, 2020
1 parent 41efa2d commit 3ea2abb
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 5 deletions.
8 changes: 7 additions & 1 deletion CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@ Bugfix
~~~~~~

- Fixes the Dockerfile so that we don't have to install the build dependencies manually
- Change the eps for geometry computations from 1e-4 to 1e-5 in ``libroom``

Added
~~~~~

- A specialized ``is_inside`` routine for ``ShoeBox`` rooms

`0.4.1`_ - 2020-07-02
---------------------
Expand All @@ -28,7 +34,7 @@ Bugfix
- Adds the pyproject.toml file in MANIFEST.in so that it gets picked up for packaging

Added
~~~~~~~
~~~~~

- Minimal `Dockerfile` example.

Expand Down
2 changes: 1 addition & 1 deletion pyroomacoustics/libroom_src/libroom.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@

namespace py = pybind11;

float libroom_eps = 1e-4; // epsilon is set to 0.1 millimeter (100 um)
float libroom_eps = 1e-5; // epsilon is set to 0.1 millimeter (100 um)


PYBIND11_MODULE(libroom, m) {
Expand Down
23 changes: 20 additions & 3 deletions pyroomacoustics/room.py
Original file line number Diff line number Diff line change
Expand Up @@ -2155,6 +2155,8 @@ def is_inside(self, p, include_borders=True):
else:
return False

return False

# We should never reach this
raise ValueError(
"""
Expand Down Expand Up @@ -2521,11 +2523,26 @@ def extrude(self, height):
self.shoebox_dim = np.append(self.shoebox_dim, height)

def get_volume(self):

"""
Computes the volume of a room
:param room: the room object
:return: the volume in cubic unit
Returns
-------
the volume in cubic unit
"""

return np.prod(self.shoebox_dim)

def is_inside(self, pos):
"""
Parameters
----------
pos: array_like
The position to test in an array of size 2 for a 2D room and 3 for a 3D room
Returns
-------
True if ``pos`` is a point in the room, ``False`` otherwise.
"""
pos = np.array(pos)
return np.all(pos) >= 0 and np.all(pos <= self.shoebox_dim)

0 comments on commit 3ea2abb

Please sign in to comment.