CN110807240A - OpenGL-based scene interference rapid judgment method for spatial position calculation - Google Patents
OpenGL-based scene interference rapid judgment method for spatial position calculation Download PDFInfo
- Publication number
- CN110807240A CN110807240A CN201910879644.5A CN201910879644A CN110807240A CN 110807240 A CN110807240 A CN 110807240A CN 201910879644 A CN201910879644 A CN 201910879644A CN 110807240 A CN110807240 A CN 110807240A
- Authority
- CN
- China
- Prior art keywords
- model
- points
- terrain
- calculation
- simulation
- 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.)
- Granted
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 spatial position calculation, which performs rapid judgment by adopting a quadtree spatial model through joint analysis of model characteristic data and scene parameters. Establishing a model database, and automatically acquiring the information of the outer contour polygon enveloping body of the model into the database; creating a model material management interface, automatically putting the model material management interface in the middle of a scene after introducing terrain in a simulated 3D program, automatically adapting the sky box to the terrain, and making the space outside the terrain invisible; when the simulation model of the transformer substation, the energy consumption equipment or the power generation equipment is dragged into, the judgment calculation is started in several steps, and the dragged position is judged whether to be overlapped with the space position of the simulation model of the energy consumption equipment or the power generation equipment which is dragged into the transformer substation. The method can prevent the position interference between simulation models and the tangency between the models in a simulation scene after the simulation models interfere with the terrain, and simultaneously ensure the rapidity of judging the interference.
Description
Technical Field
The invention relates to a method for quickly judging bit interference when a model is arranged in a 3D space scene based on an OpenGL technology, in particular to a method for quickly judging scene interference based on space position calculation of OpenGL.
Background
In a micro-grid simulation 3D program realized based on the OpenGL technology, complex terrain, various power generation equipment, various energy consumption equipment such as buildings and factories, a transformer substation, a main network and other simulation models are established according to actual proportions, and the models are generally called as simulation models in follow-up, so that when the models are placed in a 3D scene, the models in the simulation scene are prevented from being tangent after the simulation models are involved in positions and the terrain interferes, and the rapidity of interference judgment is ensured.
In a simulation environment in a 3D program for micro-grid simulation, terrains are built by a user according to actual terrains to be simulated, and when simulation models such as rivers, mountains and the like are dragged and dropped onto the terrains in a simulation scene, requirements for mutual embedding cannot be met. Since the terrain and energy consumption model is as follows 1: 1, the appearance is very complicated, and the simulation model is put to the relatively level position of putting on the topography, can not put to positions such as river course, ditch, pond. The method for judging interference cannot be judged by using simple Boolean, even if the corresponding terrain position of the arranged model has no river channel, the judgment is carried out by using the Boolean, the consumed time is long, the blockage is severe, the operation is too fast, the software is broken down and quit, meanwhile, due to the complex appearance, the judgment cannot be carried out by using an AABB envelope frame, otherwise, any simulation model cannot be placed on the mountainous terrain, or a series of problems that no obvious position interference exists among the simulation models, the misjudgment interference exists and the like are caused.
Disclosure of Invention
The invention aims to provide a scene interference quick judgment method based on OpenGL space position calculation, which can ensure the rapidity of judgment interference, improve the efficiency of simulation modeling training and can be used for auxiliary decision of space construction planning of a micro-grid system.
The purpose of the invention is realized by the following technical scheme:
a scene interference quick judgment method based on OpenGL spatial position calculation is characterized by comprising the following steps: through the joint analysis of model characteristic data and scene parameters, the quick discrimination is carried out by adopting a quadtree space model, which is specifically as follows:
the method comprises the following steps of firstly, establishing a model database, wherein necessary fields comprise fields which record the type of a model and are unique, terrain, energy consumption equipment, a transformer substation or power generation equipment, ensuring correct calling in a program and being mainly used in simulation logic.
And secondly, when a model in the model database is built, the original point (0, 0 point) is required to be in the center of the geometric figure, and when the simulation model is put in a storage, the information of the outline polygon enveloping body of the model is automatically acquired into the database.
And thirdly, creating a model material management interface, maintaining the model type fields in the database, and realizing the functions of adding, deleting or updating the database table data of the model database.
And fourthly, in the simulated 3D program, the simulation model is automatically placed in the middle of the scene after the terrain is introduced, and the sky box is automatically adapted to the terrain, so that all the simulation models are ensured to be in the sky box, and the space outside the terrain is invisible.
And fifthly, when the simulation model such as a transformer substation, energy consumption equipment or power generation equipment is dragged into, judging and calculating are started in several steps:
(1) calculating the interference between the model and the ground Z value according to the position of the central point, wherein ZAdd = Z (the central point of the simulation model) -DZ (the top elevation corresponding to the terrain at the central point XY of the simulation model) is less than 0, and the interference is generated and the model is not placed;
(2) if ZAdd >0, calculating an n-edge shape of the outer contour of the model, wherein each side is 3 equally divided points (at least 2 equally divided points can be freely set, 2 equally divided points are 2 end points, different equally divided points are different, calculation formulas are different, the patent mainly takes 3 equally divided points as main parts), namely the number of calculation points m = n sides x 3-side several calculation points, circulating for m times, and judging whether ZAddi = Zi (bottom elevation of the ith calculation point) to DZi (top elevation of the terrain corresponding to the ith calculation point XY) of each point one by one is less than 0 or not as long as any ZAddi <0, interference is established, judgment is stopped, and the model is not placed;
(3) and if any ZAddi is less than 0, interference is established, judgment is stopped, and the model is not placed. If the X calculation points do not interfere with each other, the model is placed in the scene again to the terrain position dragged by the mouse. Through the test, generally 1 time of segmentation has solved 99% problem, and the special condition carries out the secondary and cuts apart, and the cubic is cut apart, judges the back, and no interference satisfies and places the requirement, places the subaerial of topography, drags into the elevation on the ground of the automatic adaptation of the bottom elevation Z value of the model in the scene, if certain position location judges that there is the topography material attribute such as river course, ditch, pond, the automatic stop is judged, regards as can not place.
And sixthly, judging whether the dragged position is overlapped with the space position of the simulation models of the transformer substation, the energy consumption equipment or the power generation equipment and the like dragged into the simulation models of the transformer substation, the energy consumption equipment or the power generation equipment and the like. The formula is judged as follows:
(1) establishing a quadtree space model, and when an outer contour n-polygon of a simulation model is dragged, 3 equally dividing points of each edge (equally dividing points can be freely set, wherein at least 2 equally dividing points are adopted, 2 equally dividing points are 2 end points, different equally dividing points are adopted, a calculation formula is different, the patent mainly takes 3 equally dividing points as a main part), namely, the number of calculation points m = n, the number of edges is 3-X and Y of a plurality of calculation points are stored in a quadtree;
(2) for the n-polygon outer contour of each simulation model to be dragged, 3 equi-division points on each side (equi-division points can be freely set, wherein at least 2 equi-division points are 2 end points, different equi-division points are different, the calculation formula is different, the patent mainly takes 3 equi-division points as main points), namely the number of calculation points m = n sides x 3-side several calculation points, whether the m calculation points fall in a polygon formed by a set of calculation points of a certain model in a quadtree or not is calculated one by one, if the m calculation points fall in the certain model, the positions are interfered, if all the calculation points do not fall in the polygon, the m calculation points are added into the quadtree space model, whether the interference exists or not is judged, and the response time is improved.
The invention relates to a method for quickly judging bit interference when a model is arranged in a three-dimensional space scene based on an OpenGL technology. When the model is placed in a 3D scene, the position interference among simulation models can be prevented, and after the simulation models interfere with terrain, the models in the simulation scene are tangent, and meanwhile, the rapidity of judging the interference is ensured.
According to the method, the efficiency of simulation modeling training is improved by jointly analyzing the model characteristic data and the scene parameters and quickly judging by adopting the quadtree space model. The method can be used for auxiliary decision of space construction planning of the micro-grid system.
Drawings
FIG. 1 is a flow chart of a scene interference method based on spatial position calculation.
Detailed Description
In order to more clearly explain the technical solution of the present invention, the drawings used in the embodiments will be briefly described below.
A scene interference quick judgment method based on OpenGL spatial position calculation is characterized in that model characteristic data and scene parameters are jointly analyzed, a quad-tree spatial model is adopted for quick judgment, and the method specifically comprises the following steps:
the method comprises the following steps of firstly, establishing a model database, wherein necessary fields comprise fields which record the type of a model and are unique, terrain, energy consumption equipment, a transformer substation or power generation equipment, ensuring correct calling in a program and being mainly used in simulation logic.
And secondly, when a model in the model database is built, the original point (0, 0 point) is required to be in the center of the geometric figure, and when the simulation model is put in a storage, the information of the outline polygon enveloping body of the model is automatically acquired into the database.
And thirdly, creating a model material management interface, maintaining the model type fields in the database, and realizing the functions of adding, deleting or updating the database table data of the model database.
And fourthly, in the simulated 3D program, the simulation model is automatically placed in the middle of the scene after the terrain is introduced, and the sky box is automatically adapted to the terrain, so that all the simulation models are ensured to be in the sky box, and the space outside the terrain is invisible.
And fifthly, when the simulation model such as a transformer substation, energy consumption equipment or power generation equipment is dragged into, judging and calculating are started in several steps:
(1) calculating the interference between the model and the ground Z value according to the position of the central point, wherein ZAdd = Z (the central point of the simulation model) -DZ (the top elevation corresponding to the terrain at the central point XY of the simulation model) is less than 0, and the interference is generated and the model is not placed;
(2) if ZAdd >0, calculating an n-edge shape of the outer contour of the model, wherein each side is 3 equally divided points (at least 2 equally divided points can be freely set, 2 equally divided points are 2 end points, different equally divided points are different, calculation formulas are different, the patent mainly takes 3 equally divided points as main parts), namely the number of calculation points m = n sides x 3-side several calculation points, circulating for m times, and judging whether ZAddi = Zi (bottom elevation of the ith calculation point) to DZi (top elevation of the terrain corresponding to the ith calculation point XY) of each point one by one is less than 0 or not as long as any ZAddi <0, interference is established, judgment is stopped, and the model is not placed;
(3) and if any ZAddi is less than 0, interference is established, judgment is stopped, and the model is not placed. If the X calculation points do not interfere with each other, the model is placed in the scene again to the terrain position dragged by the mouse. Through the test, generally 1 time of segmentation has solved 99% problem, and the special condition carries out the secondary and cuts apart, and the cubic is cut apart, judges the back, and no interference satisfies and places the requirement, places the subaerial of topography, drags into the elevation on the ground of the automatic adaptation of the bottom elevation Z value of the model in the scene, if certain position location judges that there is the topography material attribute such as river course, ditch, pond, the automatic stop is judged, regards as can not place.
And sixthly, judging whether the dragged position is overlapped with the space position of the simulation models of the transformer substation, the energy consumption equipment or the power generation equipment and the like dragged into the simulation models of the transformer substation, the energy consumption equipment or the power generation equipment and the like. The formula is judged as follows:
(1) establishing a quadtree space model, and when an outer contour n-polygon of a simulation model is dragged, 3 equally dividing points of each edge (equally dividing points can be freely set, wherein at least 2 equally dividing points are adopted, 2 equally dividing points are 2 end points, different equally dividing points are adopted, a calculation formula is different, the patent mainly takes 3 equally dividing points as a main part), namely, the number of calculation points m = n, the number of edges is 3-X and Y of a plurality of calculation points are stored in a quadtree;
(2) for the n-polygon outer contour of each simulation model to be dragged, 3 equi-division points on each side (equi-division points can be freely set, wherein at least 2 equi-division points are 2 end points, different equi-division points are different, the calculation formula is different, the patent mainly takes 3 equi-division points as main points), namely the number of calculation points m = n sides x 3-side several calculation points, whether the m calculation points fall in a polygon formed by a set of calculation points of a certain model in a quadtree or not is calculated one by one, if the m calculation points fall in the certain model, the positions are interfered, if all the calculation points do not fall in the polygon, the m calculation points are added into the quadtree space model, whether the interference exists or not is judged, and the response time is improved.
The invention relates to a method for quickly judging bit interference when a model is arranged in a three-dimensional space scene based on an OpenGL technology. When a model is placed in a 3D scene,
according to the method, through the combined analysis of the model characteristic data and the scene parameters and the rapid judgment by adopting the quadtree space model, the position interference among simulation models can be prevented, and the tangency among the models in the simulation scene can be prevented after the simulation models are interfered with the terrain, and meanwhile, the rapidity of judging the interference is ensured.
Claims (3)
1. A scene interference quick judgment method based on OpenGL spatial position calculation is characterized by comprising the following steps: through the joint analysis of model characteristic data and scene parameters, the quick discrimination is carried out by adopting a quadtree space model, which is specifically as follows:
firstly, establishing a model database, wherein necessary fields comprise fields with unique types for recording models, terrain, energy consumption equipment, transformer substations and power generation equipment, and ensuring correct calling in a program;
secondly, when a simulation model is established, the original point is necessarily at the center of the geometric figure, and when the simulation model is put in a warehouse, the outline polygon enveloping body information of the model is automatically acquired into the database;
thirdly, a model material management interface is created, maintenance of model type fields in the database is achieved, and functions of adding, deleting or updating data of the database table of the model are achieved;
fourthly, in the simulated 3D program, the terrain is automatically placed in the middle of the scene after being imported, and the sky box is automatically adapted to the terrain, so that all simulation models are ensured to be in the sky box, and the space outside the terrain is invisible;
and fifthly, when the simulation model of the transformer substation, the energy consumption equipment or the power generation equipment is dragged into, judging and calculating are started in several steps:
(1) calculating interference between the model and a ground Z value according to the position of the central point, wherein ZAdd = Z-DZ <0, and indicating that the interference occurs and the model is not placed, wherein Z is the central point of the simulation model, and DZ is the height of the top mark corresponding to the terrain corresponding to the central point XY of the simulation model;
(2) if ZAdd >0, calculating an n-edge shape of the outer contour of the model, equally dividing each edge by 3, namely calculating the number of points m = n-edge number x 3-edge number of calculation points, circulating m times, judging whether ZAddi = Zi-DZi of each point one by one is smaller than 0, if any ZAddi is smaller than 0, stopping judging and not placing the model, 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 middle points of the judging points on the same original edge are continuously added, X = n × 2 calculating points are newly added, the operation is repeated for X times, whether the ZAddi which is judged one by one for each point is smaller than 0 is judged, and as long as any ZAddi is smaller than 0, the interference is established, the judgment is stopped, and the model is not placed; if the X calculation points do not interfere with each other, putting the model into the scene again to the terrain position dragged by the mouse; after the determination is finished, no interference exists, the placement requirement is met, the model is placed on the ground of the terrain, the bottom elevation Z value of the model dragged into the scene is automatically matched with the elevation of the ground, if the property of the terrain material of a river channel, a water channel and a pond is determined at a certain point position, the determination is automatically stopped, and the model is determined as not capable of being placed;
and sixthly, judging the dragged position when dragging the transformer substation and the energy consumption equipment or power generation equipment simulation model, and judging whether the dragged position is overlapped with the space position of the dragged transformer substation and the energy consumption equipment or power generation equipment simulation model, wherein the judgment formula mode is as follows:
(1) establishing a quadtree space model, and storing X and Y of a plurality of calculation points of each side 3 equal division points, namely the number of calculation points m = n sides X3-sides, into a quadtree, when an outer contour n-polygon of a simulation model is dragged;
(2) for n polygons of the outer contour of each simulation model to be dragged, 3 equal points on each side, namely the number of calculation points m = n sides x 3-sides, calculating whether m calculation points fall in a polygon formed by a set of calculation points of a certain model in a quadtree one by one, and if the m calculation points fall in the certain model, performing position interference; if all the calculation points do not fall into the polygon, adding the calculation points into a quadtree space model, and judging whether the interference exists.
2. The OpenGL-based scene interference quick determination method according to claim 1, wherein: when each side is divided into 3 equal points, equal division points are freely set, wherein at least 2 equal division points are provided, 2 equal division points are 2 end points, different equal division points have different calculation formulas.
3. The OpenGL-based scene interference quick determination method according to claim 1, wherein: by means of combined analysis of model characteristic data and scene parameters and by means of adopting a quadtree space model to perform rapid discrimination, 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 true CN110807240A (en) | 2020-02-18 |
CN110807240B 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 |
---|---|
CN110807240B (en) | 2023-05-12 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN101582173B (en) | Block model building method for complex geological structure | |
CN109359351B (en) | Three-dimensional modeling method for pipeline and pipeline design method | |
CN105022865B (en) | A kind of fuel tanker inner surface model extraction method based on STL model boolean operations | |
CN105320811A (en) | Method for establishing topological connected model of urban underground electricity pipe network | |
CN104751505A (en) | Three-dimensional scene rendering algorithm based on LOD (Levels of Detail) model and quadtree level structure | |
CN102819865A (en) | Modeling method for magnetotelluric three-dimensional geologic structure model | |
CN102393926B (en) | Intelligent decision-making method of safe route for underground emergent people evacuation | |
CN102254350A (en) | 3D (three-dimensional) model matching method | |
CN102867091B (en) | The quantitation modification method of a kind of electric network current diagram | |
CN106023311B (en) | Improve the method that dimensional topography generates precision | |
CN105261067A (en) | Overground and underground integrated modeling method based on true 3D volumetric display technique and system | |
CN106714193A (en) | Settling deploying method for underwater sensor nodes based on ideal pattern model | |
CN108647607A (en) | Objects recognition method for project of transmitting and converting electricity | |
CN105335478B (en) | The method and apparatus for building urban land space multistory survey data semantic association | |
CN102141587A (en) | Lightening locating data imaging method | |
CN110807240A (en) | OpenGL-based scene interference rapid judgment method for spatial position calculation | |
CN110349262A (en) | A kind of tunnel geological forecast three-dimensional modeling method and system based on BIM | |
CN106373192B (en) | A kind of non-topological coherence three-dimensional grid block tracing algorithm | |
CN115544634B (en) | Oil and gas field level digital twin model space coordinate transformation method and system | |
CN103987077B (en) | wireless network simulation method and device | |
CN113140038B (en) | Real-time three-dimensional visualization method for large-scene urban building | |
CN114154277B (en) | Gathering and transportation system layout optimization method, device and equipment | |
CN109640333A (en) | Underwater wireless sensor network covering loophole based on assemblage classification repairs algorithm | |
KR102243453B1 (en) | Method for updating urban flood maps using river spatial topology, and recording medium thereof | |
CN111681314B (en) | Virtual contour constraint-based fourth-system covering layer three-dimensional modeling method |
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 |