an efficient algorithm for the image model technique

29
Applied Acoustics 24 (1988) 87-115 An Efficient Algorithm for the Image Model Technique Heewon Lee* & Byung-Ho Lee Department of Mechanical Engineering, Korea Advanced Institute of Science and Technology, Chyung-ryang, PO Box 150, Seoul 131, Republic of Korea (Received 8 August 1987; revised version received 13 August 1987; accepted 21 October 1987) A BSTRA CT A new algorithm is proposed for the simulation of sound ray paths in an arbitrary polyhedral room. The proposed algorithm is developed on the basis of an image model algorithm and the coordinate transformation method is adapted for the calculation of the positions of image sources. In using this method, it is unnecessary to memorize the positions of image sources for the calculation of their descendant higher order image sources, and hence the required size of core memory can be reduced. To reduce computation time, the combinations of reflecting walls from which the valid ray paths cannot be obtained are discriminated against, and excluded in the computation of image sources. These modifications improve the computational efficiency in the image model technique, so that the ray paths from the multiple sound sources in an arbitrary polyhedral room can be simulated, even on a personal computer. Also, some basic room acoustical parameters, such as the sound pressure impulse responses and the decays of reverberant sound energy, are obtained from this simulation. 1 INTRODUCTION There are two techniques in simulating acoustical properties of a room on a digital computer. One is the ray tracing technique and the other is the image model technique. Both these techniques are based on geometrical room * Present address: Department of Machine Design, Seoul National Polytechnic University, 172 Gongneung-Dong, Dobong-Gu, Seoul 130-02, Republic of Korea. 87 Applied Acoustics 0003-682X/88/$03-50 © 1988 Elsevier Applied Science Publishers Ltd, England. Printed in Great Britain

Upload: heewon-lee

Post on 15-Jun-2016

227 views

Category:

Documents


4 download

TRANSCRIPT

Page 1: An efficient algorithm for the image model technique

Applied Acoustics 24 (1988) 87-115

An Efficient Algorithm for the Image Model Technique

H e e w o n Lee* & B y u n g - H o Lee

Department of Mechanical Engineering, Korea Advanced Institute of Science and Technology, Chyung-ryang,

PO Box 150, Seoul 131, Republic of Korea

(Received 8 August 1987; revised version received 13 August 1987; accepted 21 October 1987)

A BSTRA CT

A new algorithm is proposed for the simulation of sound ray paths in an arbitrary polyhedral room. The proposed algorithm is developed on the basis of an image model algorithm and the coordinate transformation method is adapted for the calculation of the positions of image sources. In using this method, it is unnecessary to memorize the positions of image sources for the calculation of their descendant higher order image sources, and hence the required size of core memory can be reduced. To reduce computation time, the combinations of reflecting walls from which the valid ray paths cannot be obtained are discriminated against, and excluded in the computation of image sources. These modifications improve the computational efficiency in the image model technique, so that the ray paths from the multiple sound sources in an arbitrary polyhedral room can be simulated, even on a personal computer. Also, some basic room acoustical parameters, such as the sound pressure impulse responses and the decays of reverberant sound energy, are obtained from this simulation.

1 I N T R O D U C T I O N

There are two techniques in simulating acoustical properties of a room on a digital computer. One is the ray tracing technique and the other is the image model technique. Both these techniques are based on geometrical room

* Present address: Department of Machine Design, Seoul National Polytechnic University, 172 Gongneung-Dong, Dobong-Gu, Seoul 130-02, Republic of Korea.

87 Applied Acoustics 0003-682X/88/$03-50 © 1988 Elsevier Applied Science Publishers Ltd, England. Printed in Great Britain

Page 2: An efficient algorithm for the image model technique

88 H. Lee, B.-H. Lee

acoustics and give an approximate solution for the sound propagation in an enclosure. However, each one has different characteristics in accordance with the differences in algorithms.

In the ray tracing technique, only a finite number o f sound rays are traced to find the ray paths from the source to the receiver. Thus, the results of simulation can be obtained within a reasonable computat ion time, even for a room with complex geometry. ~'2 But, since there is no definite rule for deciding the size of receiver and the number of initial rays in the ray tracing simulation, different results may be obtained for the same room, and some valid ray paths may not be included in the calculated results. Thus the pressure impulse responses in a room cannot be simulated effectively by the ray tracing technique. This is the major defect of the ray tracing technique. 1

In the image model technique, sound ray paths are calculated from all possible combinations of reflecting walls, so the uncertainty that may be involved in the ray tracing technique can be eliminated. However, compared with the ray tracing technique, it is very difficult to develop programs for the image model technique, especially for complex room geometry, and the computation time increases rapidly with increasing order of reflections in a simulation. This has limited the practical applications of the image model technique.

Allen and Berkley 3 proposed an efficient and simple algorithm for the image model technique but restricted the model to a rectangular enclosure. Barron 4 extended the image model to more complex geometry in order to study the effect of early reflections on subjective acoustical qualities. His interest was only in the early reflections and his model was restricted to the first two reflections. Baxa 5 presented the modified image method in the optimization of acoustic space and limited his model to the first five reflections due to the restrictions imposed by the computat ion time and the size of core memory. Recently, Borish 6 has presented a generalized algorithm eliminating the restriction imposed by the size of core memory, but the practical application is still limited by the computation time.

The restrictions of the above image model algorithms originate from the inefficient procedure for the calculation of image sources. In the above image model algorithms, the positions of image sources should be memorized until all their descendent higher order images are calculated, i.e. the higher order images are dependently obtained from the image sources of the previous order. Since the number of image sources increases in geometrical progression as the increase in the order of reflections, a large size of core memory is required to memorize the positions of the image sources, and the computation time is too long. Because all image sources do not always produce valid ray paths, the algorithms that compute all image sources are not efficient.

Page 3: An efficient algorithm for the image model technique

Algorithm for image model technique 89

