Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add room generator. #113

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Update intersection function call.
ebezzam committed Jun 27, 2019

Unverified

This user has not yet uploaded their public signing key.
commit d03880cac87b9c799ef6bd64f0eec3c7aa6109b7
1 change: 1 addition & 0 deletions pyroomacoustics/__init__.py
Original file line number Diff line number Diff line change
@@ -137,6 +137,7 @@
from . import datasets
from . import bss
from . import denoise
from . import random

import warnings
warnings.warn(
6 changes: 4 additions & 2 deletions pyroomacoustics/random/room.py
Original file line number Diff line number Diff line change
@@ -471,8 +471,10 @@ def sample_source_distance(room, mic_loc, orientation):
spher2cart(diag_dist, orientation[0], orientation[1])

# determine intersection and then sample distance in between
intersection = np.zeros(3, dtype=np.float32)
mic_loc = np.array(mic_loc).astype(np.float32)
test_point = np.array(test_point).astype(np.float32)
for k, w in enumerate(room.walls):
if w.intersects(mic_loc, test_point)[0]:
intersection = w.intersection(mic_loc, test_point)[0]
if w.intersection(mic_loc, test_point, intersection) == 0:
max_dist = np.sqrt(sum((mic_loc - intersection) ** 2))
return np.random.uniform(0, max_dist)