A method for realizing a three-dimensional virtual attitude indicator
Through three-dimensional computer graphics and texture mapping technology, combined with Blinn-Phong lighting rendering and Qt's 2D drawing system, a three-dimensional virtual attitude indicator is realized, which solves the problem that traditional two-dimensional instruments cannot meet the needs of airborne display, and significantly improves the three-dimensional effects and ergonomics.
Patent Information
- Application Number
- CN202011107943.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-10-16
- Publication Date
- 2025-01-21
- Estimated Expiration
- 2040-10-16
AI Technical Summary
Traditional two-dimensional airborne virtual instruments cannot meet the current airborne display needs, lack three-dimensional effects, and it is difficult to intuitively display flight attitude angle information.
Three-dimensional computer graphics is used to construct a spatial three-dimensional model through sphere modeling, texture mapping technology is used to draw scale information, spatial rotation effects are added, and the Blinn-Phong lighting rendering algorithm is applied, combined with Qt's 2D drawing system to draw dials and auxiliary controls.
It significantly enhances the three-dimensional effect, improves ergonomic efficiency, and can intuitively display flight attitude angle information to meet the needs of airborne display.
Smart Images

Figure CN112184897B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of aviation virtual instruments, and in particular to a method for realizing a three-dimensional virtual attitude indicator. Background Art
[0002] As an important part of the flight cockpit, the airborne instrument display provides the pilot with real-time flight attitude information and is an important carrier for the pilot to interact with the aircraft. Currently, the airborne instrument realizes the integration of computer graphics technology and liquid crystal display technology, and the graphic display of airborne instruments has become the main design method of airborne instruments.
[0003] At present, the realization method of airborne virtual instrument is mainly based on two-dimensional drawing method, which can no longer meet the current airborne display requirements. Therefore, adding three-dimensional graphics effects to traditional two-dimensional airborne virtual instrument is more in line with the development direction of airborne instrument technology. Summary of the invention
[0004] The purpose of the present invention is to provide a method for realizing a three-dimensional virtual attitude indicator, which significantly enhances the three-dimensional stereo effect, is more ergonomic, and adapts to airborne display requirements.
[0005] In order to achieve the above object, the present invention provides a method for realizing a three-dimensional virtual attitude indicator, wherein the attitude indicator is used to indicate aircraft attitude angle information, wherein the aircraft attitude angle describes the angle between the body axis system and the ground axis system, including the pitch angle, the yaw angle and the roll angle, and the method comprises:
[0006] Step 1: construct a spatial three-dimensional model for the attitude indicator through sphere modeling;
[0007] Step 2: Use texture mapping technology to draw corresponding scale information for the surface of the gesture ball;
[0008] Step 3: Add space rotation effect to intuitively display the flight attitude angle parameters;
[0009] Step 4: Apply Blinn-Phong lighting rendering to enhance the spatial three-dimensional sense of the posture ball;
[0010] Step 5: Draw the dial and auxiliary controls.
[0011] Preferably, the pitch angle is the angle between the longitudinal axis of the aircraft and the ground plane reference, the yaw angle is the angle between the projection of the longitudinal axis of the aircraft on the ground plane and the flight heading, and the roll angle is the angle of rotation of the aircraft around the longitudinal axis.
[0012] Preferably, the gesture ball in step 1 is designed and implemented based on OpenGL ES, and the modeling coordinate system of OpenGL is a right-handed coordinate system, that is, the right direction of the screen is the positive direction of the x-axis, the upper direction of the screen is the positive direction of the y-axis, and the direction of the screen toward the observer is the positive direction of the z-axis; the three-dimensional modeling of the gesture ball is performed in the modeling coordinate system of OpenGL, and the center point of the gesture ball is at the origin of the coordinate system. The calculation formula of the gesture ball is:
[0013] x=rcosαsinβ
[0014] y=rsinα
[0015] z=rcosαcosβ
[0016] Among them, angle α is the angle between the x-axis and the y-axis, the angle from the positive direction of the x-axis to the y-axis counterclockwise is positive, and the angle from the positive direction of the x-axis to the y-axis clockwise is negative, α∈[-π / 2,π / 2]; angle β is the angle between the x-axis and the z-axis, the angle from the positive direction of the z-axis to the x-axis counterclockwise is positive, β∈[0,2π]; r is the radius of the attitude sphere in the local coordinate system.
[0017] Preferably, the sphere modeling adopts the triangle patch approximation method to construct the sphere, that is, the surface of the sphere is subdivided into a number of triangles, and the triangle patches are drawn respectively; wherein the vertex coordinates of the triangle patches are obtained by the posture sphere calculation formula.
[0018] Preferably, in step 2, in texture mapping, the texture image is subdivided into triangles corresponding one-to-one to the multiple triangular patches into which the sphere surface is subdivided in sphere modeling.
[0019] Preferably, in step 3, the relevant rotation parameters of the attitude ball around the x-axis, y-axis and z-axis are set respectively through the rotate() function in the OpenGL ES model matrix, so as to realize the rotation effect of the attitude ball in space, which is used to preliminarily realize the effect of the attitude ball displaying the flight attitude angle information.
[0020] Preferably, the Blinn-Phong illumination model in step 4 only considers the lighting effect produced by the light source directly irradiating the surface of the object, wherein P is a point on the surface of the object; L is a unit light vector, which represents a unit vector pointing from a point on the surface of the object to the position of the light source; N is a unit normal vector, which represents a unit vector pointing from a point P on the surface of the object to the direction of the normal of point P; V is a unit observation vector, which represents a unit vector pointing from a point on the surface of the object to the viewpoint position; R is a unit reflection vector, which represents a unit vector in the direction of mirror reflection; H is a unit half-plane vector, which is represented as the bisector of the unit light vector and the unit observation vector, H=(L+V) / (|L+V|).
[0021] Preferably, the light intensity calculation formula of the Blinn-Phong local illumination model is:
[0022] I=k a I a +k d I p max(N·L,0)+k s I p max(N·H,0) n
[0023] Where k a , k d , k s They are the ambient reflectivity, diffuse reflectivity, and specular reflectivity of the object material; I a is the incident light intensity of the surrounding environment; I p is the incident light intensity emitted by the point light source; N is the unit normal vector, L is the unit light vector; H is the unit half-plane vector; n is the specular index of the object material.
[0024] Preferably, step 5 includes re-implementing the redraw event processing function void paintEvent(QPaintEvent*event); the specific contents include the texture map of the dial background; drawing of the posture angle auxiliary graphics, associating the spatial rotation of the posture ball with the posture angle auxiliary graphics, and assisting in obtaining the posture angle parameters; taking the 12 o'clock direction as the reference, the moving direction and angle of the posture angle auxiliary graphics on the circumference of the dial correspond to the spatial rotation state of the posture ball.
[0025] Preferably, the dial background adopts a texture mapping method, and the dial effect is realized by the drawImage() function; the auxiliary indication graphic is realized by drawing a circle, and is realized by the drawEllipse() function; wherein,
[0026] The red, green and blue circles on the circumference of the dial correspond to the pitch angle, yaw angle and roll angle respectively. By associating the coordinates of the center of the auxiliary indicator circle with the rotation angles of the attitude sphere around the x-axis, y-axis and z-axis, the auxiliary indicator circle can directly display the flight attitude angle information. At the same time, QPainter::Antialiasing in the QPainter class in the Qt two-dimensional graphics engine is used to perform anti-aliasing processing on the drawn auxiliary graphics.
[0027] According to the above technical scheme, the present invention aims at the shortcomings of traditional airborne virtual instruments, takes the virtual attitude indicator in the airborne instrument as the research object, and proposes a three-dimensional virtual attitude indicator implementation method based on three-dimensional computer graphics. In three-dimensional computer graphics, Euler angles respectively describe the pitch angle rotating around the x-axis, the yaw angle rotating around the y-axis, and the roll angle rotating around the z-axis, which correspond to the attitude angle of the aircraft. Therefore, the aircraft attitude angle information can be displayed by the direction and angle of rotation of the attitude ball. The method is based on OpenGL ES (Open Graphics Library for Embedded Systems) and Qt, a cross-platform C++ graphical user interface application development framework. A spatial three-dimensional model is constructed for the attitude indicator through sphere modeling; the corresponding scale information is drawn for the surface of the attitude ball using texture mapping technology; the flight attitude angle parameters are intuitively displayed by adding a spatial rotation effect; the Blinn-Phong lighting rendering algorithm is applied to enhance the spatial stereoscopic sense of the attitude ball; the dial information of the attitude indicator and the graphic information of the auxiliary indication are added using Qt's 2D drawing system.
[0028] Other features and advantages of the present invention will be described in detail in the following detailed description. BRIEF DESCRIPTION OF THE DRAWINGS
[0029] The accompanying drawings are used to provide a further understanding of the present invention and constitute a part of the specification. Together with the following specific embodiments, they are used to explain the present invention but do not constitute a limitation of the present invention. In the accompanying drawings:
[0030] Figure 1 It is a flow chart of a method for realizing a three-dimensional virtual attitude indicator provided by the present invention;
[0031] Figure 2 It is a rendering of the three-dimensional model of the attitude ball;
[0032] Figure 3 This is the texture mapping effect of the posture ball;
[0033] Figure 4 It is a schematic diagram of the optical path;
[0034] Figure 5 This is the rendering effect of the posture ball lighting;
[0035] Figure 6 This is a diagram showing the effect of the virtual attitude indicator. DETAILED DESCRIPTION
[0036] The specific implementation of the present invention is described in detail below in conjunction with the accompanying drawings. It should be understood that the specific implementation described here is only used to illustrate and explain the present invention, and is not used to limit the present invention.
[0037] In the present invention, unless otherwise stated, directional words such as "upper, lower, inside, outside" contained in a term merely represent the orientation of the term in normal usage, or are common names understood by those skilled in the art, and should not be regarded as limitations on the term.
[0038] The attitude indicator is an onboard instrument used to indicate the aircraft's attitude angle information. The aircraft's attitude angle describes the angle between the aircraft's axis system and the ground axis system, including pitch angle, yaw angle, and roll angle. The aircraft's pitch angle refers to the angle between the aircraft's longitudinal axis and the ground plane reference; the aircraft's yaw angle refers to the angle between the aircraft's longitudinal axis projection on the ground plane and the heading to be flown; the aircraft's roll angle refers to the angle of the aircraft's rotation around the longitudinal axis.
[0039] In 3D computer graphics, Euler angles describe the pitch angle around the x-axis, the yaw angle around the y-axis, and the roll angle around the z-axis, which correspond to the aircraft's attitude angle. Therefore, the aircraft's attitude angle information can be displayed by the direction and angle of the attitude ball's rotation.
[0040] See also Figure 1 The present invention provides a method for realizing a three-dimensional virtual attitude indicator, comprising:
[0041] Step 1: construct a spatial three-dimensional model for the attitude indicator through sphere modeling;
[0042] Step 2: Use texture mapping technology to draw corresponding scale information for the surface of the gesture ball;
[0043] Step 3: Add space rotation effect to intuitively display the flight attitude angle parameters;
[0044] Step 4: Apply Blinn-Phong lighting rendering to enhance the spatial three-dimensional sense of the posture ball;
[0045] Step 5: Draw the dial and auxiliary controls.
[0046] The hardware parameters of the development platform are as follows: processor: Intel(R) Core(TM) i7-9750H CPU@2.60GHz; RAM: 16.0GB; graphics card: NVIDIA GeForce GTX 1650;
[0047] The development software platform is as follows: the three-dimensional design of the present invention is mainly based on OpenGL ES, and the integrated development environment adopts QtCreator 4.3.0, which is based on Qt5.9.0. Qt has encapsulated the functions of OpenGL ES. The QOpenGLWidget class of the QtWidgets module in Qt5 provides a component for rendering OpenGL graphics; support for OpenGL related functions is provided through the Qt GUI module. The QOpenGLFunctions class provides an access interface to the OpenGL ES2.0 API. Therefore, the present invention inherits both the QOpenGLFunctions class and the QOpenGLWidget class in implementation.
[0048] In step 1, the gesture ball is designed and implemented based on OpenGL ES. The modeling coordinate system of OpenGL is a right-handed coordinate system, that is, the right direction of the screen is the positive direction of the x-axis, the upward direction of the screen is the positive direction of the y-axis, and the direction of the screen toward the observer is the positive direction of the z-axis. The three-dimensional modeling of the gesture ball is performed in the OpenGL modeling coordinate system. The center point of the gesture ball is at the origin of the coordinate system. The calculation formula of the gesture ball is:
[0049] x=rcosαsinβ
[0050] y=rsinα
[0051] z=rcosαcosβ
[0052] Among them, angle α is the angle between the x-axis and the y-axis, the angle from the positive direction of the x-axis to the y-axis counterclockwise is positive, and the angle from the positive direction of the x-axis to the y-axis clockwise is negative, α∈[-π / 2,π / 2]; angle β is the angle between the x-axis and the z-axis, the angle from the positive direction of the z-axis to the x-axis counterclockwise is positive, β∈[0,2π]; r is the radius of the attitude sphere in the local coordinate system.
[0053] In the specific implementation, the triangle patch approximation method is used to construct the sphere, that is, the surface of the sphere is subdivided into several triangles, and the triangle patches are drawn respectively; among which, the vertex coordinates of the triangle patches are obtained by the posture ball calculation formula. The posture ball three-dimensional model effect diagram is as follows Figure 2 shown.
[0054] Texture mapping is to map a given texture function to the surface of an object. When calculating the color of the object surface, the corresponding texture function value is added to affect the final color calculation result, so as to produce a texture effect on the surface of the object. The attitude indicator is an instrument used to display the aircraft attitude angle parameters, so it is necessary to display the corresponding color and scale information on the surface of the attitude sphere through texture mapping.
[0055] The texture image needs to be mapped on a sphere with a horizontal range of 360° and a vertical range of 180°. Combined with the correspondence between the sphere vertices and the texture image, it can be seen that the texture effect is best when the aspect ratio of the texture image is 2:1. Texture mapping requires the establishment of a correspondence between the surface of the posture sphere and the texture image. In sphere modeling, the surface of the sphere is subdivided into 360*180*2 triangles, so in texture mapping, the texture image is also subdivided into 360*180*2 triangles, and the triangular facets on the surface of the sphere correspond one to one. The texture mapping effect of the posture sphere is as follows Figure 3 shown.
[0056] By using the rotate() function in the OpenGL ES model matrix to set the rotation parameters of the attitude ball around the x-axis, y-axis, and z-axis, the attitude ball can be rotated in space. The attitude ball can initially display the flight attitude angle information.
[0057] The lighting rendering of the present invention adopts the Blinn-Phong lighting model, which only considers the light and shade effects produced by the light source directly irradiating the surface of the object.
[0058] Figure 4 is a schematic diagram of the optical path. P is a point on the surface of the object; L is the unit light vector, which indicates the unit vector from a point on the surface of the object to the position of the light source; N is the unit normal vector, which indicates the unit vector from a point P on the surface of the object to the direction of the normal line of point P; V is the unit observation vector, which indicates the unit vector from a point on the surface of the object to the viewpoint; R is the unit reflection vector, which indicates the unit vector in the direction of the mirror reflection; H is the unit half-plane vector, which is the bisector of the unit light vector and the unit observation vector, H = (L+V) / (|L+V|).
[0059] The light intensity calculation formula of the Blinn-Phong local illumination model used in the present invention is as follows:
[0060] I=k a I a +k d I p max(N·L,0)+k s I p max(N·H,0) n
[0061] Where k a , k d , k s They are the ambient reflectivity, diffuse reflectivity, and specular reflectivity of the object material; I a is the incident light intensity of the surrounding environment; I p is the incident light intensity emitted by the point light source; N is the unit normal vector, L is the unit light vector; H is the unit half-plane vector; n is the specular index of the object material. Figure 5 This is the effect of the posture ball after applying Blinn-Phong lighting rendering.
[0062] The complete implementation of the attitude indicator is based on the three-dimensional design method of the attitude indicator. It is also necessary to use Qt's 2D drawing system to add the attitude indicator's dial information and auxiliary indication graphic information.
[0063] Re-implement the repaint event processing function void paintEvent(QPaintEvent*event). The specific contents include the texture map of the dial background; the drawing of the posture angle auxiliary graphics, the association of the spatial rotation of the posture ball with the posture angle auxiliary graphics, and the auxiliary posture angle parameter acquisition. With the 12 o'clock direction as the reference, the movement direction and angle of the posture angle auxiliary graphics on the dial circumference correspond to the spatial rotation state of the posture ball.
[0064] The dial background uses texture mapping, and the dial effect is achieved through the drawImage() function. The auxiliary indicator graphics are realized by drawing circles, which are realized through the drawEllipse() function. The red, green, and blue circles on the circumference of the dial correspond to the pitch angle, yaw angle, and roll angle, respectively. By associating the coordinates of the center of the auxiliary indicator circle with the angle of rotation of the attitude ball around the x-axis, y-axis, and z-axis, the auxiliary indicator circle can directly display the flight attitude angle information. Use QPainter::Antialiasing in the QPainter class in the Qt two-dimensional graphics engine to perform anti-aliasing on the drawn auxiliary graphics. Figure 6 This is a diagram showing the running effect of the three-dimensional virtual attitude indicator program implemented by the present invention.
[0065] Through the above technical scheme, based on OpenGL ES (Open Graphics Library for Embedded Systems) and the cross-platform C++ graphical user interface application development framework Qt, a spatial three-dimensional model is constructed for the attitude indicator through sphere modeling; the texture mapping technology is used to draw the corresponding scale information for the surface of the attitude sphere; the spatial rotation effect is added to intuitively display the flight attitude angle parameters; the Blinn-Phong lighting rendering algorithm is applied to enhance the spatial three-dimensional sense of the attitude sphere; the dial information of the attitude indicator and the graphic information of the auxiliary indication are added using Qt's 2D drawing system. Finally, compared with the traditional virtual attitude indicator, its three-dimensionality is significantly enhanced, especially after the use of lighting rendering, and it is also more ergonomic.
[0066] The preferred embodiments of the present invention are described in detail above in conjunction with the accompanying drawings. However, the present invention is not limited to the specific details in the above embodiments. Within the technical concept of the present invention, a variety of simple modifications can be made to the technical solution of the present invention, and these simple modifications all belong to the protection scope of the present invention.
[0067] It should also be noted that the various specific technical features described in the above specific embodiments can be combined in any suitable manner without contradiction. In order to avoid unnecessary repetition, the present invention will not further describe various possible combinations.
[0068] In addition, various embodiments of the present invention may be arbitrarily combined, and as long as they do not violate the concept of the present invention, they should also be regarded as the contents disclosed by the present invention.
Claims
1. A method for implementing a three-dimensional virtual attitude indicator, wherein the attitude indicator is used to indicate aircraft attitude angle information, the aircraft attitude angle describes the angle between the body axis system and the ground axis system, including the pitch angle, yaw angle and roll angle, characterized in that: The three-dimensional virtual attitude indicator implementation method comprises: Step 1: construct a spatial three-dimensional model for the attitude indicator through sphere modeling; Step 2: Use texture mapping technology to draw corresponding scale information for the surface of the gesture ball; Step 3: Add space rotation effect to intuitively display the flight attitude angle parameters; Step 4: Apply Blinn-Phong lighting rendering to enhance the spatial three-dimensional sense of the posture ball; Step 5: Draw the dial and auxiliary controls; The Blinn-Phong illumination model in step 4 only considers the shading effect caused by the light source directly shining on the surface of the object, where P is a point on the surface of the object; L is a unit light vector, which represents a unit vector from a point on the surface of the object to the position of the light source; N is a unit normal vector, which represents a unit vector from a point P on the surface of the object to the direction of the normal line of point P; V is a unit observation vector, which represents a unit vector from a point on the surface of the object to the viewpoint; R is a unit reflection vector, which represents a unit vector in the direction of mirror reflection; H is a unit half-plane vector, which is a vector that bisects the unit light vector and the unit observation vector, H = (L+V) / (|L+V|); The light intensity calculation formula of the Blinn-Phong local illumination model is: I=k a I a +k d I p max(N·L,0)+k s I p max(N·H,0) n Where k a , k d , k s They are the ambient reflectivity, diffuse reflectivity, and specular reflectivity of the object material; I a is the incident light intensity of the surrounding environment; I p is the incident light intensity emitted by the point light source; N is the unit normal vector, L is the unit light vector; H is the unit half-plane vector; n is the specular index of the object material.
2. The method for implementing a three-dimensional virtual attitude indicator according to claim 1, characterized in that: The pitch angle is the angle between the longitudinal axis of the aircraft and the ground plane reference, the yaw angle is the angle between the projection of the longitudinal axis of the aircraft on the ground plane and the flight direction, and the roll angle is the angle at which the aircraft rotates around the longitudinal axis.
3. The method for implementing a three-dimensional virtual attitude indicator according to claim 1, characterized in that: In step 1, the gesture ball is designed and implemented based on OpenGL ES. The modeling coordinate system of OpenGL is a right-handed coordinate system, that is, the right direction of the screen is the positive direction of the x-axis, the upward direction of the screen is the positive direction of the y-axis, and the direction of the screen toward the observer is the positive direction of the z-axis. The three-dimensional modeling of the gesture ball is performed in the OpenGL modeling coordinate system. The center point of the gesture ball is at the origin of the coordinate system. The calculation formula of the gesture ball is: x=rcosαsinβ y=rsinα z=rcosαcosβ Among them, angle α is the angle between the x-axis and the y-axis, the angle from the positive direction of the x-axis to the y-axis counterclockwise is positive, and the angle from the positive direction of the x-axis to the y-axis clockwise is negative, α∈[-π / 2,π / 2]; angle β is the angle between the x-axis and the z-axis, the angle from the positive direction of the z-axis to the x-axis counterclockwise is positive, β∈[0,2π]; r is the radius of the attitude sphere in the local coordinate system.
4. The method for realizing a three-dimensional virtual attitude indicator according to claim 3, characterized in that: The sphere modeling adopts the triangle patch approximation method to construct the sphere, that is, the surface of the sphere is subdivided into several triangles, and the triangle patches are drawn separately; among which, the vertex coordinates of the triangle patches are obtained by the posture sphere calculation formula.
5. The method for implementing a three-dimensional virtual attitude indicator according to claim 1, characterized in that: In step 2, in texture mapping, the texture image is subdivided into triangles that correspond one-to-one to the multiple triangular patches into which the sphere surface is subdivided in sphere modeling.
6. The method for implementing a three-dimensional virtual attitude indicator according to claim 1, characterized in that: In step 3, the rotate() function in the OpenGL ES model matrix is used to set the relevant rotation parameters of the attitude ball around the x-axis, y-axis and z-axis respectively, so as to realize the rotation effect of the attitude ball in space, which is used to preliminarily realize the effect of the attitude ball displaying the flight attitude angle information.
7. The method for implementing a three-dimensional virtual attitude indicator according to claim 1, characterized in that: Step 5 includes re-implementing the redraw event processing function void paintEvent(QPaintEvent*event); the specific contents include the texture map of the dial background; drawing the posture angle auxiliary graphics, associating the spatial rotation of the posture ball with the posture angle auxiliary graphics, and assisting in obtaining the posture angle parameters; taking the 12 o'clock direction as the reference, the movement direction and angle of the posture angle auxiliary graphics on the circumference of the dial correspond to the spatial rotation state of the posture ball.
8. The method for implementing a three-dimensional virtual attitude indicator according to claim 7, characterized in that: The dial background adopts the texture mapping method, and the dial effect is realized by the drawImage() function; the auxiliary indication graphics are realized by drawing circles, and are realized by the drawEllipse() function; among them, The red, green and blue circles on the circumference of the dial correspond to the pitch angle, yaw angle and roll angle respectively. By associating the coordinates of the center of the auxiliary indicator circle with the rotation angles of the attitude sphere around the x-axis, y-axis and z-axis, the auxiliary indicator circle can directly display the flight attitude angle information. At the same time, QPainter::Antialiasing in the QPainter class in the Qt two-dimensional graphics engine is used to perform anti-aliasing processing on the drawn auxiliary graphics.
Citation Information
Patent Citations
Aerial unmanned plane ultra-viewing distance remote control method
CN101493699A
Attitude determination and virtual reality roaming method of intelligent machine
CN104748746A