CN113570718B - Terrain self-adaptation method and device of line model, electronic equipment and storage medium - Google Patents
Terrain self-adaptation method and device of line model, electronic equipment and storage medium Download PDFInfo
- Publication number
- CN113570718B CN113570718B CN202110866849.7A CN202110866849A CN113570718B CN 113570718 B CN113570718 B CN 113570718B CN 202110866849 A CN202110866849 A CN 202110866849A CN 113570718 B CN113570718 B CN 113570718B
- Authority
- CN
- China
- Prior art keywords
- height
- distance
- pixel point
- curve
- unit
- 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
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T17/00—Three dimensional [3D] modelling, e.g. data description of 3D objects
- G06T17/05—Geographic models
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T19/00—Manipulating 3D models or images for computer graphics
-
- Y—GENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02A—TECHNOLOGIES FOR ADAPTATION TO CLIMATE CHANGE
- Y02A90/00—Technologies having an indirect contribution to adaptation to climate change
- Y02A90/10—Information and communication technologies [ICT] supporting adaptation to climate change, e.g. for weather forecasting or climate simulation
Landscapes
- Engineering & Computer Science (AREA)
- Physics & Mathematics (AREA)
- Software Systems (AREA)
- Geometry (AREA)
- Computer Graphics (AREA)
- General Physics & Mathematics (AREA)
- Theoretical Computer Science (AREA)
- Remote Sensing (AREA)
- Computer Hardware Design (AREA)
- General Engineering & Computer Science (AREA)
- Processing Or Creating Images (AREA)
Abstract
The application provides a terrain self-adaptation method and device of a line model, electronic equipment and a storage medium, and relates to the technical field of simulation. The method comprises the steps of determining the distance between each pixel point in the topographic elevation map and each section of path line segment of the topographic curve, calculating the distance proportion between each pixel point in the topographic elevation map and the nearest topographic curve line segment, correcting the distance proportion corresponding to the pixel point at the height nearest to the topographic curve line segment, calculating the reference height of each pixel point at the height, and determining the final height of each pixel point at the height based on the original height of the pixel point at the height, the difference between the reference height of the pixel point at the height and the original height, the corrected distance proportion and the offset distance of the path point in the vertical direction, so as to obtain the latest topographic elevation map, and generating a topographic model matched with the line model according to the latest topographic elevation map. The scheme provided by the application can automatically generate the terrain model matched with the line model of the project, and reduce the workload related to the road matching terrain.
Description
Technical Field
The present disclosure relates to the field of simulation technologies, and in particular, to a terrain adaptive method and apparatus for a line model, an electronic device, and a storage medium.
Background
In the engineering field, in order to facilitate the visual understanding of engineering conditions, a unit engineering line model is often added on a terrain model through a Unity3D engine for rendering and displaying.
At present, when a line model of unit engineering is added on a terrain model for rendering and displaying, terrain is mostly adjusted in a manual mode, so that the line model is matched with the terrain model. However, this approach greatly increases the amount of work associated with the line matching terrain, and presents a significant inconvenience to the engineering line model presentation.
Therefore, how to provide an effective solution to simply and conveniently realize the display of the engineering line model and reduce the related workload becomes a problem to be solved in the prior art.
Disclosure of Invention
In a first aspect, an embodiment of the present application provides a terrain adaptive method of a line model, including:
determining the maximum relief offset distance and the maximum height deviation proportion of the unit project corresponding to the line model based on the project type of the unit project corresponding to the line model;
shifting the path points in the path curve corresponding to the line model in the vertical direction based on the maximum relief offset distance and the maximum height deviation proportion to obtain a relief curve of unit engineering;
extracting a terrain elevation map of the area where the unit engineering is located according to the original terrain data in the Unity3D engine;
determining the distance between each pixel point in the terrain elevation map and each path segment of the terrain curve, wherein the distance between each pixel point and each path segment of the terrain curve is the horizontal distance between each pixel point and each path segment of the terrain curve;
selecting a path line segment with the minimum value and the corresponding distance within a preset range from the distances between each pixel point in the topographic elevation map and each path line segment of the topographic curve as a reference path line segment of the elevation pixel point;
calculating the distance ratio of each pixel point to the nearest topography curve line segment in the height map, wherein the distance ratio of each pixel point to the nearest topography curve line segment in the height map is 1- (distance/maxRange), the distance is the distance between the pixel point and the nearest topography curve line segment, and the maxRange is the offset distance between the pixel points;
correcting the distance proportion corresponding to the height pixel point nearest to the relief curve line segment through a cosine curve algorithm;
calculating the reference height of each height pixel point, wherein the reference height of each height pixel point is the position height of the height pixel point projected onto a line segment with the shortest distance to the height pixel point in the topography curve;
determining the final height of each high-level pixel point based on the original height of each high-level pixel point, the difference between the reference height and the original height of each high-level pixel point, the corrected distance proportion and the offset distance of the path point in the vertical direction, so as to obtain the latest topographic height map;
and regenerating a terrain model matched with the line model according to the latest terrain height map.
In one possible design, the engineering type of the unit engineering corresponding to the line model is one of a roadbed, a bridge and a tunnel, and the determining the maximum topography offset distance and the maximum height offset ratio of the unit engineering corresponding to the line model based on the engineering type of the unit engineering corresponding to the line model includes:
if the engineering type of the unit engineering corresponding to the line model is roadbed, the maximum topography offset distance and the maximum height deviation ratio of the unit engineering corresponding to the line model are both 0;
if the engineering type of the unit engineering corresponding to the line model is a bridge, the maximum relief offset distance of the unit engineering corresponding to the line model is the distance between the bridge and the bearing platform, and the maximum height deviation proportion of the unit engineering corresponding to the line model is-0.5 sin (x Pi);
if the engineering type of the unit engineering corresponding to the line model is a tunnel, the maximum relief offset distance of the unit engineering corresponding to the line model is half of the head-tail distance of the line model, and the maximum height deviation ratio of the unit engineering corresponding to the line model is 0.5 sin (x Pi);
wherein x is the ratio of the distance from the current position to the starting point of the path curve to the total length of the path curve.
In one possible design, the offset distance of the path point in the vertical direction in the path curve corresponding to the line model is maxHeftOffsetTio, where maxHeftOffset is the maximum topography offset distance of the unit project corresponding to the line model, and HeftOffsetTio is the maximum height deviation ratio of the unit project corresponding to the line model.
In one possible design, the calculating the distance ratio between each pixel point and the nearest topography curve line segment in the height map includes:
calculating the offset distance of each pixel point in the topographic elevation map;
calculating the minimum distance between each pixel point in the topographic elevation map and the nearest topographic curve line segment;
and obtaining the distance proportion between each pixel point in the topographic elevation map and the line segment of the topography curve according to the offset distance between each pixel point in the topographic elevation map and the minimum distance between each pixel point in the topographic elevation map and the line segment of the nearest topography curve.
In one possible design, the modified distance ratio is 0.5X (cos (X Pi) +1), where X is the distance ratio corresponding to the high pixel nearest to the path curve.
In one possible design, the final height of the height pixel is positionws.y+ (targetHeight-positionws.y) ×rate+height offset, where positionws.y is the original height of the height pixel, targetHeight is the reference height of the height pixel, rate is the corrected distance ratio, and height offset is the offset distance of the path point in the vertical direction.
In one possible design, the method further comprises:
and calculating the coordinates of each pixel point in the topographic elevation map based on the pixel coordinates of each pixel point in the topographic elevation map and the offset distance of the pixel points.
In a second aspect, an embodiment of the present application provides a terrain adaptive device of a line model, including:
the first determining unit is used for determining the maximum relief offset distance and the maximum height deviation proportion of the unit project corresponding to the line model based on the project type of the unit project corresponding to the line model;
the deviation unit is used for deviating the path points in the path curve corresponding to the line model in the vertical direction based on the maximum relief deviation distance and the maximum height deviation proportion to obtain a relief curve of unit engineering;
the extraction unit is used for extracting a terrain elevation map of the area where the unit engineering is located according to the original terrain data in the Unity3D engine;
the second determining unit is used for determining the distance between each pixel point in the terrain elevation map and each path segment of the terrain curve, wherein the distance between the pixel point and each path segment of the terrain curve is the horizontal distance between the pixel point and each path segment of the terrain curve;
the selecting unit is used for selecting a path line segment with the minimum value, the corresponding distance of which is within a preset range, from the distances between each pixel point in the topographic elevation map and each path line segment of the topographic curve as a reference path line segment of the elevation pixel point;
the first calculation unit is used for calculating the distance ratio of each pixel point to the nearest topography curve line segment in the height map, wherein the distance ratio of each pixel point to the nearest topography curve line segment in the height map is 1- (distance/maxRange), the distance is the distance between the pixel point and the nearest topography curve line segment, and the maxRange is the offset distance between the pixel points;
the correction unit is used for correcting the distance proportion corresponding to the height pixel point nearest to the path curve through a cosine curve algorithm;
the second calculation unit is used for calculating the reference height of each height pixel point, wherein the reference height of each height pixel point is the position height of the height pixel point projected onto a line segment with the shortest distance to the height pixel point in the relief curve;
the third determining unit is used for determining the final height of each high-level pixel point based on the original height of each high-level pixel point, the difference between the reference height of each high-level pixel point and the original height, the corrected distance proportion and the offset distance of the path point in the vertical direction so as to obtain the latest topography height map;
and the generating unit is used for regenerating a terrain model matched with the line model according to the latest terrain height map.
In a third aspect, an embodiment of the present application provides an electronic device, including a processor, a communication interface, a memory, and a communication bus, where the processor, the communication interface, and the memory complete communication with each other through the bus;
a memory for storing a computer program;
and the processor is used for executing the program stored in the memory and realizing the terrain self-adaptation method of the line model.
In a fourth aspect, embodiments of the present application provide a computer readable storage medium having a computer program stored therein, which when executed by a processor, implements a terrain adaptation method of a line model as described in any of the above.
The above-mentioned at least one technical scheme that one or more embodiments of this application adopted can reach following beneficial effect:
the method comprises the steps of calculating the distance proportion between each pixel point and the nearest topography curve line segment in a height map, selecting the path line segment with the minimum value, which corresponds to the distance within a preset range, as a reference path line segment of each height pixel point, calculating the distance proportion between each pixel point and the nearest topography curve line segment in the height map, correcting the distance proportion corresponding to the nearest height pixel point of the topography curve through a cosine curve algorithm, calculating the reference height of each height pixel point, and determining the final height of each height pixel point according to the original height of each height pixel point, the difference between the reference height of each height pixel point and the original height, the corrected distance proportion and the offset distance of the path point in the vertical direction, so as to obtain the latest topography height map, and finally regenerating a topography model matched with a line model according to the latest topography height map. Thus, the terrain model matched with the line model of the project can be automatically generated, the terrain is not required to be adjusted manually, and the workload related to the matching of the terrain to the line is reduced.
Drawings
The accompanying drawings, which are included to provide a further understanding of the present document, illustrate and explain the present document, and are not to be construed as limiting the document. In the drawings:
fig. 1 is a flowchart of a terrain adaptation method of a line model according to an embodiment of the present application.
Fig. 2 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
Fig. 3 is a schematic structural diagram of a terrain adaptive device of a line model according to an embodiment of the present application.
Detailed Description
In order to facilitate the display of an engineering line model, the embodiment of the application provides a terrain self-adaptation method, a device, electronic equipment and a storage medium of the line model.
The terrain adaptive method of the line model provided by the embodiment of the application can be applied to a user terminal, wherein the user terminal can be, but is not limited to, a personal computer, a smart phone, a tablet personal computer, a laptop portable computer, a personal digital assistant and the like.
For convenience of description, the embodiments of the present application will be described with a user terminal as an execution body, except for specific descriptions.
It is understood that the execution bodies do not constitute limitations on the embodiments of the present application.
Referring to fig. 1, an embodiment of the present application provides a terrain adaptive method of a line model, where the terrain adaptive method of the line model may include the following steps:
step S101, determining the maximum topography offset distance and the maximum height deviation proportion of the unit project corresponding to the line model based on the project type of the unit project corresponding to the line model.
The engineering types of the unit engineering corresponding to the line model may be roadbed, bridge, tunnel, etc., which are not particularly limited in the embodiment of the present application.
The maximum relief offset distance of the unit project corresponding to the line model is the offset distance between the unit project corresponding to the line model and the ground. And if the engineering type of the unit engineering corresponding to the line model is a roadbed, the maximum relief offset distance of the unit engineering corresponding to the line model is 0, if the engineering type of the unit engineering corresponding to the line model is a bridge, the maximum relief offset distance of the unit engineering corresponding to the line model is the distance between the bridge and a bearing platform, and if the engineering type of the unit engineering corresponding to the line model is a tunnel, the maximum relief offset distance of the unit engineering corresponding to the line model is half of the head-tail distance of the line model. The roadbed is attached to the ground, and if the engineering type of the unit engineering corresponding to the line model is the roadbed, the maximum height deviation ratio of the unit engineering corresponding to the line model is 0. And if the bridge is above the ground and the engineering type of the unit engineering corresponding to the line model is the bridge, the maximum height deviation ratio of the unit engineering corresponding to the line model is-0.5 sin (x Pi). And if the tunnel is below the ground, and the engineering type of the unit engineering corresponding to the line model is the tunnel, the maximum height deviation ratio of the unit engineering corresponding to the line model is 0.5 x sin (x Pi). Wherein x is the ratio of the distance from the current position to the starting point of the path curve to the total length of the path curve, namely 0.ltoreq.x.ltoreq.1.
Step S102, based on the maximum relief offset distance and the maximum height deviation proportion, the path points in the path curve corresponding to the line model are offset in the vertical direction, and a relief curve of the unit project is obtained.
In this embodiment of the present application, the line model includes a plurality of path points, where the plurality of path points may be manually set by a user in the Unity3D engine, and a connection line of the plurality of path points forms a path curve of the line model.
Further, if the number of the path points in the line model is only two, the path points may be inserted between the two path points before the shifting is performed, so that a path curve can be formed.
In this embodiment of the present application, an offset distance of a path point in a path curve corresponding to a line model in a vertical direction is maxhghtoffset, where maxhghtoffset is a maximum relief offset distance of a unit project corresponding to the line model, and headoffsetrio is a maximum height deviation ratio of the unit project corresponding to the line model.
And step S103, extracting a terrain elevation map of the area where the unit engineering is located according to the original terrain data in the Unity3D engine.
Specifically, the topographic elevation map of the area where the unit engineering is located can be extracted through a GetHeights interface.
In one possible design, the original terrain data may also be copied prior to extracting the terrain elevation map to prevent tampering with the original data.
Step S104, determining the distance between each pixel point in the terrain elevation map and each path segment of the terrain curve.
The distance between the pixel point and each path segment of the relief curve is the horizontal distance between the pixel point and each path segment of the relief curve.
Step S105, selecting a path line segment with the minimum value and the corresponding distance within a preset range from the distances between each pixel point and each path line segment of the relief curve in the topographic elevation map as a reference path line segment of the elevation pixel point.
Step S106, calculating the distance ratio of each pixel point in the height map to the nearest topography curve line segment.
Specifically, when calculating the distance ratio of each pixel point in the height map to the nearest topography curve line segment, the offset distance of each pixel point in the topography height map can be calculated first, then the minimum distance between each pixel point in the topography height map and the nearest topography curve line segment is calculated, and finally the distance ratio of each pixel point in the topography height map to the topography curve is obtained according to the offset distance of each pixel point in the topography height map and the minimum distance between each pixel point in the topography height map and the nearest topography curve line segment.
In this embodiment of the present application, the distance ratio between each pixel point and the nearest topography curve line segment in the height map may be expressed as 1- (distance/maxRange), where distance is the distance (minimum distance) between the pixel point and the nearest topography curve line segment, maxRange is the offset distance between the pixel points, where the offset distance between the pixel points may refer to the side length corresponding to the pixel points, where the side length of the pixel points may be obtained according to the original topography data to obtain the dimension of the topography height map, and then divided by the resolution of the topography height map.
For example, in one embodiment, the pixels in the terrain elevation map include pixels a, b, c, and d, where the pixel corresponds to a side length of 10, the pixel a is at a distance of 5 from the nearest topography curve line segment, the pixel b is at a distance of 8 from the nearest topography curve line segment, the pixel c is at a distance of 3 from the nearest topography curve line segment, and the pixel d is at a distance of 12 from the nearest topography curve line segment. The distance ratio of the pixel point a to the nearest topography curve line segment is 1- (5/10) =0.5, the distance ratio of the pixel point b to the nearest topography curve line segment is 1- (8/10) =0.2, the distance ratio of the pixel point c to the nearest topography curve line segment is 1- (3/10) =0.7, and the distance ratio of the pixel point d to the nearest topography curve line segment is 1- (12/10) = -0.2.
Step S107, correcting the distance proportion corresponding to the height pixel point nearest to the relief curve line segment through a cosine curve algorithm.
Taking the example in step S106 as an example, among the pixels a, b, c and d, the distance between the pixel c and the nearest topography curve line segment is 3, and the distance is nearest to the topography curve line segment, and the distance ratio corresponding to the pixel c at the height nearest to the topography curve line segment can be corrected by the cosine curve algorithm.
In this embodiment, the corrected distance ratio may be 0.5×cos (x×pi) +1, where X is the distance ratio corresponding to the pixel point at the height nearest to the path curve.
Step S108, calculating the reference height of each height pixel point.
The reference height of the height pixel point is the position height of the height pixel point projected onto a line segment with the shortest distance to the height pixel point in the relief curve.
Step S109, determining the final height of each height pixel point based on the original height of each height pixel point, the difference between the reference height and the original height of each height pixel point, the corrected distance proportion and the offset distance of the path point in the vertical direction, so as to obtain the latest topographic height map.
In this embodiment of the present application, the final height of the height pixel point may be expressed as a position ws.y+ (targetHeight-position ws.y) ×rate+height offset, where position ws.y is the original height of the height pixel point, targetHeight is the reference height of the height pixel point, rate is the corrected distance ratio, and height offset is the offset distance of the path point in the vertical direction.
And step S110, regenerating a terrain model matched with the line model according to the latest terrain elevation map.
In summary, according to the terrain adaptive method for the line model provided by the embodiment of the application, the distance ratio between each pixel point and the nearest terrain curve line segment in the altitude map is calculated, the path line segment with the minimum value and the corresponding distance within the preset range is selected as the reference path line segment of the altitude pixel point, the distance ratio between each pixel point and the nearest terrain curve line segment in the altitude map is calculated, the distance ratio corresponding to the nearest altitude pixel point of the terrain curve is corrected through a cosine curve algorithm, then the reference height of each altitude pixel point is calculated, and the final height of each altitude pixel point is determined based on the original height of each altitude pixel point, the difference between the reference height and the original height of each altitude pixel point, the corrected distance ratio and the offset distance of the path point in the vertical direction, so that the latest terrain height map is obtained, and finally the terrain model matched with the line model is regenerated according to the latest terrain height map. Thus, the terrain model matched with the line model of the project can be automatically generated, the terrain is not required to be adjusted manually, and the workload related to the matching of the terrain to the line is reduced. Meanwhile, as the topographic elevation map is extracted according to the original topographic data, a user can upload a satellite map related to the project and an elevation map matched with the satellite map, so that the topography corresponding to the project can be generated, and a line model of the project can be displayed on the topography where the project is located, so that the condition of the project can be intuitively known. In addition, the method provided by the application also enriches the playability of the product.
Fig. 2 is a schematic structural diagram of an electronic device according to an embodiment of the present application. Referring to fig. 2, at the hardware level, the electronic device includes a processor, and optionally an internal bus, a network interface, and a memory. The Memory may include a Memory, such as a Random-Access Memory (RAM), and may further include a non-volatile Memory (non-volatile Memory), such as at least 1 disk Memory. Of course, the electronic device may also include hardware required for other services.
The processor, network interface, and memory may be interconnected by an internal bus, which may be an ISA (Industry Standard Architecture ) bus, a PCI (Peripheral Component Interconnect, peripheral component interconnect standard) bus, or EISA (Extended Industry Standard Architecture ) bus, among others. The buses may be classified as address buses, data buses, control buses, etc. For ease of illustration, only one bi-directional arrow is shown in FIG. 2, but not only one bus or type of bus.
And the memory is used for storing programs. In particular, the program may include program code including computer-operating instructions. The memory may include memory and non-volatile storage and provide instructions and data to the processor.
The processor reads the corresponding computer program from the nonvolatile memory into the memory and then runs the computer program to form the topography adaptive device of the line model on the logic level. The processor is used for executing the programs stored in the memory and is specifically used for executing the following operations:
determining the maximum relief offset distance and the maximum height deviation proportion of the unit project corresponding to the line model based on the project type of the unit project corresponding to the line model;
shifting the path points in the path curve corresponding to the line model in the vertical direction based on the maximum relief offset distance and the maximum height deviation proportion to obtain a relief curve of unit engineering;
extracting a terrain elevation map of the area where the unit engineering is located according to the original terrain data in the Unity3D engine;
determining the distance between each pixel point in the terrain elevation map and each path segment of the terrain curve, wherein the distance between each pixel point and each path segment of the terrain curve is the horizontal distance between each pixel point and each path segment of the terrain curve;
selecting a path line segment with the minimum value and the corresponding distance within a preset range from the distances between each pixel point in the topographic elevation map and each path line segment of the topographic curve as a reference path line segment of the elevation pixel point;
calculating the distance ratio of each pixel point to the nearest topography curve line segment in the height map, wherein the distance ratio of each pixel point to the nearest topography curve line segment in the height map is 1- (distance/maxRange), the distance is the distance between the pixel point and the nearest topography curve line segment, and the maxRange is the offset distance between the pixel points;
correcting the distance proportion corresponding to the height pixel point nearest to the relief curve line segment through a cosine curve algorithm;
calculating the reference height of each height pixel point, wherein the reference height of each height pixel point is the position height of the height pixel point projected onto a line segment with the shortest distance to the height pixel point in the topography curve;
determining the final height of each high-level pixel point based on the original height of each high-level pixel point, the difference between the reference height and the original height of each high-level pixel point, the corrected distance proportion and the offset distance of the path point in the vertical direction, so as to obtain the latest topographic height map;
and regenerating a terrain model matched with the line model according to the latest terrain height map.
The method performed by the terrain adaptation apparatus of the line model disclosed in the embodiment shown in fig. 2 of the present application may be applied to or implemented by a processor. The processor may be an integrated circuit chip having signal processing capabilities. In implementation, the steps of the above method may be performed by integrated logic circuits of hardware in a processor or by instructions in the form of software. The processor may be a general-purpose processor, including a central processing unit (Central Processing Unit, CPU), a network processor (Network Processor, NP), etc.; but also digital signal processors (Digital Signal Processor, DSP), application specific integrated circuits (Application Specific Integrated Circuit, ASIC), field programmable gate arrays (Field-Programmable Gate Array, FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components. The disclosed methods, steps, and logic blocks in one or more embodiments of the present application may be implemented or performed. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like. The steps of a method disclosed in connection with one or more embodiments of the present application may be embodied directly in a hardware decoding processor or in a combination of hardware and software modules in a decoding processor. The software modules may be located in a random access memory, flash memory, read only memory, programmable read only memory, or electrically erasable programmable memory, registers, etc. as well known in the art. The storage medium is located in a memory, and the processor reads the information in the memory and, in combination with its hardware, performs the steps of the above method.
The electronic device may further execute the method of fig. 1 and implement the functions of the terrain adaptive device of the line model in the embodiment shown in fig. 2, which is not described herein again.
Of course, other implementations, such as a logic device or a combination of hardware and software, are not excluded from the electronic device of the present application, that is, the execution subject of the following processing flow is not limited to each logic unit, but may be hardware or a logic device.
The present embodiments also provide a computer readable storage medium storing one or more programs, the one or more programs comprising instructions, which when executed by a portable electronic device comprising a plurality of application programs, enable the portable electronic device to perform the method of the embodiment of fig. 1, and in particular to:
determining the maximum relief offset distance and the maximum height deviation proportion of the unit project corresponding to the line model based on the project type of the unit project corresponding to the line model;
shifting the path points in the path curve corresponding to the line model in the vertical direction based on the maximum relief offset distance and the maximum height deviation proportion to obtain a relief curve of unit engineering;
extracting a terrain elevation map of the area where the unit engineering is located according to the original terrain data in the Unity3D engine;
determining the distance between each pixel point in the terrain elevation map and each path segment of the terrain curve, wherein the distance between each pixel point and each path segment of the terrain curve is the horizontal distance between each pixel point and each path segment of the terrain curve;
selecting a path line segment with the minimum value and the corresponding distance within a preset range from the distances between each pixel point in the topographic elevation map and each path line segment of the topographic curve as a reference path line segment of the elevation pixel point;
calculating the distance ratio of each pixel point to the nearest topography curve line segment in the height map, wherein the distance ratio of each pixel point to the nearest topography curve line segment in the height map is 1- (distance/maxRange), the distance is the distance between the pixel point and the nearest topography curve line segment, and the maxRange is the offset distance between the pixel points;
correcting the distance proportion corresponding to the height pixel point nearest to the relief curve line segment through a cosine curve algorithm;
calculating the reference height of each height pixel point, wherein the reference height of each height pixel point is the position height of the height pixel point projected onto a line segment with the shortest distance to the height pixel point in the topography curve;
determining the final height of each high-level pixel point based on the original height of each high-level pixel point, the difference between the reference height and the original height of each high-level pixel point, the corrected distance proportion and the offset distance of the path point in the vertical direction, so as to obtain the latest topographic height map;
and regenerating a terrain model matched with the line model according to the latest terrain height map.
Fig. 3 is a schematic structural diagram of a terrain adaptive device of a line model according to an embodiment of the present application. Referring to fig. 3, in a software embodiment, a terrain adaptation device of a line model includes:
the first determining unit is used for determining the maximum relief offset distance and the maximum height deviation proportion of the unit project corresponding to the line model based on the project type of the unit project corresponding to the line model;
the deviation unit is used for deviating the path points in the path curve corresponding to the line model in the vertical direction based on the maximum relief deviation distance and the maximum height deviation proportion to obtain a relief curve of unit engineering;
the extraction unit is used for extracting a terrain elevation map of the area where the unit engineering is located according to the original terrain data in the Unity3D engine;
the second determining unit is used for determining the distance between each pixel point in the terrain elevation map and each path segment of the terrain curve, wherein the distance between the pixel point and each path segment of the terrain curve is the horizontal distance between the pixel point and each path segment of the terrain curve;
the selecting unit is used for selecting a path line segment with the minimum value, the corresponding distance of which is within a preset range, from the distances between each pixel point in the topographic elevation map and each path line segment of the topographic curve as a reference path line segment of the elevation pixel point;
the first calculation unit is used for calculating the distance ratio of each pixel point to the nearest topography curve line segment in the height map, wherein the distance ratio of each pixel point to the nearest topography curve line segment in the height map is 1- (distance/maxRange), the distance is the distance between the pixel point and the nearest topography curve line segment, and the maxRange is the offset distance between the pixel points;
the correction unit is used for correcting the distance proportion corresponding to the height pixel point nearest to the path curve through a cosine curve algorithm;
the second calculation unit is used for calculating the reference height of each height pixel point, wherein the reference height of each height pixel point is the position height of the height pixel point projected onto a line segment with the shortest distance to the height pixel point in the relief curve;
the third determining unit is used for determining the final height of each high-level pixel point based on the original height of each high-level pixel point, the difference between the reference height of each high-level pixel point and the original height, the corrected distance proportion and the offset distance of the path point in the vertical direction so as to obtain the latest topography height map;
and the generating unit is used for regenerating a terrain model matched with the line model according to the latest terrain height map.
In summary, the foregoing description is only a preferred embodiment of the present document, and is not intended to limit the scope of the present document. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of this document should be included within the scope of protection of this document.
The system, apparatus, module or unit set forth in the above embodiments may be implemented in particular by a computer chip or entity, or by a product having a certain function. One typical implementation is a computer. In particular, the computer may be, for example, a personal computer, a laptop computer, a cellular telephone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or a combination of any of these devices.
Computer readable media, including both non-transitory and non-transitory, removable and non-removable media, may implement information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, or other data. Examples of storage media for a computer include, but are not limited to, phase change memory (PRAM), static Random Access Memory (SRAM), dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), read Only Memory (ROM), electrically Erasable Programmable Read Only Memory (EEPROM), flash memory or other memory technology, compact disc read only memory (CD-ROM), digital Versatile Discs (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices, or any other non-transmission medium, which can be used to store information that can be accessed by a computing device. Computer-readable media, as defined herein, does not include transitory computer-readable media (transmission media), such as modulated data signals and carrier waves.
All embodiments in this document are described in a progressive manner, and identical and similar parts of the embodiments are all referred to each other, and each embodiment is mainly described as different from other embodiments. In particular, for system embodiments, since they are substantially similar to method embodiments, the description is relatively simple, as relevant to see a section of the description of method embodiments.
Claims (9)
1. A method for terrain adaptation of a line model, comprising:
determining the maximum relief offset distance and the maximum height deviation proportion of the unit project corresponding to the line model based on the project type of the unit project corresponding to the line model;
shifting the path points in the path curve corresponding to the line model in the vertical direction based on the maximum relief offset distance and the maximum height deviation proportion to obtain a relief curve of unit engineering;
extracting a terrain elevation map of the area where the unit engineering is located according to the original terrain data in the Unity3D engine;
determining the distance between each pixel point in the terrain elevation map and each path segment of the terrain curve, wherein the distance between each pixel point and each path segment of the terrain curve is the horizontal distance between each pixel point and each path segment of the terrain curve;
selecting a path line segment with the minimum value and the corresponding distance within a preset range from the distances between each pixel point in the topographic elevation map and each path line segment of the topographic curve as a reference path line segment of the elevation pixel point;
calculating the distance ratio of each pixel point to the nearest topography curve line segment in the height map, wherein the distance ratio of each pixel point to the nearest topography curve line segment in the height map is 1- (distance/maxRange), the distance is the distance between the pixel point and the nearest topography curve line segment, and the maxRange is the offset distance between the pixel points;
correcting the distance proportion corresponding to the height pixel point nearest to the relief curve line segment through a cosine curve algorithm;
calculating the reference height of each height pixel point, wherein the reference height of each height pixel point is the position height of the height pixel point projected onto a line segment with the shortest distance to the height pixel point in the topography curve;
determining the final height of each high-level pixel point based on the original height of each high-level pixel point, the difference between the reference height and the original height of each high-level pixel point, the corrected distance proportion and the offset distance of the path point in the vertical direction, so as to obtain the latest topographic height map;
regenerating a terrain model matched with the line model according to the latest terrain height map;
the engineering type of the unit engineering corresponding to the line model is one of roadbed, bridge and tunnel, and the maximum relief offset distance and maximum height deviation proportion of the unit engineering corresponding to the line model are determined based on the engineering type of the unit engineering corresponding to the line model, and the method comprises the following steps:
if the engineering type of the unit engineering corresponding to the line model is roadbed, the maximum topography offset distance and the maximum height deviation ratio of the unit engineering corresponding to the line model are both 0;
if the engineering type of the unit engineering corresponding to the line model is a bridge, the maximum relief offset distance of the unit engineering corresponding to the line model is the distance between the bridge and the bearing platform, and the maximum height deviation proportion of the unit engineering corresponding to the line model is-0.5 sin (x Pi);
if the engineering type of the unit engineering corresponding to the line model is a tunnel, the maximum relief offset distance of the unit engineering corresponding to the line model is half of the head-tail distance of the line model, and the maximum height deviation ratio of the unit engineering corresponding to the line model is 0.5 sin (x Pi);
wherein x is the ratio of the distance from the current position to the starting point of the path curve to the total length of the path curve.
2. The method of claim 1, wherein an offset distance of a path point in a vertical direction in a path curve corresponding to the line model is maxHeight OffsetTifidio, wherein maxHeight Offset is a maximum topography offset distance of a unit project corresponding to the line model, and Height OffsetTiio is a maximum height deviation ratio of the unit project corresponding to the line model.
3. The method of claim 1, wherein calculating the distance ratio of each pixel point in the height map to the nearest topography curve line segment comprises:
calculating the offset distance of each pixel point in the topographic elevation map;
calculating the minimum distance between each pixel point in the topographic elevation map and the nearest topographic curve line segment;
and obtaining the distance proportion between each pixel point in the topographic elevation map and the line segment of the topography curve according to the offset distance between each pixel point in the topographic elevation map and the minimum distance between each pixel point in the topographic elevation map and the line segment of the nearest topography curve.
4. The method of claim 1 wherein the modified distance ratio is 0.5X (cos (X Pi) +1), where X is the distance ratio corresponding to the closest high pixel point of the path curve.
5. The method of claim 1 wherein the final height of the high pixel is positionws.y+ (targetHeight-positionws.y) ×rate+height offset, where positionws.y is the original height of the high pixel, targetHeight is the reference height of the high pixel, rate is the modified distance ratio, and height offset is the offset distance of the path point in the vertical direction.
6. The method according to claim 1, wherein the method further comprises:
and calculating the coordinates of each pixel point in the topographic elevation map based on the pixel coordinates of each pixel point in the topographic elevation map and the offset distance of the pixel points.
7. A terrain adaptive device for a line model, comprising:
the first determining unit is used for determining the maximum relief offset distance and the maximum height deviation proportion of the unit project corresponding to the line model based on the project type of the unit project corresponding to the line model;
the deviation unit is used for deviating the path points in the path curve corresponding to the line model in the vertical direction based on the maximum relief deviation distance and the maximum height deviation proportion to obtain a relief curve of unit engineering;
the extraction unit is used for extracting a terrain elevation map of the area where the unit engineering is located according to the original terrain data in the Unity3D engine;
the second determining unit is used for determining the distance between each pixel point in the terrain elevation map and each path segment of the terrain curve, wherein the distance between the pixel point and each path segment of the terrain curve is the horizontal distance between the pixel point and each path segment of the terrain curve;
the selecting unit is used for selecting a path line segment with the minimum value, the corresponding distance of which is within a preset range, from the distances between each pixel point in the topographic elevation map and each path line segment of the topographic curve as a reference path line segment of the elevation pixel point;
the first calculation unit is used for calculating the distance ratio of each pixel point to the nearest topography curve line segment in the height map, wherein the distance ratio of each pixel point to the nearest topography curve line segment in the height map is 1- (distance/maxRange), the distance is the distance between the pixel point and the nearest topography curve line segment, and the maxRange is the offset distance between the pixel points;
the correction unit is used for correcting the distance proportion corresponding to the height pixel point nearest to the path curve through a cosine curve algorithm;
the second calculation unit is used for calculating the reference height of each height pixel point, wherein the reference height of each height pixel point is the position height of the height pixel point projected onto a line segment with the shortest distance to the height pixel point in the relief curve;
the third determining unit is used for determining the final height of each high-level pixel point based on the original height of each high-level pixel point, the difference between the reference height of each high-level pixel point and the original height, the corrected distance proportion and the offset distance of the path point in the vertical direction so as to obtain the latest topography height map;
the generating unit is used for regenerating a terrain model matched with the line model according to the latest terrain height map;
the first determining unit is used for determining the maximum relief offset distance and the maximum height deviation proportion of the unit project corresponding to the line model based on the project type of the unit project corresponding to the line model, and is specifically used for:
if the engineering type of the unit engineering corresponding to the line model is roadbed, the maximum topography offset distance and the maximum height deviation ratio of the unit engineering corresponding to the line model are both 0;
if the engineering type of the unit engineering corresponding to the line model is a bridge, the maximum relief offset distance of the unit engineering corresponding to the line model is the distance between the bridge and the bearing platform, and the maximum height deviation proportion of the unit engineering corresponding to the line model is-0.5 sin (x Pi);
if the engineering type of the unit engineering corresponding to the line model is a tunnel, the maximum relief offset distance of the unit engineering corresponding to the line model is half of the head-tail distance of the line model, and the maximum height deviation ratio of the unit engineering corresponding to the line model is 0.5 sin (x Pi);
wherein x is the ratio of the distance from the current position to the starting point of the path curve to the total length of the path curve.
8. The electronic equipment is characterized by comprising a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory are communicated with each other through the bus;
a memory for storing a computer program;
a processor for executing a program stored on a memory to implement the terrain adaptation method of a line model as claimed in any one of claims 1-6.
9. A computer readable storage medium, characterized in that the storage medium has stored therein a computer program which, when executed by a processor, implements the terrain adaptation method of the line model according to any of the claims 1-6.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110866849.7A CN113570718B (en) | 2021-07-29 | 2021-07-29 | Terrain self-adaptation method and device of line model, electronic equipment and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110866849.7A CN113570718B (en) | 2021-07-29 | 2021-07-29 | Terrain self-adaptation method and device of line model, electronic equipment and storage medium |
Publications (2)
Publication Number | Publication Date |
---|---|
CN113570718A CN113570718A (en) | 2021-10-29 |
CN113570718B true CN113570718B (en) | 2023-06-23 |
Family
ID=78169147
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202110866849.7A Active CN113570718B (en) | 2021-07-29 | 2021-07-29 | Terrain self-adaptation method and device of line model, electronic equipment and storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN113570718B (en) |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN108334689A (en) * | 2018-01-29 | 2018-07-27 | 四川科宏石油天然气工程有限公司 | A kind of method of automatic realization pipeline longitudinal design |
CN108873096A (en) * | 2018-04-27 | 2018-11-23 | 四川隧唐科技股份有限公司 | geological prediction confirmation method and device |
CN112947490A (en) * | 2021-04-09 | 2021-06-11 | 京东数科海益信息科技有限公司 | Path smoothing method, device, equipment, storage medium and product |
Family Cites Families (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
GB2537922B (en) * | 2015-04-30 | 2019-01-16 | Univ Cape Town | Systems and methods for synthesising a terrain |
-
2021
- 2021-07-29 CN CN202110866849.7A patent/CN113570718B/en active Active
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN108334689A (en) * | 2018-01-29 | 2018-07-27 | 四川科宏石油天然气工程有限公司 | A kind of method of automatic realization pipeline longitudinal design |
CN108873096A (en) * | 2018-04-27 | 2018-11-23 | 四川隧唐科技股份有限公司 | geological prediction confirmation method and device |
CN112947490A (en) * | 2021-04-09 | 2021-06-11 | 京东数科海益信息科技有限公司 | Path smoothing method, device, equipment, storage medium and product |
Non-Patent Citations (4)
Title |
---|
An on-demand provision model for geospatial multisource information with active self-adaption services;Hong Fan 等;《MIPPR 2015: Remote Sensing Image Processing, Geographic Information Systems, and Other Applications》;第9815卷;1-8 * |
Unity3D下一种基于Perlin噪声的地形仿真方法;刘雪梅 等;《软件导刊》;第18卷(第4期);174-178 * |
一种自适应混合加权动态推算地形生成算法;张森 等;《系统仿真学报》;第23卷(第8期);1601-1605 * |
基于单样本的大场景地形高度图合成系统设计与实现;蔡润博 等;《信息通信》(第7期);31-33 * |
Also Published As
Publication number | Publication date |
---|---|
CN113570718A (en) | 2021-10-29 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN111860502B (en) | Picture form identification method and device, electronic equipment and storage medium | |
CN111080805A (en) | Method and device for generating three-dimensional block diagram of marked object, electronic equipment and storage medium | |
CN110287831B (en) | Method and device for acquiring control point based on landmark and electronic equipment | |
CN111220163A (en) | Curve judgment method based on curvature radius calculation, terminal device and storage medium | |
CN112200851B (en) | Point cloud-based target detection method and device and electronic equipment thereof | |
CN113256742A (en) | Interface display method and device, electronic equipment and computer readable medium | |
CN110807983A (en) | Area adjustment method and device of electronic map and electronic equipment | |
CN108280135B (en) | Method and device for realizing visualization of data structure and electronic equipment | |
CN113570718B (en) | Terrain self-adaptation method and device of line model, electronic equipment and storage medium | |
CN113282535B (en) | Quantization processing method and device and quantization processing chip | |
CN114119748A (en) | Method and device for determining installation pose of vehicle-mounted all-around camera | |
CN109598478B (en) | Wind measurement result description document generation method and device and electronic equipment | |
CN114065868B (en) | Training method of text detection model, text detection method and device | |
CN115435796B (en) | Vehicle positioning method and device and electronic equipment | |
CN116453371A (en) | Method and device for identifying returning of shared vehicle, computer equipment and storage medium | |
CN112800351B (en) | Track similarity judging method, system and computer medium | |
CN110738476B (en) | Sample migration method, device and equipment | |
CN114168695A (en) | Target position determining method, device, terminal and storage medium | |
CN108170821B (en) | Method and device for determining one-code multiple access and electronic equipment | |
CN117593413B (en) | Road assignment method, device and equipment based on road geometric vector tracking | |
CN116630436B (en) | Camera external parameter correction method, camera external parameter correction device, electronic equipment and computer readable medium | |
CN115937007B (en) | Wind shear identification method and device, electronic equipment and medium | |
CN111753200B (en) | Data determination method, device, equipment and medium | |
CN108304525B (en) | Condition data determination method and device | |
CN116051614B (en) | Multi-dimensional comprehensive shape matching degree calculation method and device for linear elements |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |