pyroomacoustics.wall module

class pyroomacoustics.wall.Wall(corners, absorption=1.0, name=None)

Bases: object

This class represents a wall instance. A room instance is formed by these.

Attribute corners:
 (np.array dim 2x2 or 3xN, N>2) endpoints forming the wall
Attribute absorption:
 (float) attenuation reflection factor
Attribute name:(string) name given to the wall, which can be reused to reference it in the Room object
Attribute normal:
 (np.array dim 2 or 3) normal vector pointing outward the room
Attribute dim:(int) dimension of the wall (2 or 3, meaning 2D or 3D)
intersection(p1, p2)

Returns the intersection point between the wall and a line segment.

Parameters:
  • p1 – (np.array dim 2 or 3) first end point of the line segment
  • p2 – (np.array dim 2 or 3) second end point of the line segment
Returns:

(np.array dim 2 or 3 or None) intersection point between the wall and the line segment

intersects(p1, p2)

Tests if the given line segment intersects the wall.

Parameters:
  • p1 – (ndarray size 2 or 3) first endpoint of the line segment
  • p2 – (ndarray size 2 or 3) second endpoint of the line segment
Returns:

(tuple size 3) (bool) True if the line segment intersects the wall (bool) True if the intersection happens at a border of the wall (bool) True if the intersection happens at the extremity of the segment

side(p)

Computes on which side of the wall the point p is.

Parameters:p – (np.array dim 2 or 3) coordinates of the point
Returns:(int) integer representing on which side the point is -1 : opposite to the normal vector (going inside the room) 0 : on the wall 1 : in the direction of the normal vector (going outside of the room)