In this paper, a new algorithm is proposed for the image model technique which eliminates both the restrictions in computation time and the size of core memory. For this algorithm, the coordinate transformation method is used for the calculation of the positions of image sources and their resultant ray paths. Using this method, it is possible to calculate the positions of each image source only if the histories of the successive reflections are known, and it is unnecessary to memorize the positions of the image source for the computation of their descendent images. Thus, restriction by the size of core memory can be eliminated.

To reduce computation time, the combinations of reflecting walls from which the valid ray paths cannot be obtained are discriminated against from all possible combinations of reflecting walls, and the computation is neglected for those combinations. 7 Thus the number of image sources to be computed can be greatly reduced and so the computation time is reduced.

2 DESCRIPTION OF THE ALGORITHM

In this section we will describe the algorithm for computing sound ray paths in an arbitrary polyhedral room. The basic principle in the image model technique is that a sound ray path involving reflections can be obtained from a straight line path connecting the receiver to a corresponding image source.

2.1 Calculation of image sources

When the image model is applied to a rectangular room, a regular distribution of image sources is obtained. As shown in Fig. 1, S 1, $2, Sa and $4 represent the first order images of the original source So, generated from the reflections from the corresponding reflecting walls. $12, $23, $34 and $41 are the second order images generated from the successive reflections from the corresponding combinations of reflecting walls.

In the same manner, image sources of higher order can be generated. Generally, kth order image source can be represented as Sm2...ik, where i l i2. . , ik represents the combination of mirror walls included in the kth order reflection. Since the distribution of image sources is regular for a rectangular room, the positions of image sources can be represented as follows: a

(+x~ + 21Lx, +Ys + 2mLy, +__zs + 2nLz) (1)

where (x~, Ys, zs) is the position vector of the real source (So), (Lx, L r, Lz) are the room dimensions, and (/, m, n) is the integer vector triplet.

Page 4: An efficient algorithm for the image model technique

90 H. Lee, B.-H. Lee

~3

s~

l.Y

X I! ¢

o "X ~ X ~'

• I i

I_x s, s,~

o , ,

Py.

0 t

Fig. 1. Image sources and image coordinate systems in a rectangular room. The accentuated box is the real room. $1, $2, $3 and S 4 are the first order images of the real source S 0, and S~ 2, $23, $34 and $4~ are the second order images. OXYZ is the original coordinate system. O'X' Y'Z' and O"X" Y"Z" are the samples of its image coordinate systems of first and

second orders respectively.

However, when the room has an arbitrary polyhedral shape, the positions of the image sources cannot be represented explicitly as in eqn (1).

In this study, the positions of the image sources are calculated by using the coordinate transformation. If the coordinate system ( O X Y Z ) fixed in the original room is reflected through the mirror plane 1, its image coordinate system (O'X' Y'Z') can be established on the image room, as shown in Fig. 1. Then the position of image source $1 is represented by the position vector ~1 in the original coordinate system (OXYZ) , and the same position is also represented by the vector S'1 in the image coordinate system (O'X' Y'Z'). If [T~] is a transformation matrix representing the coordinate transformation

Page 5: An efficient algorithm for the image model technique

Algorithm for image model technique 91

from the image coordinates to the original coordinates, the relation between the vector $1 and the vector SI is given by

$1 = S~[T~] (2)

Since the position vector of an image source in the corresponding image coordinate system is equal to that of the real source in the original coordinate system, i.e. g~ = 20, the position of the image source can be calculated easily if the transformation matrix I-T~] is known:

S 1 = ~o[T1] (3)

The positions of the other image sources $2, $3 and $4 can be calculated in the same manner, but different transformation matrices for the reflections are used.

Since the higher order reflection is produced from the combinations of the first order reflections, the transformation matrix can be obtained from the successive pre-multiplications of the first order transformation matrices for each mirror wall included in the corresponding higher order reflection:

[T,~,2...,k] = [ T j [ T , k _ ~]... [T,1 ] (4)

where [Ti~i2.../k] is the transformation matrix for the kth order reflection, ( i l i 2 . . . i k ) is the combination of reflecting walls included in the corresponding kth order reflection, and [T/~],..., [Tik ] are the transform- ation matrices for each first order reflection through each mirror wall.

Then the position of the kth order image source S~i2...ik in the original coordinate system can be obtained, as

Sili2...ik ~ --(k) Sili2.. . ik[Tili2.. . ik]

: ~o[Til i2. . . ik] (5)

where Sl ti2...~k is the position vector of the kth order image source S~i2...ik in the original coordinate system (OXYZ), ~k~2...i k is the position vector of the kth order image source S~2...i k in the corresponding kth order image coordinate system (otk)xa)pk)za)), gO is the position vector of the real source So in the original coordinate system (OXYZ), and [Ti~2...~k] is the transformation matrix for the kth order reflection.

Thus, we can obtain the positions of any image sources in the same manner as explained above.

2.2 Transformation matrix

Now we will describe the transformation matrix introduced in the previous section. Since the coordinate transformation between the original coordinates and its image coordinates involves rotational and translational

Page 6: An efficient algorithm for the image model technique

92 H. Lee, B.-H. Lee

transformations together, the concept of 'homogeneous coordinates 's is introduced, which is well known terminology in computer graphics.

In homogeneous coordinates, a point in a three-dimensional space is represented by (x, y, z, 1) instead of (x, y, z), and the transformation is represented by a 4 x 4 matrix.

In this study, we need a transformation matrix representing the coordinate transformation between the original coordinate system and its image coordinate system reflected through an arbitrary mirror plane. Figure 2 shows the geometrical relationship between the two coordinate systems. In the figure, O X Y Z is an original coordinate system and O'X' Y'Z' is its image coordinate system and the hatched triangle is the corresponding mirror plane. Let il be a normal vector to the mirror plane from the coordinate origin O, and let OA be the projection of the vector il on the X- Y plane. 0 is an angle between OA and the X-axis, and $ is an angle of elevation of the vector il from the X-Y plane.

