CN110807240B - OpenGL-based scene interference rapid judgment method for space position calculation - Google Patents
OpenGL-based scene interference rapid judgment method for space position calculation Download PDFInfo
- Publication number
- CN110807240B CN110807240B CN201910879644.5A CN201910879644A CN110807240B CN 110807240 B CN110807240 B CN 110807240B CN 201910879644 A CN201910879644 A CN 201910879644A CN 110807240 B CN110807240 B CN 110807240B
- Authority
- CN
- China
- Prior art keywords
- model
- points
- simulation
- interference
- topography
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
Images
Landscapes
- Management, Administration, Business Operations System, And Electronic Commerce (AREA)
- Supply And Distribution Of Alternating Current (AREA)
- Processing Or Creating Images (AREA)
Abstract
The invention discloses a scene interference rapid judging method based on OpenGL space position calculation. Establishing a model database, and automatically acquiring outline polygon envelope information of the model into the database; creating a model material management interface, wherein in a simulated 3D program, the model material management interface is automatically placed in the middle of a scene after the topography is imported, a sky box is automatically adapted to the topography, and the space outside the topography is invisible; when the simulation models of the transformer substation, the energy consumption equipment or the power generation equipment and the like are towed, judgment and calculation are started in a plurality of steps, and whether the towed position is overlapped with the space position of the simulation model of the energy consumption equipment or the power generation equipment is towed into the transformer substation is judged. The invention can prevent the position interference among simulation models and the tangent among models in a simulation scene after the simulation models are interfered with the terrain, and ensure the rapidity of interference judgment.
Description
Technical Field
The invention relates to a method for rapidly judging bit interference in a 3D space scene during model arrangement based on an OpenGL technology, in particular to a scene interference rapid judging method based on OpenGL space position calculation.
Background
In a 3D program of micro-grid simulation realized based on an OpenGL technology, simulation models such as complex terrain, various power generation equipment, various energy consumption equipment such as buildings and factories, transformer substations and main networks are related, the models are established according to actual proportions, and when the models are placed in a 3D scene, the simulation models are prevented from being tangent to the models in the simulation scene after being related to the simulation models and the terrain interference, and meanwhile, the rapidity of interference judgment is ensured.
In a simulation environment in a 3D program of micro-grid simulation, a terrain is established by a user according to the actual terrain to be simulated, and has a river, a mountain and other fluctuation, and when a simulation model of a transformer substation, energy consumption equipment or power generation equipment and the like is dragged and dropped onto the terrain in a simulation scene, the requirements of mutual embedding cannot be met. Since the terrain and energy consumption model is as follows: 1, the appearance is complex, the simulation model is required to be put on a relatively flat position on the terrain, and the simulation model cannot be put on the positions of a river channel, a ditch, a pond and the like. The interference judging method cannot be judged by using simple Boolean, even if the terrain position corresponding to the arranged model is not provided with a river channel, the interference judging method is judged by using Boolean, the time consumption is long, the clamping is severe, the operation is too fast, the software is crashed and exits, meanwhile, the appearance is complex, the interference judging method cannot be judged by using an AABB envelope frame, otherwise, any simulation model cannot be placed on the mountain terrain, or a series of problems such as no obvious position interference but misjudgment interference among the simulation models are caused.
Disclosure of Invention
The invention aims to provide a scene interference rapid judging method based on OpenGL space position calculation, which can ensure the rapidity of judging interference, improve the efficiency of simulation modeling training and can be used for auxiliary decision making of space construction planning of a micro-grid system.
The aim of the invention is achieved by the following technical scheme:
a scene interference rapid judging method based on OpenGL space position calculation is characterized by comprising the following steps: through the joint analysis of model characteristic data and scene parameters, the rapid discrimination is carried out by adopting a quadtree space model, and the method is specifically as follows:
firstly, a model database is built, the necessary fields include a unique field of the type of the record model, the topography, energy consumption equipment, a transformer substation or power generation equipment, correct calling in a program is ensured, and the model database is mainly used in simulation logic.
Secondly, when a simulation model is built, an origin (0, 0 point) is required to be in the center of a geometric figure, and when the simulation model is put in storage, the outline polygon envelope information of the model is automatically acquired into the database.
And thirdly, creating a model material management interface, so as to maintain model type fields in the database and realize the functions of adding, deleting or updating model database table data.
And fourthly, in the simulated 3D program, the simulated 3D program is automatically placed in the middle of a scene after the topography is imported, and the sky box is automatically adapted to the topography, so that all simulation models are ensured to be in the sky box, and the space outside the topography is invisible.
Fifth, when the simulation models of the transformer substation, the energy consumption equipment or the power generation equipment and the like are towed into the transformer substation, judging and calculating are started in a plurality of steps:
(1) According to the position of the center point, calculating the interference between the model and the Z value of the ground, wherein ZADD=Z (simulation model center point) -DZ (top standard height corresponding to the topography corresponding to the simulation model center point XY) <0, indicating that the interference occurs and not placing the model;
(2) If ZAdd >0, calculating an n-sided polygon of the outer contour of the model, wherein 3 equally dividing points (the equally dividing points can be freely set, wherein the least 2 equally dividing points are 2 endpoints, the different equally dividing points are different in calculation formula, the patent mainly comprises 3 equally dividing points), namely, calculating points m=n sides 3-sides 3 calculating points, and circulating m times, judging whether zaddi=zi (i calculating point bottom elevation) -DZi (i calculating point XY corresponds to the top elevation of the topography) is smaller than 0 one by one for each point, and stopping judging if any ZAddi <0 is interfered, and not placing the model;
(3) All ZADdi are larger than 0, the middle point of the judging points on the same side is continuously added, X=n (the number of sides) is newly added for 2 computing points, X times are circulated, whether ZADdi=Zi (the bottom elevation of the ith computing point) -DZi (the top elevation of the topography corresponding to the ith computing point XY) judged one by one for each point is smaller than 0 or not is judged, and as long as any ZADdi <0, interference is established, judgment is stopped, and a model is not placed. And if the X calculation points do not interfere, putting the model into the scene again to the terrain position dragged by the mouse. Through testing, the problem of 99% has been solved in general 1 time segmentation, and the special circumstances carries out the secondary segmentation, and the tertiary segmentation, and after judging, there is not the interference, satisfies the requirement of placing, places subaerial of topography, drags the bottom elevation Z value of model in the scene and adapts to the elevation on ground automatically, if certain point position judges to have river course, ditch, pond etc. topography material attribute, automatic stop judges, regard as can not placing.
And sixthly, judging whether the pulled-in position overlaps with the space position of the simulation models of the transformer substation, the energy consumption equipment, the power generation equipment and the like when the simulation models of the transformer substation, the energy consumption equipment, the power generation equipment and the like are pulled in. The judgment formula is as follows:
(1) Establishing a quadtree space model, wherein each drawing in an outer contour n-sided shape of a simulation model, 3 equally dividing points (the equally dividing points can be freely set, wherein the least 2 equally dividing points are 2 endpoints, the different equally dividing points have different calculation formulas, and the patent mainly comprises 3 equally dividing points) of each side are calculated, namely, the calculated points m=n sides are X and Y of a plurality of calculated points 3-side are stored in the quadtree;
(2) For each outline n-sided polygon of a simulation model to be dragged in, 3 equally dividing points (the equally dividing points can be freely set, wherein the least 2 equally dividing points are 2 endpoints, the different equally dividing points are different in calculation formula, the patent mainly comprises 3 equally dividing points), namely, the calculated point number m=n-sided number x 3-sided number of the calculated points are calculated one by one, whether the m calculated points fall into a polygon formed by a calculated point set of a certain model in a quadtree or not is calculated one by one, if the m calculated points fall into the certain model, the position interference is caused, if all the calculated points do not fall into the polygon, the m calculated points are added into the quadtree space model, whether the m calculated points interfere or not is judged, and the response time is improved.
The invention relates to a method for rapidly judging bit interference in a three-dimensional space scene when a model is arranged based on an OpenGL technology. When the models are placed in the 3D scene, position interference among simulation models and tangency among the models in the simulation scene caused by interference between the simulation models and the terrain can be prevented, and meanwhile rapidity of interference judgment is ensured.
According to the invention, through the combined analysis of the model characteristic data and the scene parameters, the rapid discrimination is carried out by adopting the quadtree space model, and the efficiency of simulation modeling training is improved. The invention can be used for space construction planning auxiliary decision-making of the micro-grid system.
Drawings
FIG. 1 is a flow chart of a scene interferometry method based on spatial position calculation.
Detailed Description
In order to more clearly illustrate the technical solution of the present invention, the drawings that are required to be used in the embodiments will be briefly described.
A scene interference rapid judging method based on OpenGL space position calculation is characterized in that model feature data and scene parameters are combined and analyzed, and rapid judgment is carried out by adopting a quadtree space model, and the method comprises the following steps:
firstly, a model database is built, the necessary fields include a unique field of the type of the record model, the topography, energy consumption equipment, a transformer substation or power generation equipment, correct calling in a program is ensured, and the model database is mainly used in simulation logic.
Secondly, when a simulation model is built, an origin (0, 0 point) is required to be in the center of a geometric figure, and when the simulation model is put in storage, the outline polygon envelope information of the model is automatically acquired into the database.
And thirdly, creating a model material management interface, so as to maintain model type fields in the database and realize the functions of adding, deleting or updating model database table data.
And fourthly, in the simulated 3D program, the simulated 3D program is automatically placed in the middle of a scene after the topography is imported, and the sky box is automatically adapted to the topography, so that all simulation models are ensured to be in the sky box, and the space outside the topography is invisible.
Fifth, when the simulation models of the transformer substation, the energy consumption equipment or the power generation equipment and the like are towed into the transformer substation, judging and calculating are started in a plurality of steps:
(1) According to the position of the center point, calculating the interference between the model and the Z value of the ground, wherein ZADD=Z (simulation model center point) -DZ (top standard height corresponding to the topography corresponding to the simulation model center point XY) <0, indicating that the interference occurs and not placing the model;
(2) If ZAdd >0, calculating an n-sided polygon of the outer contour of the model, wherein 3 equally dividing points (the equally dividing points can be freely set, wherein the least 2 equally dividing points are 2 endpoints, the different equally dividing points are different in calculation formula, the patent mainly comprises 3 equally dividing points), namely, calculating points m=n sides 3-sides 3 calculating points, and circulating m times, judging whether zaddi=zi (i calculating point bottom elevation) -DZi (i calculating point XY corresponds to the top elevation of the topography) is smaller than 0 one by one for each point, and stopping judging if any ZAddi <0 is interfered, and not placing the model;
(3) All ZADdi are larger than 0, the middle point of the judging points on the same side is continuously added, X=n (the number of sides) is newly added for 2 computing points, X times are circulated, whether ZADdi=Zi (the bottom elevation of the ith computing point) -DZi (the top elevation of the topography corresponding to the ith computing point XY) judged one by one for each point is smaller than 0 or not is judged, and as long as any ZADdi <0, interference is established, judgment is stopped, and a model is not placed. And if the X calculation points do not interfere, putting the model into the scene again to the terrain position dragged by the mouse. Through testing, the problem of 99% has been solved in general 1 time segmentation, and the special circumstances carries out the secondary segmentation, and the tertiary segmentation, and after judging, there is not the interference, satisfies the requirement of placing, places subaerial of topography, drags the bottom elevation Z value of model in the scene and adapts to the elevation on ground automatically, if certain point position judges to have river course, ditch, pond etc. topography material attribute, automatic stop judges, regard as can not placing.
And sixthly, judging whether the pulled-in position overlaps with the space position of the simulation models of the transformer substation, the energy consumption equipment, the power generation equipment and the like when the simulation models of the transformer substation, the energy consumption equipment, the power generation equipment and the like are pulled in. The judgment formula is as follows:
(1) Establishing a quadtree space model, wherein each drawing in an outer contour n-sided shape of a simulation model, 3 equally dividing points (the equally dividing points can be freely set, wherein the least 2 equally dividing points are 2 endpoints, the different equally dividing points have different calculation formulas, and the patent mainly comprises 3 equally dividing points) of each side are calculated, namely, the calculated points m=n sides are X and Y of a plurality of calculated points 3-side are stored in the quadtree;
(2) For each outline n-sided polygon of a simulation model to be dragged in, 3 equally dividing points (the equally dividing points can be freely set, wherein the least 2 equally dividing points are 2 endpoints, the different equally dividing points are different in calculation formula, the patent mainly comprises 3 equally dividing points), namely, the calculated point number m=n-sided number x 3-sided number of the calculated points are calculated one by one, whether the m calculated points fall into a polygon formed by a calculated point set of a certain model in a quadtree or not is calculated one by one, if the m calculated points fall into the certain model, the position interference is caused, if all the calculated points do not fall into the polygon, the m calculated points are added into the quadtree space model, whether the m calculated points interfere or not is judged, and the response time is improved.
The invention relates to a method for rapidly judging bit interference in a three-dimensional space scene when a model is arranged based on an OpenGL technology. When the model is placed in the 3D scene,
according to the invention, through the combined analysis of the model characteristic data and the scene parameters, the position interference among simulation models can be prevented by adopting the quadtree space model to carry out rapid judgment, and the phase cut among the models in the simulation scene is caused after the simulation models interfere with the terrain, so that the rapidity of judging the interference is ensured.
Claims (3)
1. A scene interference rapid judging method based on OpenGL space position calculation is characterized by comprising the following steps: through the joint analysis of model characteristic data and scene parameters, the rapid discrimination is carried out by adopting a quadtree space model, and the method is specifically as follows:
firstly, establishing a model database, wherein necessary fields include a unique field of the type of a record model, topography, energy consumption equipment, a transformer substation or power generation equipment, so that correct calling in a program is ensured;
secondly, when a simulation model is built, the origin must be in the geometric figure center, and when the simulation model enters a warehouse, the outer outline polygon envelope information of the model is automatically acquired into the database;
thirdly, creating a model material management interface, so as to maintain model type fields in the database and realize the functions of adding, deleting or updating model database table data;
fourthly, in the simulated 3D program, the simulated 3D program is automatically placed in the middle of a scene after the topography is imported, and the sky box is automatically adapted to the topography, so that all simulation models are ensured to be in the sky box, and the space outside the topography is invisible;
fifth, when the transformer substation, the energy consumption equipment or the power generation equipment simulation model is towed into, judging and calculating are started in a plurality of steps:
(1) According to the position of the center point, calculating interference between the model and the ground Z value, wherein ZADD=Z-DZ <0, indicating that interference occurs and the model is not placed, Z is the center point of the simulation model, and DZ is the top height corresponding to the topography corresponding to the center point XY of the simulation model;
(2) If ZAdd >0, calculating an n-sided polygon of the outline of the model, wherein each side is 3 equally divided points, namely, the number of calculation points m=n sides is 3-the number of calculation points, circulating for m times, judging whether zaddi=zi-DZi which is judged one by one for each point is smaller than 0, stopping judging, and not placing the model as long as any one of the ZAddi <0 is interference, wherein Zi is the bottom elevation of the ith calculation point, and DZi is the top elevation of the terrain corresponding to the ith calculation point XY;
(3) All ZADdi are larger than 0, the midpoint of the judging points on the same side is continuously added, X=n×2 computing points are newly added, the cycle is repeated for X times, whether the ZADdi judged one by one for each point is smaller than 0 or not is judged, and if any ZADdi is smaller than 0, the interference is established, the judgment is stopped, and a model is not placed; if none of the X calculation points interfere, putting the model into the scene to the position of the terrain dragged by the mouse; after the judgment is finished, no interference exists, the placement requirement is met, the ground of the topography is placed, the Z value of the bottom elevation of the model dragged into the scene is automatically adapted to the elevation of the ground, and if the material properties of the topography of the river channel, the canal and the pond are judged at a certain point position, the judgment is automatically stopped, and the topography can not be placed;
sixthly, when the transformer substation is towed, the energy consumption equipment or the power generation equipment simulation model is towed, whether the towed position is overlapped with the space position of the towed transformer substation, the energy consumption equipment or the power generation equipment simulation model is towed, and the mode of a judging formula is as follows:
(1) Establishing a quadtree space model, dragging an outer contour n-sided shape of a simulation model, and storing 3 equally dividing points of each side, namely X and Y of a plurality of calculation points m=n sides 3-sides into the quadtree;
(2) For the n-sided shape of the outer contour of each simulation model to be dragged in, each side 3 is divided into equal points, namely, the calculated point number m=n side number 3-side number calculated points are calculated, whether the m calculated points fall into a polygon formed by a calculated point set of a certain model in a quadtree or not is calculated one by one, and if the calculated points fall into a certain model, the positions interfere; if all the calculation points do not fall into the polygon, adding the calculation points into a quadtree space model, and judging whether the calculation points interfere or not.
2. The rapid scene interference judging method based on OpenGL space position calculation according to claim 1, wherein: when each side 3 is divided into equal points, the equal points are freely set, wherein at least 2 equal points are arranged, 2 equal points are 2 end points, and the calculation formulas of different equal points are different.
3. The rapid scene interference judging method based on OpenGL space position calculation according to claim 1, wherein: and through the combined analysis of the model characteristic data and the scene parameters, the rapid discrimination is carried out by adopting a quadtree space model, and the efficiency of simulation modeling training is improved.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910879644.5A CN110807240B (en) | 2019-09-18 | 2019-09-18 | OpenGL-based scene interference rapid judgment method for space position calculation |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910879644.5A CN110807240B (en) | 2019-09-18 | 2019-09-18 | OpenGL-based scene interference rapid judgment method for space position calculation |
Publications (2)
Publication Number | Publication Date |
---|---|
CN110807240A CN110807240A (en) | 2020-02-18 |
CN110807240B true CN110807240B (en) | 2023-05-12 |
Family
ID=69487546
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201910879644.5A Active CN110807240B (en) | 2019-09-18 | 2019-09-18 | OpenGL-based scene interference rapid judgment method for space position calculation |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN110807240B (en) |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107610233A (en) * | 2017-09-15 | 2018-01-19 | 中国人民解放军63816部队 | A kind of simulating scenes construction method based on outdoor scene |
CN107679281A (en) * | 2017-09-05 | 2018-02-09 | 国家电网公司 | Intelligent station three-dimensional scenic analogue system and implementation method based on Unity dynamic generations |
CN108038910A (en) * | 2017-11-10 | 2018-05-15 | 广东电网有限责任公司教育培训评价中心 | The implementation method of substation's main equipment Virtual Reality Demonstration |
-
2019
- 2019-09-18 CN CN201910879644.5A patent/CN110807240B/en active Active
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107679281A (en) * | 2017-09-05 | 2018-02-09 | 国家电网公司 | Intelligent station three-dimensional scenic analogue system and implementation method based on Unity dynamic generations |
CN107610233A (en) * | 2017-09-15 | 2018-01-19 | 中国人民解放军63816部队 | A kind of simulating scenes construction method based on outdoor scene |
CN108038910A (en) * | 2017-11-10 | 2018-05-15 | 广东电网有限责任公司教育培训评价中心 | The implementation method of substation's main equipment Virtual Reality Demonstration |
Also Published As
Publication number | Publication date |
---|---|
CN110807240A (en) | 2020-02-18 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN109359351B (en) | Three-dimensional modeling method for pipeline and pipeline design method | |
CN101582173B (en) | Block model building method for complex geological structure | |
CN109685914A (en) | Cutting profile based on triangle grid model mends face algorithm automatically | |
CN102819865A (en) | Modeling method for magnetotelluric three-dimensional geologic structure model | |
CN102867091B (en) | The quantitation modification method of a kind of electric network current diagram | |
CN104751505A (en) | Three-dimensional scene rendering algorithm based on LOD (Levels of Detail) model and quadtree level structure | |
CN103226841B (en) | Based on the substation visual method for commissioning of virtual reality technology | |
CN106600617A (en) | Method of extracting building contour line from Lidar point cloud data based on curvature | |
CN109213169A (en) | The paths planning method of mobile robot | |
CN113152985B (en) | Ultra-wideband virtual electronic fence monitoring method for substation reconstruction and extension construction | |
CN103020335A (en) | Method for automatically converting distribution network geographic wiring diagram into region orthogonal diagram | |
CN111090792B (en) | Automatic mapping method for single line diagram of power distribution network based on weight tree | |
CN107909644A (en) | A kind of substation equipment 3 d model library method for building up | |
CN106023311B (en) | Improve the method that dimensional topography generates precision | |
CN105373661B (en) | A kind of power grid thematic map layout method based on dynamic programming algorithm | |
CN110807240B (en) | OpenGL-based scene interference rapid judgment method for space position calculation | |
CN102622467A (en) | Method for automatic division of three-dimensional finite element mesh comprising multiple components | |
CN105894174A (en) | Power system mobile internet cloud computing platform and scheduling and data analysis method | |
CN110349262A (en) | A kind of tunnel geological forecast three-dimensional modeling method and system based on BIM | |
CN110216664A (en) | Obstacle recognition method and device based on point cloud data | |
CN104392384B (en) | Substation project two-stage quantities synchronously calculates system and method | |
CN105678844A (en) | Contour construction algorithm on the basis of point by point increasing of ground object scattered points | |
CN107069698A (en) | A kind of power system load modeling method based on particle cluster algorithm | |
Zhan | Research on path planning method of humanoid robot based on improved genetic algorithm | |
CN115544634B (en) | Oil and gas field level digital twin model space coordinate transformation method and system |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |