Graphics Reference
In-Depth Information
3 The generation algorithms for the seats
The north and the south sides of the virtual gymnasium are rectangle areas, and the
other two sides of the virtual gymnasium are semi-circular areas. The generation algo-
rithms for the seats in these two kinds of areas should be designed in different ways.
(1) The generation algorithms for the seats in the rectangle areas
To be brief, let's take the generation algorithms for the seats in the southern sub-
areas as an example. As for the position in the southern sub-area with the coordinate
(X n0 ,Y n0 ), the center coordinate of the seat will be P(X,Y,Z), and this transformation
can be performed through the following formulae in group 1:
X=X n0 +L/2+i*L
Y= Y n0 +m*W
Z=m*H.
( 1 )
Where n is the number of the southern sub-area (0<n<9) and
—m is the number of the row (0<m<21)
—i is the number of the column (0<i<9)
—L is the length of the stand (meter)
—W is the width of the stand (meter)
—H is the vertical range between the adjacent seats (meter)
(2) The generation algorithms for the seats in the semi-circular areas
The generation algorithms are a bit more complex. Again, in brief, let's take the
generation algorithms for the seats in the eastern sub-areas as an example. As for the
position in the eastern sub-area with the coordinate (X n0 ,Y n0 ), the center coordinates
with the seat will be P(X,Y,Z), and this transformation can be performed through the
following formulae in group 2:
X =X n0 +L/2+sin(startA+i*endA)
Y = Y n0 +r*cos(chairA+i&averA)
Z =m*H.
( 2 )
Where n is the number of the eastern sub-area (0<n<9) and
—m is the number of the row (0<m<21)
—i is the number of the column (0<i<9)
—L is the length of the stand (meter)
—W is the width of the stand (meter)
—H is the vertical range between the adjacent seats (meter)
—r is the distance from the row to the center of the circle in the right respectively
—startA and endA are the starting angle and the ending angle of the column
—chairA is the angle of the row
—averA is the average angle of these seats
4 The identification algorithms for the seats
The purpose of the identification algorithms for the seats is to generate the code of the
corresponding seat according to the specific screen position. In fact, they are the reverse
algorithms of the generation algorithms for the seats. First, they transform the screen
coordinate system into the polar coordinate system; second, they work out the numbers
of the sub-area and row where the seat lies respectively; third, they work out the column
where the seat is found; finally, the code of the corresponding seat is computed out.
Search WWH ::




Custom Search