By using these geometrical parameters, we can obtain the image

z

Fig. 2. Geometrical relationship between the original coordinate system (OXYZ) and its image coordinate system (O'X' Y'Z'). The hatched triangle is the corresponding mirror plane.

Page 7: An efficient algorithm for the image model technique

Algorithm for image model technique 93

coordinate system (O'X'Y'Z') through the successive six elementary transformations of the original coordinate system (OXYZ) as follows:

(1) Rotation about the Z-axis through an angle 0. (2) Rotation about the Y-axis through an angle -~b. (3) Translation to the positive X direction through a distance 2d. (4) Rotation about the Y-axis through an angle -~b. (5) Rotation about the Z-axis through an angle 0. (6) Reflection through the Y-Z plane.

Note that an angle with a counterclockwise rotation is regarded as positive. Since the transformation matrices are known for each of the six

elementary transformations and each matrix represents the coordinate transformation from the transformed coordinate system to the correspond- ing previous coordinate system, the resultant reflection transformation matrix can be obtained from the successive pre-multiplications of each elementary transformation matrix, as follows:

IT] = [_iooil [ c!so sino o il 1 0 - n O c o s 0 0

01 0 1

0 0 0 0

cos ~b

0

- s i n ~b

0

ii001]i10 oS 0 sin l 0 01 l 0 cos

2d0 0 0 0

l cos 0

- s i n 0

0 .

0

0 sin ]m 0 0 cos

0 0 (6)

s in0 0 ! ]

cos 0 0

0 1

0 0

reduced to

, [ s i n 2 0 - c o s 2 0 c o s 2 ~ b - c o s 0 s i n 0 ( c o s 2 q ~ + l ) - c o s 0 s i n 2 ~ b !1 = / - c o s 0sin 0(cos2~ + 1) -sin20cos2~b + cos20 -s in 0sin 2~b

IT] / - cos 0 sin 2~b - sin 0 sin 24 cos 2~b k 2dcos t# cos 0 2dcos ~b sin 0 2dsin q9

(7)

Since the original and its image coordinate system are symmetric about the mirror plane, the transformation matrix has the property [T] - 1 = [T]. Thus the matrix inversion is not needed in any coordinate transformations for this study. This gives a great advantage in the computation of image sources.

The resultant transformation matrix representing the reflection transform- ation from the image coordinate system to the original coordinate system, is

Page 8: An efficient algorithm for the image model technique

94 H. Lee, B.-H. Lee

Let us calculate a t ransformat ion matrix as an example. For the case of plane 1 in Fig. 1, the angle 0 = tp = 0 and d = Lx, so that the t ransformat ion matrix [T1] is

°°il 1 0 (8) [T1] = 0 1

2 L ~ 0 0

Applying eqn (5), the posit ion vector $1 is represented by

g, ='g', [T1] = go[T1 ] (9)

where S~ is the posit ion vector of the image source S~ in the original coordinate system (OXYZ), g] is the posit ion vector of the image source S~ in the image coordinate system (O'X' Y'Z'), and S o is the position vector of the real source So in the original coordinate system (OXYZ). If the vector So is given by (x s, Ys, zs, 1) the resultant value of the posit ion vector S~ is obtained as ;

0011 I 0 (10) $1 = (x~, Ys, zs, 1) 0 1

2Lx 0 0

= ( 2 L x - x s, ys, zs, 1)

This is the same result ag can be obtained from eqn (1), and the method described above can be used for a room with an arbitrary polyhedral shape.

2.3 Calculation of the ray paths from the image sources

Now that we have a basic tool for finding the positions of any image sources, we will discuss the detailed procedure for obtaining the ray paths in this section.

Once an image source is established in an image space, the corresponding ray path can be obtained by connecting the image source to the receiver and calculating the intersection points of the connecting line with corresponding mirror planes.

Figure 3 shows an example of the procedure for calculating the ray path. In this figure, $143 is a third order image source generated from the successive reflections through mirror walls 1, 4 and 3. The quadrangles B, C and D are the image rooms of first, second and third order, respectively, and

Page 9: An efficient algorithm for the image model technique

Algorithm for image model technique 95

/ \ . . 7 / ' / ~ x ' ~ , . T - - 3 R o I \ . . _ I / x Mo"

o 1.3

Fig. 3. The computational procedure for obtaining ray paths. The ray path Ro-P1-P2-P 3- S O can be obtained from the straight line path connecting the image source Ss43 to the

receiver R o and its intersecting points P~, P'2, P~ with each mirror plane.

O'X'Y'Z', O"X"Y"Z", O"X'"Y'"Z'" are the image coordinate systems established on the corresponding image rooms. P1, P'2, Pg are the intersection points between the planes of reflection and the line connecting the image source $143 with the receiver R o. If these intersection points (PI, P~, P~) are mirrored back to the original room, we can construct the tay path Ro-P1-Pz-P3-S o. As described in the previous section, the position of a real point in the original coordinate system is the same as the position of its image point in the corresponding image coordinate system. Thus we can find the positions of P2 and P3 by calculating the positions of P~ and P'~ in the corresponding image coordinate systems O'X'Y'Z' and O"X"Y"Z", respectively.

We can arrange the detailed procedure for obtaining the ray path Ro-P l- P2-P3-So in Fig. 3 as follows:

Step 1. Find the transformation matrices for each reflecting wall included in the resultant third order reflection by using eqn (7). Then the third order transformation matrix is obtained by using eqn (4):

[T143] = [T3][T4][T1] (11)

Step 2. Select the coordinate system OXYZ in the original room as a reference frame and find the position vector $143 by using eqn (5):

~143 = ~'1'4.3[T143] = ~0[_T143. ] (12)

Since the position of the receiver R o is given, we can obtain the equation for the connecting line $ 1 4 3 - R o in the original coordinate system (OXYZ).

Page 10: An efficient algorithm for the image model technique

96 H. Lee, B.-H. Lee

