A highway digital twin engine system based on OpenGL
Through OpenGL -based highway digital twin engine system, the linear interpolation algorithm and OpenGL drawing technology are used to solve the problem of low -speed road network three -dimensional viewing efficiency and difficulty constructing complex urban road vision data in existing technology. The accurate three -dimensional view construction.
Patent Information
- Application Number
- CN202310489382.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-05-04
- Publication Date
- 2025-01-24
- Estimated Expiration
- 2043-05-04
AI Technical Summary
The prior art is inefficient when building three-dimensional viewing of high-speed road networks, making it difficult to quickly build complex urban road viewing data, such as intersections and overpasses.
Adopt an OpenGL -based highway digital twin engine system, read modules, road data processing modules, road simulation modules, traffic facility data processing modules, traffic facilities simulation modules and synthetic modules through simulation database, and realize the rapid high -speed road network three -dimensional views. Construction. The system generates the GPS point information through a linear interpolation algorithm, and uses OpenGL to draw the three -dimensional virtual model of roads and transportation facilities.
It realizes the rapid construction of three-dimensional highway scenes, improves construction efficiency, and can accurately construct complex urban road scene data to meet the needs of high-speed traffic simulation.
Smart Images

Figure CN116597105B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of constructing three-dimensional visual scenes of expressway networks, and specifically relates to an OpenGL-based expressway digital twin engine system. Background Art
[0002] Three-dimensional vision is an important part of highway traffic simulation. Driving simulation vision system, road traffic accident reconstruction, etc. all require the construction of three-dimensional vision of urban roads.
[0003] In terms of visual modeling, AutoCAD has powerful 2D modeling capabilities, but its efficiency in building 3D visuals for road networks is low, and data output needs to be converted before it can be used. 3DSMAX has powerful modeling capabilities and is suitable for fine modeling of objects. Although it can render perfect works with photo-quality, its modeling data volume is huge, which is somewhat different from the requirements for real-time rendering of 3D visuals for highway networks.
[0004] There is a standard road modeling module in the visual simulation modeling software MultigenCreator, which can generate three-dimensional model road section data through the construction of center lines (combinations of straight lines, horizontal curves, longitudinal slopes and vertical curves). However, for the above three-dimensional simulation software, the construction of the road network takes a lot of time, and it is difficult to construct complex urban road visual data such as intersections and overpasses. Summary of the invention
[0005] In order to overcome the deficiencies of the above-mentioned prior art, the present invention provides a highway digital twin engine system based on OpenGL.
[0006] In order to achieve the above object, the present invention provides the following technical solutions:
[0007] A highway digital twin engine system based on OpenGL, comprising:
[0008] The simulation database reading module is used to read the information of road GPS points from the external road network database;
[0009] The road data processing module is used to define the precision of the road GPS points, perform linear interpolation operations on adjacent road GPS points according to the precision of the GPS points, and generate the total road network GPS point information;
[0010] The road simulation module is used to draw a three-dimensional virtual model of the road based on the GPS point information of the total road network;
[0011] The traffic facility data processing module is used to read the information of traffic facilities from the traffic facility database and establish a traffic facility distribution table;
[0012] Traffic facility simulation module, used to extract the characteristics of traffic facilities in the traffic facility distribution table and draw traffic facility models;
[0013] The synthesis module is used to add the traffic facility model to the virtual model of the road to realize the construction of the three-dimensional vision of the expressway network.
[0014] Further, the linear interpolation operation on adjacent road GPS points includes:
[0015] Determine the vector A between two adjacent GPS points;
[0016] The vector A is normalized using the precision of the set GPS point. The calculation method is:
[0017] A1=normalize(A)
[0018] Interpolate A1 to get the interpolated vector B:
[0019] B=A1*A
[0020] Use the interpolated vector B to get the interpolated GPS point P0:
[0021] P0=P1*B
[0022] Among them, P1 represents the GPS point before interpolation, and P0 represents the GPS point after interpolation.
[0023] Furthermore, in the information read from the traffic facility database, when the read information is a variable mark, the reading step includes:
[0024] Read the content of the variable mark, the type of the variable mark, the width of the variable mark, the height of the variable mark, the latitude and longitude and altitude information of the variable mark;
[0025] Filter the information. If the following conditions are met: prompt information > number of preset prompt information or type of variable sign > number of preset variable sign types or longitude, latitude and altitude of variable sign > range of electronic fence in traffic simulation scene, then filter out.
[0026] Furthermore, it also includes: defining a structure of variable flag information; saving the read variable flag information in the structure of the variable flag information; the structure of the variable flag information is:
[0027] struct KBBZInfo
[0028] {
[0029] float x;
[0030] float y;
[0031] float z;
[0032] DWORD type;
[0033] float wid;
[0034] float hei;
[0035] }
[0036] Among them, KBBZInfo is a structure of variable mark information, in which x represents the longitude of the variable mark, Y represents the latitude of the variable mark, z represents the height of the variable mark, wid represents the width of the variable mark, and Hei represents the height of the variable mark.
[0037] Further, the total road network GPS point information is:
[0038] struct zGPS
[0039] {
[0040] Int n;
[0041] float x
[100] ;
[0042] float y
[100] ;
[0043] float z
[100] ;
[0044] }
[0045] Among them, zGPS is the structure of the total road network GPS point information, n is the number of valid GPS points after interpolation, and x, y, z are the longitude, latitude and altitude of each GPS point respectively.
[0046] Further, the three-dimensional virtual model of the road is drawn using OpenGL according to the GPS point information of the total road network, including:
[0047] After reading the x, y, and z information of each road GPS point from the zGPS structure, use the following OpenGL code to draw the road:
[0048] For(int i=0;i <n;i++)
[0049] {
[0050] glBebin(GL_POINTS);
[0051] glVertex(x,y,z);
[0052] glEnd();
[0053] }
[0054] Among them:
[0055] For(int i = 0; i < n; i++) means starting from 0 to n, and drawing n times in total;
[0056] glBegin(GL_POINTS) means starting to draw the model;
[0057] glVertex(x, y, z) specifies the vertex of the model;
[0058] glEnd() means stopping the drawing.
[0059] Furthermore, the information read from the traffic facility database includes:
[0060] Use the reading library function LoadMod function in the OpenGL system to read the path of the model from the traffic facility database and allocate the corresponding memory space;
[0061] Use the reading library function Loadmtl function in the OpenGL system to read the path of the model material, and at the same time allocate the corresponding memory space;
[0062] The read content uses the reading library function LoadContext function in the OpenGL system to read the path of the model content, and at the same time allocate the corresponding content space.
[0063] Furthermore, the features of the traffic facilities in the traffic facility distribution table are extracted, and the traffic facility model is drawn using OpenGL; including:
[0064] The traffic facility distribution table is:
[0065] struct zKBBZ
[0066] {
[0067] Int n;
[0068] float x
[100] ;
[0069] float y
[100] ;
[0070] float z
[100] ;
[0071] Char*mod
[100] ;
[0072] Char*mtl
[100] ;
[0073] Char*nr
[100] ;
[0074] }
[0075] After storing x, y, and z from the database file into x
[100] , y
[100] , and z
[100] in zKBBZ, store the path of the model into mod
[100] , the path of the material into mtl
[100] , and the path of the content into nr
[100] ;
[0076] Use the following OpenGL code to draw this traffic target model:
[0077] For(int i = 0; i < n; i++)
[0078] {
[0079] glBegin(GL_TRIANGLES);
[0080] glVertex(x[0], y[0], z[0]);
[0081] glVertex(x[1], y[1], z[1]);
[0082] glVertex(x[2], y[2], z[2]);
[0083] glEnd();
[0084] }
[0085] In this code:
[0086] For(int i = 0; i < n; i++) means starting from 0 to n;
[0087] The basic element that needs to be drawn n times;
[0088] glBegin(GL_TRIANGLES) means starting to draw the model;
[0089] glVertex(x[0], y[0], z[0]) specifies the vertex x[0], y[0], z[0] of the model;
[0090] glVertex(x[1], y[1], z[1]) specifies the vertex x[1], y[1], z[1] of the model;
[0091] glVertex(x[2], y[2], z[2]) specifies the vertex x[2], y[2], z[2] of the model;
[0092] glEnd() means stopping the drawing.
[0093] Furthermore, it also includes:
[0094] Call the ShowRealMtl() function in OpenGL to load the material mtl of this model;
[0095] After the material mtl is loaded, call the ShowModContext() function in OpenGL to load the custom content of the model.
[0096] The OpenGL-based highway digital twin engine system provided by the present invention has the following beneficial effects:
[0097] The present invention automatically generates the total road network GPS point information through an interpolation fitting algorithm, then draws a three-dimensional virtual model of the road based on the generated total road network GPS point information, and finally places traffic facilities such as traffic signs in the three-dimensional virtual model of the road according to the model position. For high-speed traffic facilities, a feature extraction method is used to extract features from a traffic facility distribution table and generate a stable and sound traffic model. The present invention has high reliability, fast generation speed and good versatility. It solves the problem in the prior art that it takes a lot of time to construct a road network and it is difficult to construct complex urban road visual data such as intersections and overpasses. BRIEF DESCRIPTION OF THE DRAWINGS
[0098] In order to more clearly illustrate the embodiment of the present invention and its design scheme, the following briefly introduces the drawings required for this embodiment. The drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0099] Figure 1 A schematic diagram of a highway digital twin engine system based on OpenGL according to an embodiment of the present invention;
[0100] Figure 2 It is a simulation database structure diagram of the variable mark in the present invention;
[0101] Figure 3 This is a diagram of the road surface GPS point interpolation process in the present invention. DETAILED DESCRIPTION
[0102] In order to enable those skilled in the art to better understand the technical solution of the present invention and implement it, the present invention is described in detail below in conjunction with the accompanying drawings and specific embodiments. The following embodiments are only used to more clearly illustrate the technical solution of the present invention, and cannot be used to limit the scope of protection of the present invention.
[0103] Example:
[0104] There are many softwares for building virtual worlds, such as WTK, OSG and OpenGL, which are 3D language packages suitable for building 3D worlds in VC environment. OPENGL only provides functions for generating basic graphics such as points, lines and polygons, and does not provide direct functions for modeling complex geometric entities. Therefore, it is necessary to build the 3D vision of the highway network through programming.
[0105] Although the setting requirements of the road 3D scene in traffic simulation are different from the engine driving the scene, the rapid construction of the 3D scene of the highway network has become an urgent problem to be solved in this field.
[0106] Three-dimensional virtual vision is important in studying road traffic simulation problems, but it is difficult and unnecessary to faithfully move all the scenes in real high-speed road traffic scenes into virtual scenes. The minimum scenes that can best reflect the characteristics should be abstracted according to the problem being studied.
[0107] The present invention provides a highway digital twin engine system based on OpenGL, specifically Figure 1 As shown, it includes: a simulation database reading module, which is used to read the information of road GPS points from an external road network database; a road data processing module, which is used to define the precision of road GPS points, and perform linear interpolation operations on adjacent road GPS points according to the precision of GPS points to generate the total road network GPS point information; a road simulation module, which is used to draw a three-dimensional virtual model of the road using OpenGL according to the total road network GPS point information; a traffic facility data processing module, which is used to read the information of traffic facilities from the traffic facility database and establish a traffic facility distribution table; a traffic facility simulation module, which is used to extract the characteristics of traffic facilities in the traffic facility distribution table and draw the traffic facility model using OpenGL; a synthesis module, which is used to add the traffic facility model to the virtual model of the road to realize the construction of a three-dimensional visual scene of the expressway network.
[0108] The following are the specific implementation details of the present invention:
[0109] Step 1: Read the external traffic simulation database through the simulation database reading module to obtain the content to be simulated. Parse the format and content of the simulation database and store the corresponding content in the corresponding structure.
[0110] Step 2: The road data processing module performs linear interpolation based on the GPS points in the road network database, and finally obtains the road network information of n GPS points, and also stores such a GPS point information in the corresponding structure.
[0111] Step 3: The road simulation module extracts valid GPS point information from the road network structure, performs filtering and removes invalid data, and determines its validity. Finally, the corresponding OpenGL code is used to draw the GPS points generated after linear interpolation, and finally the corresponding road model is generated.
[0112] Step 4: The traffic facility data processing module reads the basic elements of all models required for simulation from the external micro-model database.
[0113] Step 5: The traffic facility simulation module will first store all the basic elements of the model into the corresponding structure, and then draw the traffic element model through the corresponding OpenGL code to realize the simulation.
[0114] Simulation database reading module:
[0115] This module is used to read the content that needs to be simulated in the external simulation database.
[0116] In the present invention, we define the external simulation database file as the info.ini file. In such a simulation database file, we define the information of multiple traffic elements.
[0117] The following takes the simulation process of variable flags as an example. For example, the format defined in the simulation database file for variable flag information is as follows: Figure 2 shown.
[0118] In the simulation system, read the ts, type, wid, hei, x, y, z information in sequence.
[0119] The information will be used to generate the content of the variable sign, the type of the variable sign, the width of the variable sign, the height of the variable sign, and the latitude, longitude and altitude of the variable sign.
[0120] After reading the content of the variable mark, the type of the variable mark, the width of the variable mark, the height of the variable mark, the latitude and longitude and the altitude information of the variable mark, the software system implements a filtering method for the information. The specific implementation method is as follows:
[0121] Prompt information > preset number of prompt information, filter
[0122] Variable flag type > preset variable flag type number, filter out
[0123] The latitude, longitude and altitude of the variable sign > the range of the electronic fence in the traffic simulation scene, filter out
[0124] After reading and filtering out incorrect information, the simulation system defines a variable flag information structure data, the structure is as follows:
[0125] struct KBBZInfo
[0126] {
[0127] float x;
[0128] float y;
[0129] float z;
[0130] DWORD type;
[0131] float wid;
[0132] float hei;
[0133] };
[0134] The simulation system saves the variable flag information read from the database in the KBBZInfo structure in sequence for further simulation.
[0135] Road data processing module:
[0136] The simulation system reads the information of the road GPS points from the road database road.ini, and its structure is:
[0137] struct GPS
[0138] {
[0139] float x;
[0140] float y;
[0141] float z;
[0142] };
[0143] Where x, y, and z are the longitude, latitude, and altitude of each GPS point. Define the precision of the road network GPS points as 0.1, and perform interpolation operations on adjacent GPS points. Figure 3 As shown, the total road network GPS point information is generated, and its structure is:
[0144] struct zGPS
[0145] {
[0146] Int n;
[0147] float x
[100] ;
[0148] float y
[100] ;
[0149] float z
[100] ;
[0150] }
[0151] The maximum number of GPS points is defined as 100 here, and n is the number of valid gps points after interpolation. The zGPS structure is used to generate the subsequent road network model.
[0152] Road simulation module:
[0153] This module reads the x, y, and z information of each road surface GPS point from the zGPS structure. Then, the following OpenGL code is used to draw the road surface:
[0154] For(int i = 0; i < n; i++)
[0155] {
[0156] glBebin(GL_POINTS);
[0157] glVertex(x, y, z);
[0158] glEnd();
[0159] }
[0160] The above code is used to draw the entire road.
[0161] In this code:
[0162] For(int i = 0; i < n; i++) means starting from 0 to n;
[0163] The basic element that needs to be drawn n times;
[0164] glBebin(GL_POINTS) means starting to draw the model;
[0165] glVertex(x, y, z) specifies the vertex of the model;
[0166] glEnd() stops drawing.
[0167] Traffic facility data processing module:
[0168] This module reads the basic information of traffic elements from the external traffic model database mod.ini. For a traffic element such as a variable sign, the information read is:
[0169] mod = relative path of the model
[0170] mtl = relative path of the material
[0171] nr = relative path of the content
[0172] The software system will read the corresponding model from this path. The reading method uses the LoadMod function in the OpenGL system to read the model and allocate the corresponding memory space. The material reading method is similar to the model. The material path is read using the Loadmtl function in the OpenGL system and the corresponding memory space is allocated. The content is read using the LoadContext function in the OpenGL system and the content of the model is allocated. After completing the above steps, the software system checks the correctness of the reading results in turn to ensure the success of each reading.
[0173] Traffic facility simulation module:
[0174] For the traffic elements read, a basic element distribution table is established. Taking the variable sign as an example, the basic distribution table established is as follows:
[0175] struct zKBBZ
[0176] {
[0177] Int n;
[0178] float x
[100] ;
[0179] float y
[100] ;
[0180] float z
[100] ;
[0181] Char*mod
[100] ;
[0182] Char*mtl
[100] ;
[0183] Char*nr
[100] ;
[0184] }
[0185] After storing the latitude and longitude in the info.ini database file, that is, x, y, z, into x, y, z in zKBBZ, we store the model relative path into mod
[100] , the material relative path into mtl
[100] , and the content relative path into nr
[100] . Finally, simulation modeling is performed. Use the following OpenGL code to draw this traffic target model:
[0186] For(int i=0;i <n;i++)
[0187] {
[0188] glBebin(GL_TRIANGLES);
[0189] glVertex(x[0],y[0],z[0]);
[0190] glVertex(x[1],y[1],z[1]);
[0191] glVertex(x[2],y[2],z[2]);
[0192] glEnd();
[0193] }
[0194] In this code:
[0195] For(int i = 0; i < n; i++) means starting from 0 to n;
[0196] The basic element that needs to be drawn n times;
[0197] glBegin(GL_TRIANGLES) means starting to draw the model;
[0198] glVertex(x[0],y[0],z[0]); specifies the vertex x[0], y[0], z[0] of the model;
[0199] glVertex(x[1],y[1],z[1]); specifies the vertex x[1], y[1], z[1] of the model;
[0200] glVertex(x[2],y[2],z[2]); specifies the vertex x[2], y[2], z[2] of the model;
[0201] glEnd() stops drawing.
[0202] After the vertices of the model are drawn, the model will be simulated. At this time, the OpenGL function ShowRealMtl() is called to load the material mtl of this model. After the material mtl is loaded, the OpenGL function ShowModContext() is called to load the custom content of the model, which is the content specifically customized by the variable flag user. In this way, the complete variable flag will be simulated.
[0203] The above-described embodiments are only the preferred specific embodiments of the present invention, and the protection scope of the present invention is not limited thereto. Any simple changes or equivalent replacements of the technical solutions that can be obviously obtained by those skilled in the art within the technical scope disclosed by the present invention all belong to the protection scope of the present invention.
Claims
1. A highway digital twin engine system based on OpenGL, characterized in that: include: The simulation database reading module is used to read the information of road GPS points from the external road network database; The road data processing module is used to define the precision of the road GPS points, perform linear interpolation operations on adjacent road GPS points according to the precision of the GPS points, and generate the total road network GPS point information; the linear interpolation operations on adjacent road GPS points include: Determine the vector A between two adjacent GPS points; The vector A is normalized using the precision of the set GPS point. The calculation method is: A1=normalize(A) Interpolate A1 to get the interpolated vector B: B=A1*A Use the interpolated vector B to get the interpolated GPS point P0: P0=P1*B Among them, P1 represents the GPS point before interpolation, and P0 represents the GPS point after interpolation; The road simulation module is used to draw a three-dimensional virtual model of the road using OpenGL based on the GPS point information of the total road network; The traffic facility data processing module is used to read the information of traffic facilities from the traffic facility database and establish a traffic facility distribution table; Traffic facility simulation module, used to extract the characteristics of traffic facilities in the traffic facility distribution table and draw traffic facility models using OpenGL; The synthesis module is used to add the traffic facility model to the virtual model of the road to realize the construction of the three-dimensional vision of the expressway network.
2. The highway digital twin engine system based on OpenGL according to claim 1, characterized in that: In the traffic facility data processing module, when the read information is a variable mark, the reading step includes: Read the content of the variable mark, the type of the variable mark, the width of the variable mark, the height of the variable mark, the latitude and longitude and altitude information of the variable mark; Filter the information. If the following conditions are met: prompt information > number of preset prompt information or type of variable sign > number of preset variable sign types or longitude, latitude and altitude of variable sign > range of electronic fence in traffic simulation scene, then filter out.
3. The highway digital twin engine system based on OpenGL according to claim 1, characterized in that: The step of reading the information of the traffic facilities from the traffic facilities database includes: Use the LoadMod function in the OpenGL system to read the model path from the traffic facility database and allocate the corresponding memory space; Use the Loadmtl function in the OpenGL system to read the path of the model material and allocate the corresponding memory space; Reading content uses the LoadContext function in the OpenGL system to read the path of the model's content and allocate the corresponding content space.
4. The highway digital twin engine system based on OpenGL according to claim 1, characterized in that: Also includes: Call the ShowRealMtl() function in OpenGL to load the material mtl of this model; After the material mtl is loaded, call the ShowModContext() function in OpenGL to load the custom content of the model.
Citation Information
Patent Citations
Three-dimensional simulation digital information navigation channel system and its implementing method
CN101154313A
Live-action three-dimensional digital twin channel scene construction method
CN113192192A