# Virtual Laboratory for the Full-Field Goniophotometer of Luminaires
## 3 System Design Process
### Mobile Emulation via Gyroscope Control  
In this virtual simulation experiment, the gyroscope that comes with the mobile phone is used to obtain the 3D pose function of the mobile phone in space. To obtain the pose data of the camera, it enables the user to look around the environment, better understand the structure of the laboratory, and more easily manipulate the virtual experimenter to advance to the target location, thus better enhancing the user experience [15; 16].  
In the virtual experiment platform of the mobile phone, the gyroscope sensor in the mobile phone is mainly based on the quaternion to represent the offset of the pose angle, to control the rotational motion of the virtual camera in the laboratory, and to achieve the circumnavigation effect. The quaternion can be described as the rotation of a coordinate system with respect to a certain coordinate system. The use of quaternions not only enables the representation of rotational information in 3D space, but also avoids the gimbal lock problem that arises from using Eulerian rotation. Its quaternion formula is shown in Equation (1) below.  
\[\text{Q}=[q_{0}\ q_{1}\ q_{2}\ q_{3}]=[\cos\theta/2-\text{xsin}\ \theta/2-\text{ysin}\ \theta/2-\text{zsin}\ \theta/2] \tag{1}\]  
When the quaternions are converted to Euler angles, the equation representing the angle of rotation in each direction in three-dimensional space is shown below in Equation (2).  
\[\begin{bmatrix}\Phi\\ \theta\\ \Psi\end{bmatrix}=\begin{bmatrix}\arctan\frac{2(q_{0}q_{1}+q_{2}q_{3})}{1-2(q_ {1}^{2}+q_{2}^{2})}\\ \arcsin(2(q_{0}q_{2}-q_{1}q_{3}))\\ \arctan\frac{2(q_{0}q_{3}+q_{2}q_{1})}{1-2(q_{3}^{2}+q_{2}^{2})}\end{bmatrix} =\begin{bmatrix}a\tan 2(2(q_{0}q_{1}+q_{2}q_{3}),1-2({q_{1}}^{2}+q_{2}^{2}))\\ asin(2(q_{0}q_{2}-q_{1}q_{3}))\\ atan2(2(q_{0}q_{3}+q_{2}q_{1}),1-2({q_{3}}^{2}+q_{2}^{2}))\end{bmatrix} \tag{2}\]  
The angles are the rotation angles of the phone model in each direction, and as shown in Figure 11, \(\Phi\) is the angle of rotation around the \(y\)-axis, \(\theta\) is the angle of rotation around the \(x\)-axis, and \(\Psi\) is the angle of rotation around the \(z\)-axis. Since the gyroscope data are in a right-handed coordinate system, and unity is in a left-handed coordinate system, we can convert it to see the scene in a certain direction by shifting it in a certain direction.  
Figure 10: Diagram of the light distribution curve. (**a**) Realistic light distribution curves; (**b**) Virtual light distribution curve at C0\({}^{\circ}\); (**c**) Virtual drawing of the finished light distribution curve; (**d**) Model drawing of the 3D light distribution curve.  
In the virtual simulation, when the gyroscope and its controller are turned on, the phone can be moved up and down as well as left and right. The phone can be turned from landscape to portrait, thus achieving a circular view of the laboratory environment. A better familiarity with the layout construction of the laboratory and the implementation of the experimental process and a real-time output of the direction, camera base settings, and gyroscope data are in the upper left corner, as in Figure 12.  
The virtual experiment platform is presented on mobile phones using a gyroscope to assist the user to familiarize themselves with the basic layout of the laboratory and to assist the virtual experimenter and get to the location of each part of the experiment more quickly, thus making the simulated distribution photometer easier to manipulate and understand and greatly enhancing the user's experience and immersion.