Hence the intersection point PI is obtained by simultaneously solving the plane equation for plane 1 and the line equation for the connecting line.

Step 3. Transfer the reference frame to O'X' Y'Z' and calculate the position vector S~43 and 11~ by using the coordinate transformation:

~'143 = ~ 1 4 3 [ - T 1 l - 1

= ~ 1 4 3 [ T 1 ] (13)

R~ = Ro[T1] - i

= Ro[TI]

whcrc ~'~43 is the position vector of thc image source $143 in thc first order image coordinatc systcm (O'X' Y'Z'), R~ is the position vector of the receiver R o in thc coordinate system O'X'Y'Z', ~143 is the position vector ofthc imagc sourcc Sx4a in the coordinatc systcm OXYZ, R o is thc position vcctor of thc rcccivcr R o in thc coordinate systcm OXYZ, and [T~ ] is thc transformation matrix rcprcscnting thc coordinate transform- ation from O'X' Y'Z' to OXYZ. Then the position ofthc intersection point P'2 can bc obtained in the corresponding image coordinatc system (O'X' Y'Z'), which is the same position of the second rcflccting point P2 in thc original coordinate systcm (OXYZ).

Step 4. Transfer the rcfcrcncc frame to O"X" Y"Z" and calculate thc position vectors S~43 and R~ in thc same manner as in Stcp 3. Thcn the position of thc intcrsccting point P~ can bc obtaincd in O"X" Y"Z", which is thc same position of thc third reflecting point P3 in thc original coordinate systcm (OXYZ).

Step 5. The resultant ray path is obtained a s P o - P I - P 2 - P 3 - S o through the above computational procedure from Step 1 to Step 4.

2.4 A computational example with numerical data

To aid the reader's understanding, an example of the above computational procedure with specified numerical data for the room model in Fig. 4 is presented in this section.

Let us calculate the ray path Ro-PI-P2-P3-So in Fig. 4 through the computational procedure described in section 2.3 with the numerical data given in Table 1.

Step 1 We can obtain the plane equations and the transformation matrices for each mirror wall from the given geometrical data for the room model. Generally, the equation for a flat plane in three-dimensional space is given by

Ax + By + Cz = 1 (14)

Page 11: An efficient algorithm for the image model technique

Algorithm for image model technique 97

Y

Z

3(

/

P1

SO 25

2

- - 1

Fig. 4. The configuration of the room model.

~ X

If the coordinates for any three vertices of the plane are known, we can calculate the constants A, B, C in eqn (14) and hence the plane equation is obtained. Also, as described in section 2.2, the reflection transformation matrices for each wall are calculated by eqn (7) with the geometrical parameters for the plane.

For the first reflecting wall (plane 1 in Fig. 4), the plane equation is obtained as

x + 8y -- 240 (15)

And from the geometrical parameters for plane 1 (refer to section 2.2) (0 -- 82-87 °, ~ -- 0 ° and d -- 29-768), we can obtain the transformation matrix for plane 1 by using the eqn (7):

0"969 -0-246 0 i ] [TI] = -0.246 -0.969 0 (16)

0 0 1

7.385 59.076 0

In the same manner, the plane equation for plane 4 is given by

x = 40 (17)

Page 12: An efficient algorithm for the image model technique

98 H. Lee, B.-H. Lee

T A B L E l Geometrical Data for the Room Model in Fig. 4

Reflecting wall data

Wall no. Vertices

l 5 6 7 8 2 1 4 8 7 3 l 2 3 4 4 3 2 6 5 5 3 5 8 4 6 1 7 6 2

Vertex data

V e r t e x no . X ) ' Z

1 0 0 0 2 0 40 0 3 20 40 0 4 20 0 0 5 20 40 25 6 0 40 25 7 0 0 30 8 20 0 30

Source data

S o ! 0 25 20

Receiver data

R o l 0 20 5

a n d f r o m the g e o m e t r i c a l p a r a m e t e r s fo r p l ane 4 (0 = 0 °, ~b = 0 °, d = 40), the t r a n s f o r m a t i o n m a t r i x is o b t a i n e d as [100!]

I T 4 ] = 0 1 0 0 0 1

80 0 0

Also , fo r p l ane 3, the p lane e q u a t i o n is

(18)

y = 0 (19)

Page 13: An efficient algorithm for the image model technique

Algorithm for image model technique 99

and from the geometrical parameters for plane 3 (0 = - 90 °, ~b = 0 °, d = 0), the transformation matrix is obtained as

[T3]= 1 0 0 0

0 - 1 0

0 1

0 0

(20)

Hence the third order transformation matrix is obtained for the 1-4-3 combination of the reflecting walls, which represents the coordinate transformation from the third order image coordinate system O'"X'" Y'"Z'" to the original coordinate system O X Y Z (refer to Fig. 3 in section 2.3):

IT 143] = IT3] IT,] IT 1 ] =

Step 2

"-0"969 0"246 0 0]

0-246 0"969 0 !1 (21) 0 0 1

84-905 39"396 0

The position vector $143 is obtained by using eqn (5):

~14-3 --.r = 8 1 4 3 [ T 1 4 3 ]

---- 8 o [ T 1 4 3 ]

= (25, 20, 10, 1)

--0.969 0.246 0 0]

0.246 0-969 0 ! ] (22) 0 0 1

84.905 39.396 0

= (65"6, 64"926, 10, 1)

Note that homogeneous coordinates (x, y, z, 1) are used for the coordinate transformation instead of the conventional coordinates (x, y, z).

Since the position of the receiver Ro is given by (20,5,10), the equation for the straight line connecting the image s o u r c e $14 .3 to the receiver R o is represented by

S143Ro = ( 8 1 4 3 - - R0)t + Ro = (45"6, 59"926, 0)t + (20, 5, 10) (23)

where t is an arbitrary variable with a range - ~ < t < ~ . Then we can obtain the first intersecting point P1 by solving the plane equation for plane 1 (eqn (15)) and the line equation in eqn (23) simultaneously:

