CN113570718A - Terrain self-adaption method and device of line model, electronic equipment and storage medium - Google Patents
Terrain self-adaption method and device of line model, electronic equipment and storage medium Download PDFInfo
- Publication number
- CN113570718A CN113570718A CN202110866849.7A CN202110866849A CN113570718A CN 113570718 A CN113570718 A CN 113570718A CN 202110866849 A CN202110866849 A CN 202110866849A CN 113570718 A CN113570718 A CN 113570718A
- Authority
- CN
- China
- Prior art keywords
- height
- terrain
- pixel point
- distance
- curve
- 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
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-adaption 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 a terrain height map and each section of route line segment of a terrain curve, calculating the distance proportion between each pixel point in the height map and the nearest terrain curve line segment, correcting the distance proportion corresponding to the height pixel point nearest to the terrain curve line segment, calculating the reference height of each height pixel point, 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 route point in the vertical direction, obtaining the latest terrain height map, and generating a terrain model matched with a line model according to the latest terrain height map. The scheme provided by the application can automatically generate the terrain model matched with the route model of the project, and reduces the workload related to route matching terrain.
Description
Technical Field
The present application 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 intuitively understand the engineering situation, a line model of a unit project is often added on a terrain model through a Unity3D engine for rendering and displaying.
At present, when a circuit model of a unit project is added on a terrain model for rendering and displaying, the terrain is mostly adjusted in a manual mode, so that the circuit model is matched with the terrain model. However, the adoption of the method can greatly increase the related workload of the line matching the terrain, and bring great inconvenience to the display of the engineering line model.
Therefore, how to provide an effective scheme to simply and conveniently realize the display of the engineering line model and reduce the related workload becomes an urgent problem in the prior art.
Disclosure of Invention
In a first aspect, an embodiment of the present application provides a terrain adaptive method for a line model, including:
determining the maximum relief offset distance and the maximum height deviation ratio of the unit project corresponding to the line model based on the project type of the unit project corresponding to the line model;
on the basis of the maximum relief offset distance and the maximum height deviation ratio, offsetting the path points in the path curve corresponding to the line model in the vertical direction to obtain a relief curve of unit engineering;
extracting a terrain height map of the area where the unit project is located according to original terrain data in a Unity3D engine;
determining the distance between each pixel point in the terrain height 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;
selecting a path line segment with the corresponding distance within a preset range and the minimum value from the distances between each pixel point in the terrain height map and each path line segment of the terrain curve as a reference path line segment of the height pixel point;
calculating the distance proportion of each pixel point in the height map to the nearest terrain curve line segment, wherein the distance proportion of each pixel point in the height map to the nearest terrain curve line segment is 1- (distance/maxRange), the distance is the distance between the pixel point and the nearest terrain curve line segment, and the maxRange is the offset distance of the pixel point;
correcting the distance proportion corresponding to the height pixel points closest to the terrain 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 height of the position of the height pixel point projected to the line segment with the shortest distance to the height pixel point in the terrain curve;
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 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 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 determining, based on the engineering type of the unit engineering corresponding to the line model, a maximum relief offset distance and a maximum height deviation ratio of the unit engineering corresponding to the line model includes:
if the project type of the unit project corresponding to the line model is a roadbed, the maximum relief offset distance and the maximum height deviation ratio of the unit project corresponding to the line model are both 0;
if the project type of the unit project corresponding to the line model is a bridge, the maximum relief offset distance of the unit project corresponding to the line model is the distance between the bridge and the bearing platform, and the maximum height deviation proportion of the unit project corresponding to the line model is-0.5 sin (x Pi);
if the project type of the unit project corresponding to the line model is a tunnel, the maximum relief offset distance of the unit project corresponding to the line model is half of the head-tail distance of the line model, and the maximum height deviation proportion of the unit project corresponding to the line model is 0.5 sin (x Pi);
wherein x is the proportion of the distance between the current position and the starting point of the path curve in the total length of the path curve.
In one possible design, the offset distance of the path point in the path curve corresponding to the line model in the vertical direction is maxhieghtoffset and heightoffset ratio, where maxhieghtoffset is the maximum relief offset distance of the unit project corresponding to the line model, and heightoffset ratio is the maximum height deviation ratio of the unit project corresponding to the line model.
In one possible design, the calculating a distance ratio between each pixel point in the height map and the nearest topographic curve line segment includes:
calculating the offset distance of each pixel point in the terrain height map;
calculating the minimum distance between each pixel point in the terrain height map and the nearest terrain curve line segment;
and obtaining the distance proportion of each pixel point in the terrain height map to the terrain curve line segment according to the offset distance of each pixel point in the terrain height map and the minimum distance between each pixel point in the terrain height map and the nearest terrain curve line segment.
In one possible design, the modified distance ratio is 0.5 (cos (X Pi) +1), where X is the distance ratio corresponding to the height pixel closest to the path curve.
In one possible design, the final height of the height pixel is position ws.y + (target height-position ws.y) × rate + height offset, where position ws.y is the original height of the height pixel, target height 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 includes:
and calculating the coordinate of each pixel point in the topographic height map based on the pixel coordinate of each pixel point in the topographic height map and the offset distance of the pixel point.
In a second aspect, an embodiment of the present application provides a terrain adaptive apparatus for 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 migration unit is used for migrating the path points in the path curve corresponding to the line model in the vertical direction based on the maximum relief migration distance and the maximum height deviation ratio to obtain a relief curve of unit engineering;
the extraction unit is used for extracting a terrain height map of the area where the unit project is located according to original terrain data in a Unity3D engine;
the second determining unit is used for determining the distance between each pixel point in the terrain height map and each path line segment of the terrain curve, and the distance between the pixel point and each path line segment of the terrain curve is the horizontal distance between the pixel point and each path line segment of the terrain curve;
the selection unit is used for selecting a path line segment with the corresponding distance within a preset range and the minimum value from the distances between each pixel point in the topographic height map and each path line segment of the topographic curve as a reference path line segment of the height pixel point;
the first calculation unit is used for calculating the distance proportion of each pixel point in the height map to the nearest terrain curve line segment, wherein the distance proportion of each pixel point in the height map to the nearest terrain curve line segment is 1- (distance/maxRange), the distance is the distance between the pixel point and the nearest terrain curve line segment, and the maxRange is the offset distance of the pixel point;
the correction unit is used for correcting the distance proportion corresponding to the height pixel point closest 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, and the reference height of each height pixel point is the height of the position of the height pixel point projected to the line segment with the shortest distance to the height pixel point in the terrain curve;
the third determining unit is used for 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 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 topographic 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 mutual communication through the bus;
a memory for storing a computer program;
and a processor for executing the program stored in the memory to implement the terrain adaptive method for the line model according to any one of the above aspects.
In a fourth aspect, the present application provides a computer-readable storage medium, in which a computer program is stored, and the computer program, when executed by a processor, implements the method for terrain adaptation of a line model according to any one of the above.
The above-mentioned at least one technical scheme that this application one or more embodiments adopted can reach following beneficial effect:
by calculating the distance proportion between each pixel point in the height map and the nearest relief curve line segment, selecting the path line segment with the corresponding distance within the preset range and the minimum value as the reference path line segment of the height pixel point, and calculating the distance proportion between each pixel point in the height map and the nearest relief curve line segment, the distance proportion corresponding to the height pixel point closest to the relief curve is corrected by a cosine curve algorithm, then calculating the reference height of each height pixel point, 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, and finally, regenerating the terrain model matched with the line model according to the latest terrain height map. Therefore, the terrain model matched with the route model of the project can be automatically generated, the terrain does not need to be adjusted manually, and the workload related to the route matching terrain is reduced.
Drawings
The accompanying drawings, which are included to provide a further understanding of the disclosure and are incorporated in and constitute a part of this specification, illustrate embodiments of the disclosure and together with the description serve to explain the disclosure without limiting the disclosure in any way. In the drawings:
fig. 1 is a flowchart of a terrain adaptive method for 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 apparatus for 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 adaptive method, a terrain adaptive device, electronic equipment and a storage medium of the line model, and the terrain adaptive method, the terrain adaptive device, the electronic equipment and the storage medium of the line model can automatically generate a terrain model matched with the engineering line model, so that the workload related to the matching of a route with the terrain is reduced.
The terrain adaptive method for the line model provided by the embodiment of the application can be applied to a user terminal, and the user terminal can be, but is not limited to a personal computer, a smart phone, a tablet computer, a laptop portable computer, a personal digital assistant and the like.
For convenience of description, the embodiments of the present application are described with a user terminal as an execution subject unless otherwise specified.
It is to be understood that the described execution body does not constitute a limitation of the embodiments of the present application.
Referring to fig. 1, an embodiment of the present application provides a method for terrain adaptation of a line model, where the method for terrain adaptation of a line model may include the following steps:
and S101, determining the maximum relief offset distance and the maximum height deviation ratio 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 type of the unit engineering corresponding to the line model may be a roadbed, a bridge, a tunnel, and the like, and is not specifically 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. 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-to-tail distance of the line model. And 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 engineering type of the unit engineering corresponding to the line model is the bridge, the maximum height deviation proportion of the unit engineering corresponding to the line model is-0.5 sin (x Pi). The tunnel is below the ground, and if 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 sin (x Pi). Wherein x is the proportion of the distance between the current position and the starting point of the path curve in the total length of the path curve, namely x is more than or equal to 0 and less than or equal to 1.
And S102, shifting the path points in the path curve corresponding to the line model in the vertical direction based on the maximum relief shift distance and the maximum height deviation ratio to obtain the relief curve of the unit project.
In this embodiment, the line model includes a plurality of waypoints, which may be manually set by a user in the Unity3D engine, and a connection line of the plurality of waypoints forms a path curve of the line model.
Further, if the number of waypoints in the line model is only two, waypoints may be inserted between the two waypoints before the offset is performed, so that a path curve can be formed.
In the 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 maxhieghtoffset _ heightoffset ratio, where maxhieghtoffset is a maximum relief offset distance of a unit project corresponding to the line model, and heightoffset ratio is a maximum height deviation ratio of the unit project corresponding to the line model.
Step S103, extracting a terrain height map of the area where the unit project is located according to the original terrain data in the Unity3D engine.
Specifically, the terrain height map of the area where the unit project 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 height map to prevent tampering with the original data.
And step S104, determining the distance between each pixel point in the terrain height map and each path line segment of the terrain curve.
The distance between the pixel point and each route segment of the terrain curve is the horizontal distance between the pixel point and each route segment of the terrain curve.
Step S105, selecting a path line segment with the corresponding distance within a preset range and the minimum value from the distances between each pixel point in the topographic height map and each path line segment of the topographic curve as a reference path line segment of the height pixel point.
And step S106, calculating the distance proportion of each pixel point in the height map to the nearest terrain curve line segment.
Specifically, when calculating the distance proportion between each pixel point and the nearest relief curve line segment in the height map, the offset distance of each pixel point in the relief map may be calculated first, then the minimum distance between each pixel point in the relief map and the nearest relief curve line segment may be calculated, and finally the distance proportion between each pixel point in the relief map and the relief curve may be obtained according to the offset distance of each pixel point in the relief map and the minimum distance between each pixel point in the relief map and the nearest relief curve line segment.
In the embodiment of the application, the distance ratio between each pixel point and the nearest terrain curve line segment in the height map can be represented as 1- (distance/maxRange), wherein distance is the distance (minimum distance) between the pixel point and the nearest terrain curve line segment, maxRange is the offset distance of the pixel point, the offset distance of the pixel point can refer to the side length corresponding to the pixel point, and the side length of the pixel point can be obtained by obtaining the size of the terrain height map according to the original terrain data and then dividing the size by the resolution of the terrain height map.
For example, in one embodiment, the pixel points in the topographic height map include pixel points a, b, c, and d, the side length corresponding to the pixel points is 10, the distance from the pixel point a to the nearest topographic curve segment is 5, the distance from the pixel point b to the nearest topographic curve segment is 8, the distance from the pixel point c to the nearest topographic curve segment is 3, and the distance from the pixel point d to the nearest topographic curve segment is 12. The distance ratio of the pixel point a to the nearest relief curve segment is 1- (5/10) ═ 0.5, the distance ratio of the pixel point b to the nearest relief curve segment is 1- (8/10) ═ 0.2, the distance ratio of the pixel point c to the nearest relief curve segment is 1- (3/10) ═ 0.7, and the distance ratio of the pixel point d to the nearest relief curve segment is 1- (12/10) — 0.2.
And S107, correcting the distance proportion corresponding to the height pixel point closest to the terrain curve line segment through a cosine curve algorithm.
Taking the example in the step S106 as an example, in the pixel points a, b, c, and d, the distance between the pixel point c and the nearest relief curve segment is 3, and the distance is closest to the relief curve segment, and then the distance ratio corresponding to the height pixel point c closest to the relief curve segment may be corrected by the cosine curve algorithm.
In the embodiment of the present application, the corrected distance ratio may be 0.5 (cos (X Pi) +1), where X is the distance ratio corresponding to the height pixel closest 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 height of the position of the height pixel point projected to the line segment with the shortest distance to the height pixel point in the terrain 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 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 topographic height map.
In this embodiment of the present application, the final height of the height pixel may be represented by position ws.y + (target height-position ws.y) × rate + height offset, where position ws.y is the original height of the height pixel, target height 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.
And step S110, regenerating a terrain model matched with the line model according to the latest terrain height map.
To sum up, the terrain adaptive method of the line model provided in the embodiment of the present application calculates the distance ratio between each pixel point in the height map and the nearest terrain curve line segment, selects the path line segment with the minimum value and the corresponding distance within the preset range as the reference path line segment of the height pixel point, calculates the distance ratio between each pixel point in the height map and the nearest terrain curve line segment, corrects the distance ratio corresponding to the height pixel point nearest to the terrain curve by the cosine curve algorithm, then calculates the reference height of each height pixel point, and determines the final height of each height pixel point based on 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 ratio and the offset distance of the path point in the vertical direction to obtain the latest terrain height map, and finally, regenerating the terrain model matched with the line model according to the latest terrain height map. Therefore, the terrain model matched with the route model of the project can be automatically generated, the terrain does not need to be adjusted manually, and the workload related to the route matching terrain is reduced. Meanwhile, the terrain height map is extracted according to the original terrain data, so that a user can upload a satellite map related to the project and a height map matched with the satellite map, and accordingly can generate a terrain corresponding to the project, so that a line model of the project can be displayed on the terrain where the project is located, and the condition of the project can be visually known conveniently. 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 a hardware level, the electronic device includes a processor, and optionally further includes 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, such as at least 1 disk Memory. Of course, the electronic device may also include hardware required for other services.
The processor, the network interface, and the memory may be connected to each other via an internal bus, which may be an ISA (Industry Standard Architecture) bus, a PCI (Peripheral Component Interconnect) bus, an EISA (Extended Industry Standard Architecture) bus, or the like. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, only one double-headed arrow is shown in FIG. 2, but this does not indicate only one bus or one type of bus.
And the memory is used for storing programs. In particular, the program may include program code comprising computer operating instructions. The memory may include both memory and non-volatile storage and provides instructions and data to the processor.
The processor reads a corresponding computer program from the nonvolatile memory into the memory and then runs the computer program to form the terrain adaptive device of the line model on the logic level. The processor is used for executing the program stored in the memory and is specifically used for executing the following operations:
determining the maximum relief offset distance and the maximum height deviation ratio of the unit project corresponding to the line model based on the project type of the unit project corresponding to the line model;
on the basis of the maximum relief offset distance and the maximum height deviation ratio, offsetting the path points in the path curve corresponding to the line model in the vertical direction to obtain a relief curve of unit engineering;
extracting a terrain height map of the area where the unit project is located according to original terrain data in a Unity3D engine;
determining the distance between each pixel point in the terrain height 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;
selecting a path line segment with the corresponding distance within a preset range and the minimum value from the distances between each pixel point in the terrain height map and each path line segment of the terrain curve as a reference path line segment of the height pixel point;
calculating the distance proportion of each pixel point in the height map to the nearest terrain curve line segment, wherein the distance proportion of each pixel point in the height map to the nearest terrain curve line segment is 1- (distance/maxRange), the distance is the distance between the pixel point and the nearest terrain curve line segment, and the maxRange is the offset distance of the pixel point;
correcting the distance proportion corresponding to the height pixel points closest to the terrain 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 height of the position of the height pixel point projected to the line segment with the shortest distance to the height pixel point in the terrain curve;
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 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 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 adaptive device for line models disclosed in the embodiment of 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 instructions in the form of software. The Processor may be a general-purpose Processor, including a Central Processing Unit (CPU), a Network Processor (NP), and the like; but also Digital Signal Processors (DSPs), Application Specific Integrated Circuits (ASICs), Field Programmable Gate Arrays (FPGAs) or other Programmable logic devices, discrete Gate or transistor logic devices, discrete hardware components. The various methods, steps and logic blocks disclosed 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 the hardware decoding processor, or in a combination of the hardware and software modules included in the decoding processor. The software module may be located in ram, flash memory, rom, prom, or eprom, registers, etc. storage media as is well known in the art. The storage medium is located in a memory, and a processor reads information in the memory and completes the steps of the method in combination with hardware of the processor.
The electronic device may further execute the method shown in fig. 1, and implement the functions of the terrain adaptive apparatus for a line model in the embodiment shown in fig. 2, which are not described herein again in this embodiment of the present application.
Of course, besides the software implementation, the electronic device of the present application does not exclude other implementations, such as a logic device or a combination of software and hardware, and the like, that is, the execution subject of the following processing flow is not limited to each logic unit, and may also be hardware or a logic device.
Embodiments of the present application also provide a computer-readable storage medium storing one or more programs, where the one or more programs include instructions, which when executed by a portable electronic device including a plurality of application programs, enable the portable electronic device to perform the method of the embodiment shown in fig. 1, and are specifically configured to:
determining the maximum relief offset distance and the maximum height deviation ratio of the unit project corresponding to the line model based on the project type of the unit project corresponding to the line model;
on the basis of the maximum relief offset distance and the maximum height deviation ratio, offsetting the path points in the path curve corresponding to the line model in the vertical direction to obtain a relief curve of unit engineering;
extracting a terrain height map of the area where the unit project is located according to original terrain data in a Unity3D engine;
determining the distance between each pixel point in the terrain height 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;
selecting a path line segment with the corresponding distance within a preset range and the minimum value from the distances between each pixel point in the terrain height map and each path line segment of the terrain curve as a reference path line segment of the height pixel point;
calculating the distance proportion of each pixel point in the height map to the nearest terrain curve line segment, wherein the distance proportion of each pixel point in the height map to the nearest terrain curve line segment is 1- (distance/maxRange), the distance is the distance between the pixel point and the nearest terrain curve line segment, and the maxRange is the offset distance of the pixel point;
correcting the distance proportion corresponding to the height pixel points closest to the terrain 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 height of the position of the height pixel point projected to the line segment with the shortest distance to the height pixel point in the terrain curve;
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 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 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 apparatus for a line model according to an embodiment of the present application. Referring to fig. 3, in one software implementation, the terrain adaptive apparatus for 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 migration unit is used for migrating the path points in the path curve corresponding to the line model in the vertical direction based on the maximum relief migration distance and the maximum height deviation ratio to obtain a relief curve of unit engineering;
the extraction unit is used for extracting a terrain height map of the area where the unit project is located according to original terrain data in a Unity3D engine;
the second determining unit is used for determining the distance between each pixel point in the terrain height map and each path line segment of the terrain curve, and the distance between the pixel point and each path line segment of the terrain curve is the horizontal distance between the pixel point and each path line segment of the terrain curve;
the selection unit is used for selecting a path line segment with the corresponding distance within a preset range and the minimum value from the distances between each pixel point in the topographic height map and each path line segment of the topographic curve as a reference path line segment of the height pixel point;
the first calculation unit is used for calculating the distance proportion of each pixel point in the height map to the nearest terrain curve line segment, wherein the distance proportion of each pixel point in the height map to the nearest terrain curve line segment is 1- (distance/maxRange), the distance is the distance between the pixel point and the nearest terrain curve line segment, and the maxRange is the offset distance of the pixel point;
the correction unit is used for correcting the distance proportion corresponding to the height pixel point closest 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, and the reference height of each height pixel point is the height of the position of the height pixel point projected to the line segment with the shortest distance to the height pixel point in the terrain curve;
the third determining unit is used for 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 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 topographic 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 short, the above description is only a preferred embodiment of this document, and is not intended to limit the scope of protection of this document. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of this document shall be included in the protection scope of this document.
The systems, devices, modules or units illustrated in the above embodiments may be implemented by a computer chip or an entity, or by a product with certain functions. One typical implementation device is a computer. In particular, the computer may be, for example, a personal computer, a laptop computer, a cellular telephone, a camera phone, a smartphone, 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 computer storage media 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 that can be used to store information that can be accessed by a computing device. As defined herein, a computer readable medium does not include a transitory computer readable medium such as a modulated data signal and a carrier wave.
All the embodiments in this document are described in a progressive manner, and the same and similar parts among the embodiments can be referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, for the system embodiment, since it is substantially similar to the method embodiment, the description is simple, and for the relevant points, reference may be made to the partial description of the method embodiment.
Claims (10)
1. A terrain adaptive method for a line model, comprising:
determining the maximum relief offset distance and the maximum height deviation ratio of the unit project corresponding to the line model based on the project type of the unit project corresponding to the line model;
on the basis of the maximum relief offset distance and the maximum height deviation ratio, offsetting the path points in the path curve corresponding to the line model in the vertical direction to obtain a relief curve of unit engineering;
extracting a terrain height map of the area where the unit project is located according to original terrain data in a Unity3D engine;
determining the distance between each pixel point in the terrain height 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;
selecting a path line segment with the corresponding distance within a preset range and the minimum value from the distances between each pixel point in the terrain height map and each path line segment of the terrain curve as a reference path line segment of the height pixel point;
calculating the distance proportion of each pixel point in the height map to the nearest terrain curve line segment, wherein the distance proportion of each pixel point in the height map to the nearest terrain curve line segment is 1- (distance/maxRange), the distance is the distance between the pixel point and the nearest terrain curve line segment, and the maxRange is the offset distance of the pixel point;
correcting the distance proportion corresponding to the height pixel points closest to the terrain 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 height of the position of the height pixel point projected to the line segment with the shortest distance to the height pixel point in the terrain curve;
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 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 topographic height map;
and regenerating a terrain model matched with the line model according to the latest terrain height map.
2. The method of claim 1, wherein the engineering type of the unit project corresponding to the line model is one of a roadbed, a bridge and a tunnel, and the determining the maximum terrain offset distance and the maximum height deviation ratio of the unit project corresponding to the line model based on the engineering type of the unit project corresponding to the line model comprises:
if the project type of the unit project corresponding to the line model is a roadbed, the maximum relief offset distance and the maximum height deviation ratio of the unit project corresponding to the line model are both 0;
if the project type of the unit project corresponding to the line model is a bridge, the maximum relief offset distance of the unit project corresponding to the line model is the distance between the bridge and the bearing platform, and the maximum height deviation proportion of the unit project corresponding to the line model is-0.5 sin (x Pi);
if the project type of the unit project corresponding to the line model is a tunnel, the maximum relief offset distance of the unit project corresponding to the line model is half of the head-tail distance of the line model, and the maximum height deviation proportion of the unit project corresponding to the line model is 0.5 sin (x Pi);
wherein x is the proportion of the distance between the current position and the starting point of the path curve in the total length of the path curve.
3. The method according to claim 1, wherein the offset distance of the path point in the vertical direction in the path curve corresponding to the line model is maxhieghtoffset _ heightoffset ratio, where maxhieghtoffset is the maximum relief offset distance of the unit project corresponding to the line model, and heightoffset ratio is the maximum height deviation ratio of the unit project corresponding to the line model.
4. The method of claim 1, wherein calculating the distance ratio between each pixel point in the height map and the nearest topographic curve segment comprises:
calculating the offset distance of each pixel point in the terrain height map;
calculating the minimum distance between each pixel point in the terrain height map and the nearest terrain curve line segment;
and obtaining the distance proportion of each pixel point in the terrain height map to the terrain curve line segment according to the offset distance of each pixel point in the terrain height map and the minimum distance between each pixel point in the terrain height map and the nearest terrain curve line segment.
5. The method of claim 1, wherein the modified distance ratio is 0.5 (cos (X Pi) +1), where X is the distance ratio corresponding to the height pixel closest to the path curve.
6. The method according to claim 1, wherein the final height of the height pixel is position ws.y + (target height-position ws.y) rate + height offset, where position ws.y is the original height of the height pixel, target height 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.
7. The method of claim 1, further comprising:
and calculating the coordinate of each pixel point in the topographic height map based on the pixel coordinate of each pixel point in the topographic height map and the offset distance of the pixel point.
8. A terrain adaptive apparatus 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 migration unit is used for migrating the path points in the path curve corresponding to the line model in the vertical direction based on the maximum relief migration distance and the maximum height deviation ratio to obtain a relief curve of unit engineering;
the extraction unit is used for extracting a terrain height map of the area where the unit project is located according to original terrain data in a Unity3D engine;
the second determining unit is used for determining the distance between each pixel point in the terrain height map and each path line segment of the terrain curve, and the distance between the pixel point and each path line segment of the terrain curve is the horizontal distance between the pixel point and each path line segment of the terrain curve;
the selection unit is used for selecting a path line segment with the corresponding distance within a preset range and the minimum value from the distances between each pixel point in the topographic height map and each path line segment of the topographic curve as a reference path line segment of the height pixel point;
the first calculation unit is used for calculating the distance proportion of each pixel point in the height map to the nearest terrain curve line segment, wherein the distance proportion of each pixel point in the height map to the nearest terrain curve line segment is 1- (distance/maxRange), the distance is the distance between the pixel point and the nearest terrain curve line segment, and the maxRange is the offset distance of the pixel point;
the correction unit is used for correcting the distance proportion corresponding to the height pixel point closest 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, and the reference height of each height pixel point is the height of the position of the height pixel point projected to the line segment with the shortest distance to the height pixel point in the terrain curve;
the third determining unit is used for 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 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 topographic 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.
9. An electronic device is characterized by comprising a processor, a communication interface, a memory and a communication bus, wherein the processor and the communication interface are used for realizing the communication between the processor and the memory through the bus;
a memory for storing a computer program;
a processor for executing a program stored in a memory for implementing a method for terrain adaptation for a route model according to any of claims 1 to 7.
10. A computer-readable storage medium, in which a computer program is stored which, when being executed by a processor, carries out a method for terrain adaptation of a line model according to any one of claims 1 to 7.
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 true CN113570718A (en) | 2021-10-29 |
CN113570718B 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 (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20180122135A1 (en) * | 2015-04-30 | 2018-05-03 | University Of Cape Town | Systems and methods for synthesising a terrain |
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 |
-
2021
- 2021-07-29 CN CN202110866849.7A patent/CN113570718B/en active Active
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20180122135A1 (en) * | 2015-04-30 | 2018-05-03 | University Of Cape Town | Systems and methods for synthesising a terrain |
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 |
---|
HONG FAN 等: "An on-demand provision model for geospatial multisource information with active self-adaption services", 《MIPPR 2015: REMOTE SENSING IMAGE PROCESSING, GEOGRAPHIC INFORMATION SYSTEMS, AND OTHER APPLICATIONS》, vol. 9815, pages 1 - 8 * |
刘雪梅 等: "Unity3D下一种基于Perlin噪声的地形仿真方法", 《软件导刊》, vol. 18, no. 4, pages 174 - 178 * |
张森 等: "一种自适应混合加权动态推算地形生成算法", 《系统仿真学报》, vol. 23, no. 8, pages 1601 - 1605 * |
蔡润博 等: "基于单样本的大场景地形高度图合成系统设计与实现", 《信息通信》, no. 7, pages 31 - 33 * |
Also Published As
Publication number | Publication date |
---|---|
CN113570718B (en) | 2023-06-23 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
JP5736526B2 (en) | Location search method and apparatus based on electronic map | |
CN107742313B (en) | Data compression method and device applied to vector space | |
CN110287831B (en) | Method and device for acquiring control point based on landmark and electronic equipment | |
CN113256742B (en) | Interface display method and device, electronic equipment and computer readable medium | |
CN110807983B (en) | Area adjustment method and device of electronic map and electronic equipment | |
CN112200851B (en) | Point cloud-based target detection method and device and electronic equipment thereof | |
CN110276024A (en) | A kind of method and device that information is shown | |
CN112669465B (en) | Scene change method, electronic device and storage medium | |
CN110677810B (en) | Method and apparatus for generating geo-fences | |
CN115209349A (en) | Geofence detection method and device and electronic equipment | |
CN108280135B (en) | Method and device for realizing visualization of data structure and electronic equipment | |
CN110458954B (en) | Contour line generation method, device and equipment | |
CN113658342B (en) | Method, system, electronic device and storage medium for generating AR navigation path | |
CN108280154B (en) | Method and device for displaying map annotation information, terminal and readable storage medium | |
CN113570718A (en) | Terrain self-adaption method and device of line model, electronic equipment and storage medium | |
CN114065868B (en) | Training method of text detection model, text detection method and device | |
CN112800351B (en) | Track similarity judging method, system and computer medium | |
CN112580638B (en) | Text detection method and device, storage medium and electronic equipment | |
CN112906708B (en) | Picture processing method and device, electronic equipment and computer storage medium | |
CN114863206A (en) | Model training method, target detection method and device | |
JP2012198310A (en) | Map element arrangement device and map element arrangement method | |
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 | |
CN110737740A (en) | resource recommendation method, device and storage medium | |
CN116630436B (en) | Camera external parameter correction method, camera external parameter correction device, electronic equipment and computer readable medium |
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 |