x + 8y = 240

x = 45"6t + 20

y = 59"926t + 5

z = 10

Page 14: An efficient algorithm for the image model technique

100 H. Lee, B.-H. Lee

Therefore the coordinates of point P1 are:

P1 = (35-641, 25.567, 10) (24)

Step 3 Transfer the reference frame to the O'X' Y'Z' and calculate the position vectors g'~43 and R~ in that reference frame as follows:

~r143 = ~ 1 4 3 [ T 1 ] - 1

= g 1 4 3 [ T l ] (25)

= (54"98, - 19"975, 10, 1)

and

R; =R0[T1]-I = Ro[T1] (26)

=(25"535, 49"311, 10, 1)

Then the line equation for the same straight line Sx43Ro in the image coordinate system O'X' Y'Z' is represented by

S 1 4 3 R o = (S'143 - - a ; ) t --I- R ;

=(29-445, -69"286, 0)t + (25"535, 29"311, 10) (27)

Hence the second intersection point P~ is obtained from eqns (27) and (17):

• P~ =(40, 15-292, 10) (28)

Since the coordinates for the P~ are calculated in the corresponding image coordinate system O'X'Y'Z', they are the same coordinates for the real reflecting point P2 in the original coordinate system OXYZ.

Step 4 Transfer the reference flame to O"X" Y"Z" and calculate the position vectors S'~43 and R; in that reference frame in the same manner as in Step 3:

g~43 = S '143[-T4] - 1

= 8'143 I T , , ] (29)

and

= (25'02, - 19"975, 10, 1)

R; =R;[T4] 1

= a ; [Ts ]

=(54-465, 49-311, 10, 1)

(30)

Page 15: An efficient algorithm for the image model technique

Algorithm for image model technique 101

Then the line equation for the straight line Sx43Ro in O"X" Y"Z" is

S143R0 = (~';43 -- R~)t + R~ =(-29-445, -69"286, 0)t + (54"465, 49"311, 10) (31)

Hence the third intersection point P'~ is obtained from eqns (31) and (19):

P~ = (33.5, 0, 10) (32)

Step 5 We can obtain the resultant ray path Ro-PI-P2-P3-So from the results in eqns (24), (28) and (32):

x y z

P0 20 5 10 P1 35"641 25"567 10 P2 40 15"292 10 P3 33"5 0 10 So 25 20 10

2.5 Validity of the calculated ray path

Equations (4), (5) and (7) are not restricted to this specific example, and we can calculate the ray paths in any room in the same procedure as in the above example. However, when the computation is performed for a room with an arbitrary shape, some invalid ray paths may be included in the calculated results. Hence, a check of the ray validity should be added to the above computational procedure.

There can be two categories of invalid ray paths. In Fig. 5 the first kind of invalid ray path is shown. Since a reflecting wall is regarded as an infinite plane during the computation, reflecting points located in the outside region of the real reflecting boundary can be obtained from the calculation of ray paths. Because it is physically impossible that a reflecting point can be located in the outside region of the reflecting wall boundary, the ray paths containing such reflecting points should be discarded. For example, the intersecting point PI in Fig. 5 is outside the boundary of the first reflecting wall AB, so the ray path from the image source St4 is discarded.

There are many ways of testing whether the intersecting point is inside the boundary of the reflecting wall. One method used for this study is to form vectors from the point of intersection to each of the vertices on the boundary of the mirror plane. 6 The cross-products of successive pairs of these vectors

Page 16: An efficient algorithm for the image model technique

102 H. Lee, B.-H. Lee

O' X '

2ND

O

1ST A ~ y , , MIRROR Y

Yd Ro / / /

o x

Fig. 5. An example of an invalid ray path. The ray path from the image source $14 is invalid because the first intersecting point P~ is outside the boundary of the first mirror plane AB.

are always the vectors that are orthogonal to the reflecting wall. If each of these normal vectors points in the same direction, then the point of intersection is inside the boundary of the reflecting wall. Otherwise it is outside, and such a ray path is invalid.

The second case of invalid ray paths is an obstructed ray path. When a room has obstructive walls, as shown in Fig. 6, the ray path R o - P 1 - S o will be an invalid path because the ray segment R o - P 1 is obstructed by the extended surface, although the reflecting point P1 is inside the boundary of the reflecting wall. Because obstructive surfaces are so common in practical rooms, it is important that the image model must be able to deal with them. Checking for the obstruction is performed for each segment of the ray path.

$1

o

# 1ST MIRROR

Fig. 6. An example of an obstructed ray path. The ray path from the image source S 1 is invalid because the ray segment Ro-P ~ is obstructed by the extruded surface.

Page 17: An efficient algorithm for the image model technique

Algorithm for image model technique 103

For example, the ray segment Sx-P ~ in Fig. 6 is checked if it intersects with the obstructive planes, and then the next segment Ro-P~ is checked. When the intersection occurs within the boundary of an obstructive plane and also within the boundary of the ray segment, the ray segment is judged to be obstructed and so the whole ray path is invalid.

Since the two test procedures for checking the ray validity add a considerable burden to the computational procedure of valid ray paths, the computation time taken is too long, even though all the valid ray paths can be obtained. In the following section we will describe a method to reduce the computation time for this algorithm.

2.6 Reduction of the computation time

When applying our algorithm to any practical room, it is important to have a measure of how the geometrical complexity of the room influences the amount of computation time required. The amount of computation time will greatly depend on the number of surfaces bounding the room and on the order of reflections to be considered. When the room is constructed with N reflecting walls, N image sources should be computed for the first order reflections, and N ( N - 1) combinations of reflecting walls are used for the calculation of the second order images. Therefore the total number of the combinations of reflecting walls that should be computed for in considering the maximum kth order reflection is the summation of the number of the combinations in each order, i.e. N + N ( N - 1) + N ( N - 1) 2 +- . - + N(N - 1) k- 1. We can estimate that the number of combinations will increase in geometrical progression with increasing order of reflection. However, only a small portion of these combinations can contribute to the construction of the valid ray paths and the ray paths obtained from the remaining combinations are discarded by the check of ray validity. If these invalid combinations of reflecting walls can be excluded in the computation of ray paths, the computation time can be greatly reduced.

For this purpose, the combinations of reflecting walls for the invalid ray paths are discriminated against as 'non-feasible combinations' before the computation of image sources via the following two test criteria, and those combinations are neglected in further computations.

First, the non-feasible combinations of reflecting walls may be found in walls which are mutually invisible. As shown in Fig. 7, the inner surface of wall 1 is not visible at a point on walls 2, 3 or 4. Thus the sound ray reflected on wall 1 can never meet the successive reflection on walls 2, 3 or 4. In other words, the combinations of reflecting walls 1-2, 1-3 and 1 4 are non-feasible ones. These wall combinations can be discriminated against by checking whether the inner surface of the wall is visible at the other wall. This is the

Page 18: An efficient algorithm for the image model technique

104 H. Lee, B.-H. Lee

®

Fig. 7. The non-feasible combinations of reflecting walls. The combinations of reflecting wails 1-2, 1-3 and 1-4 are the non-feasible ones because the ray path reflected on plane 1 can

never meet with the successive reflections on plane 2 or on planes 3 or 4.

first criterion for discriminating against non-feasible combinations of reflecting walls.

Figure 8 represents the second criterion for discriminating against the non-feasible combinations of reflecting walls. Let $14 be a second order image source reflected through wall 1 and wall 4', successively. $14 may be reflected through walls 1", 2" or 3" to generate the third order image sources $14~, $142 or $143, respectively. Because the line connecting the image source to the receiver R o should intersect with the reflecting walls inside the boundary of the corresponding wall, ray paths from S~41 and S~42 will be invalid ones, i.e. the combinations of reflecting walls 1-4'-1" and 1-4'-2" are the non-feasible combinations. These non-feasible combinations can be discriminated against by checking the visibility of the candidates for the third order mirror wall, at the position of receiver R o, through the window of the second mirror wall. In this figure, the candidates for the third order mirror wall, wall 1" and wall 2", are located outside the visible region, and thus the combinations 1-4'-1" and 1-4-2" are discriminated against as non- feasible ones.

However, the criterion described above is not a sufficient condition for discrimination around non-feasible combinations. In other words, the above criterion cannot discriminate against all the non-feasible combinations of reflecting walls because the visible region of the third order reflecting wall (wall 3" in Fig. 8) is not a whole boundary of that plane but a portion. Therefore, even the ray paths calculated from the feasible combinations should be checked for validity through the test procedure described in the previous section.

Although the number of combinations of reflecting walls increases rapidly with increasing order of reflection, many of those combinations can be discriminated against as non-feasible ones through the above two test

Page 19: An efficient algorithm for the image model technique

Algorithm for image model technique 105

-VISIBLE REGION

~ . . / /

x /

~ x , , /

Fig. 8. The non-feasible combinations of reflecting walls. The combinations of reflecting walls 1-4'-1" and 1-4'-2" are the non-feasible ones because the third order reflecting walls, 1" or 2", are located outside the visible region of the receiver R through the window of second

mirror wall 4'. l a

criteria and neglected in the computation. Thus the computat ion time may be greatly reduced.

2.7 Development of the program

Since the developed algorithm is not limited by size of core memory and also the computa t ion time can be reduced by discarding non-feasible combinations of reflecting walls, implementation of the algorithm is performed on a personal computer system (IBM-PC/XT) using the F O R T R A N language. The developed program can be divided into four parts as shown in Fig. 9. First, the data for room configurations and for the given conditions are input by the use of program DATAIN, and the plane equations of the reflecting walls are calculated by PLNEQ. On the basis of the data prepared, sound ray paths are calculated by the use of program IMAGE and the resultant valid ray paths are stored on a mass storage. In the IMAGE routine, NEGLEC is used for discriminating against non- feasible combinations of reflecting walls, TRANS calculates the transform- ation matrix and the calculated ray paths are checked by RAYCHECK, whether or not they are valid ones. From the calculated ray path data,

Page 20: An efficient algorithm for the image model technique

106 H. Lee, B.-H. Lee

-{ I~ATAIN~

f PLNEQ--] NEGLEC j

I MAIN ] I

TRANS I

RAYPATH I ]

[ RAYCHECK]

Fig. 9.

IMPULSE__]

Schematic diagram of the program structure.

impulse response and reverberant energy decay curves are obtained by the use of program IMPULSE. Finally, the resultant impulse responses and other outputs are plotted on a digital X - Y plotter by using the program PLOT.

3 EXAMPLES OF SIMULATION AND DISCUSSION

Now we will present some examples of simulation using the proposed algorithm. Since the purpose of this paper is to introduce the idea of the developed algorithm, the examples of simulation will involve the calculation of sound ray paths and the basic acoustical parameters obtained from the ray paths, such as the sound pressure impulse responses and the decays of reverberant sound energy in a room.

First, a room model shown in Fig. 10, which is constructed with 17 walls and 28 vertices, presented in Table 2, is simulated in order to find the sound ray paths from the source So to the receiver R. The simulation is performed by three different methods: (1) by using the proposed algorithm, but the test criteria discriminating against non-feasible combinations of reflecting walls are not included; (2) by using the proposed algorithm, but only the first criterion is included; (3) by using the proposed algorithm, including both the first and second criteria. The computation times taken for each simulation are compared in Fig. 11. As shown in Fig. 11, the computation time is

Page 21: An efficient algorithm for the image model technique

Algorithm for image model technique 107

Z

1 ' 20 18 1 ~ _ . ~

7 \ \ " e I ~ 23 10 2 6.6

26 27

31.8 J Fig, 10, The room model and the locations of sound sources and receiver for the simulation

examples.

rapidly increased with increasing order of reflection. But the computation time can be greatly reduced by introducing the test criteria discriminating against non-feasible combinations of reflecting walls.

Figure 12 shows an example of the resultant ray paths calculated from the image model; in this figure all the ray paths from the source S o to the receiver R through seven reflections (total of 130 ray paths) are depicted. Table 3 presents the number of valid ray paths in each order calculated from the simulation, in comparison with the number of all possible combinations of

io4

,-, lo3

° S¢ ,~ 10 / ,.1 / / / -

0

u 1 • / , f

~ - j , -

1o -] / 1 I 2 3 4 5 6

CONPUTED ORDERS OF REFLECTIONS

r r

/

7 8

Fig. 11. Comparison of the computation times. ( 1 - - - - 1 ) Using the proposed algorithm without any test criteria reducing computation time; ( 2 - - - - - 2 ) using the proposed algorithm with the test criterion 1; ( 3 - - 3 ) using the proposed algorithm with both two test criteria.

Page 22: An efficient algorithm for the image model technique

108 H. Lee, B.-H. Lee

T A B L E 2 Geometrical Data for the R o o m Model in Fig. 10

Reflecting wall data

Wal l no. Vertices

1 10 9 8 3 2 1 2 1 2 13 12 3 2 3 14 13 4 3 4 15 14 5 4 5 16 15 6 5 6 17 16 7 6 7 18 17 8 7 8 19 18 9 8 9 20 19

10 9 10 11 20 11 1 12 11 10 12 11 12 13 14 19 20 13 21 22 26 25 14 21 24 23 22 15 25 26 27 28 16 14 15 16 17 18 19 17 8 7 6 5 4 3

Vertex data

No. x y z

1 0 -9"85 0 2 4.7 -11"3 0 3 5"7 -9"75 0 4 9-8 - 12"15 0 5 31-8 - 12"15 0 6 31.8 12'15 0 7 9.8 12"15 0 8 5"7 9"75 0 9 4.7 11"3 0

10 0 9-85 0 11 0 9"85 6.6 12 0 -9"85 6"6 13 4"7 - 11"3 6-6 t4 5"7 -9"75 6"6 15 9.8 - 1 2 ' 1 5 6'6 16 31"8 - 12"15 6"6 17 31-8 12"15 6"6 18 9"8 12"15 6"6 19 5.7 9-75 6"6 20 4.7 11"3 6"6 21 22.2 12"15 3.1

Page 23: An efficient algorithm for the image model technique

Algorithm for image model technique 109

TABLE 2--contd

Vertex data

No. x y z

22 22"2 -- 12"!5 3"1 23 31"8 --12"15 4"6 24 31"8 12'15 4'6 25 22"2 12" 15 2'6 26 22'2 -- 12"15 2"6 27 31'8 - 12'15 2'0 28 31"8 12"15 2"0

Source locations

S O 1.6 0 2' 1 St 7-0 - 10'0 3-0 S 2 20-0 - 11"5 3"0 S 3 20.0 11"5 3-0 S,~ 7-0 10-0 3"0

Receiver location

R 28.8 8'25 5-0

Absorption coefficients

(1) 0-56 (2) 0-086 (3) 0-086 (4) 0-086 (5) 0-086 (6) 0-08 (7) 0-086 (8) 0-086 (9) 0-086 (10) 0-086

( l l ) 0.026 (12) 0.214 (13) 0.02 (14) 0.56 (15) 0.29 (16) 0-214 (17) 0-56

reflecting walls. As presented in Table 3, the number of possible combinations of reflecting walls increases in geometrical progression with increasing order of reflection, but the number of valid ray paths is only a small portion of them. Hence, the method described in the previous section can reduce the computation time, even though the method itself adds a burden to the whole computational procedure.

Figure 13 shows an example of the echogram and the reverberant sound energy decay curve obtained from the calculated ray paths from the source So to receiver R. The reverberant energy decay curve is obtained by using a modification of the integrated tone burst method: 9'1°

Ed(t) = foo pZ(z) dr 3,

Page 24: An efficient algorithm for the image model technique

110 H. Lee, B.-H. Lee

Fig. 12. Examples of the calculated sound ray paths. A total of 130 ray paths from the source S o to the receiver R (refer to Fig. 10) through seven reflections are depicted.

where E~(t) is the average sound energy decay and p(~) is the calculated sound pressure impulse response. In the figure, the reverberant sound energy decay curve obtained from Eyring's formula is depicted by a dash-dotted line for comparison.

Figure 14(a) shows an example of the impulse response for the same room model but simultaneously excited by four sources within it. The locations of the four sources $1, S 2, S 3 and $4 are shown in Fig. 10, and Figs 14(b)-(e) show the impulse responses from each source individually. From these figures, we can obtain information about how each source contributes to the total impulse response at the receiver. Since the use of the coordinate transformation makes it possible to simulate the sound ray paths from these four sources simultaneously, the computation time taken for this simulation is 2165 min on the IBM-PC, which is about 1'8 times (rather than 4 times) the computation time taken for the single source case.

T A B L E 3 T h e N u m b e r s o f V a l i d R a y P a t h s O b t a i n e d f f o m t h e S i m u l a t i o n

Order of The number ~l The number O[ all reflections valid ray paths possible combinations

calculated o1 r~[teeting walls

Direct 1 1 1 7 17 2 20 272 3 37 4 352 4 56 69 632 5 73 1114112 6 95 17825792 7 130 285212672

Total 419 304 226850

Page 25: An efficient algorithm for the image model technique

Algorithm for image model technique 111

X lOdB

i .00

.00

: - i .oo

-2.oo

=, -3 .00 Z

~ - 4 . 0 0 ,,C

=-5.oo

- 6 . 0 0 .00

I ' 1"I~11 I II I II I II I II

.--,L.~._ IJ /

I]llllJllll i III I1[11111 Illlll1111111 Illl IJIII IIIIII

~ II IJIJ ~ IIIIIII I

IIII , 1 )

IIIIIIII J..00 2 .00 3 .00 4 .00

T I M E ( XlOOMSEC )

Fig. 13. The calculated echogram and reverberant energy decay curve for the room model, f rom the source S O at the receiver R (refer to Fig. 10). - - , The echogram; . . . . . , the reverberant energy decay curve; . . . . , the reverberant energy decay curve obta ined from

Eyring's formula. -1

X lO

1 . 2 0

~ ~..00

z .80

~ .60 =d

> .40 i.,.I <I

,~ .20

. 00

,J II)l, ilit,, .00 .80 .60 2 .40 3 .20 4 .00

T I M E ( XIOOMSEC )

Fig. 14(a). The calculated pressure impulse response of the room model (refer to Fig. 10). Simultaneously excited by the four sound sources $1, $2, $3 and $4; Computed with

maximum seventh order reflections.

Page 26: An efficient algorithm for the image model technique

112 H. Lee, B.-H. Lee

XlO 2

4.50

o 3 . 7 5 ! - i i - I

~ 3 . 0 0

DII

2 . 2 5

1 .50

.75

.00 .00 .80 1 .60 2 . 4 0 3 . 2 0 4 .00

TIME ( XIO0 M$1:C )

The calculated pressure impulse response of the room model from the sound source S~; Computed with maximum seventh order reflections.

Fig. 14(b).

4 .00

~ 3 .20

~ 2.40

~ 1.60

.80

x i 6 2 4 . 8 0

.00 • 00 . 8 0

Fig. 14(c).

1.60

T I M E

2.40 3 .20

( XlOO MSEC )

4 . 0 0

The calculated pressure impulse response of the room model from the sound source $2; Computed with maximum seventh order reflections.

Page 27: An efficient algorithm for the image model technique

X 16 !

'1 2 0

m l O0

z 8O ,<

~ 6 0 ul

~ 40

,< ,.1

"- 20

O0 .00

Fig. 14(d).

X 10 .2 9 O0

i, J l li,~ tliil, ~,,~ k~ ,,, , , , , • 80 1 . 6 0 2 . 4 0 3 . 2 0 4 . O0

TIME ( X 1OO M S E C )

The calculated pressure impulse response of the room model from the sound source $3; Computed with maximum seventh order reflections.

~ 7 50 t-i i-i

III,i ! ' -6 O0 ,<

~ 4 50

eL

~ 3 O0

,<

~ 5o

.00 .00

/,I I1111 ,,, ] IIIII,,, im|,,il il,,lli|,,Idil,,,,,

Fig. 14(e).

Algorithm for image model technique 113

• 8 0 J . . 6 0 2 . 4 0 3 . 2 0 4 . 0 0

T I M E ( XlOOMSEC )

The calculated pressure impulse response of the room model from the sound source $4; Computed with maximum seventh order reflections•

Page 28: An efficient algorithm for the image model technique

114 H. Lee, B.-H. Lee

4 C O N C L U D I N G REMARKS

A new algorithm based on the image model technique is proposed for the simulation of sound ray paths in an arbitrary polyhedral room. The proposed algorithm improves the efficiency of the image model technique by compensating for the defects of existing algorithms. The required size of core memory is reduced by introducing the coordinate transformation method, and the computation time is reduced by neglecting the computations for the non-feasible combinations of reflecting walls. The proposed algorithm is implemented on a personal computer and some examples of computation are performed for obtaining sound ray paths and basic room acoustical parameters, such as the sound pressure impulse responses and the decays of reverberant sound energy.

The authors expect that the proposed algorithm will activate the practical applications of the image model technique. For example, an integrated computer-aided design system can be developed for room acoustical planning and design of sound reinforcement systems. Recently, systems have been developed and used for various applications, but they are based on the ray tracing algorithm. Since the image model gives a more accurate result than ray tracing, especially for the simulation of impulse responses, it is desirable that those systems are developed on the basis of an image model even though the computation time is still longer compared with the ray tracing technique. However, some problems still remain in the practical applications of the developed algorithm. There still remains the question of how the image model can deal with the wave phenomena violating the assumptions of geometrical room acoustics. Therefore future work will include methods to deal with the directional characteristics of sources and the diffusion or diffraction effects of reflecting walls.

REFERENCES

1. A. Krokstad, S. Strom and S. Sorsdal, Fifteen years experience with computerized ray tracing, Appl. Acoustics, 16 (1983), pp. 29 I-312.

2. A. Kulowski, Algorithmic representation of the ray tracing technique, Appl. Acoustics, 18 (1985), pp. 449 69.

3. J. B. Allen and D. A. Berkley, Image method for efficiently simulating small- room acoustics, J. Acoust. Soc. Am., 65 (1979), pp. 943-50.

4. M. F. E. Barron, The effects of early reflections on subjective acoustical quality in concert halls, Ph.D. thesis, University of Southampton, January 1974.

5. D. E: Baxa, A strategy for the optimum design of acoustic space, Ph.D. thesis, University of Wisconsin-Madison, 1976.

6. J. Borish, Extension of the image model to arbitrary polyhedra, J. Acoust. Soc. Am., 75 (1984), pp. 1827-36.

Page 29: An efficient algorithm for the image model technique

Algorithm for image model technique 115

7. A. Taguchi, T. Yosizawa, K. Sato and M. Serikawa, An efficient algorithm for tracing reflected rays in acoustic field simulation by geometrical method, J. Acoust. Soc. Japan, 41 (1985), pp. 542-5.

8. D. F. Rogers and J. A. Adams, Mathematical elements for computer graphics, McGraw-Hill, New York, 1976. Chapter 2, pp. 3644.

9. M. R. Schroder, A new method of measuring reverberation time, J. Acoust. Soc. Am., 37 (1965), pp. 409-12.

10. A. Kulowski, Relationship between impulse response and other types of room acoustical response, Appl. Acoustics, 15 (1982), pp. 3-10.