Map water area division method and device, electronic equipment and storage medium
By obtaining and processing the water grid map of the game map, and automatically moving and marking the vertices of the water area, the problem of inaccuracy in the water area caused by artificial marking in the prior art is solved, and a higher degree of accuracy and automation is achieved.
Patent Information
- Application Number
- CN202411514755.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-28
- Publication Date
- 2025-05-09
- Estimated Expiration
- 2044-10-28
AI Technical Summary
In the prior art, the water area marking method on the game map mainly relies on manual and manual operation, resulting in inconsistent, incomplete or incorrect markings, resulting in low accuracy of the water area.
By obtaining the water grid map of the target map, the edge distance between the grid vertex and the edge of the water area is determined. Based on this distance, the vertex movement parameters are determined, and the edge grid vertex is controlled to move to the center of the water area until the central range is reached, thereby determining the water area type.
It realizes automated control of edge grid vertex movement, and defines the water area type based on the moving distance, avoids artificial marking exceptions, and improves the accuracy of water division in the map.
Smart Images

Figure CN119963569A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of data processing technology, and in particular to a method, device, electronic device and storage medium for dividing water areas of a map. Background Art
[0002] Under the wave of the Internet, the continuous development and evolution of hardware and software technologies have promoted the emergence of smart devices and software. At the same time, a large number of games with different themes have emerged to meet the needs of users. In some games, different water areas on the game map need to be marked to divide the water areas on the game map, thereby providing a more realistic and diverse gaming environment to enhance the user experience.
[0003] Currently, water areas on game maps are marked manually. Due to the different complexities of terrain features in different game maps, abnormal marking of water areas in game maps occurs, such as inconsistent marking, incomplete marking, incorrect marking, etc., resulting in low accuracy of the water areas in the divided game maps. Summary of the invention
[0004] The embodiments of the present application provide a method, device, electronic device and storage medium for dividing water areas in a map, which can improve the accuracy of dividing water areas in a map.
[0005] In a first aspect, an embodiment of the present application provides a method for dividing water areas of a map, the method comprising:
[0006] Acquire a water area grid map of a target map, wherein the water area grid map includes at least one water area of the target map, and the water area is composed of a plurality of grids;
[0007] Determining edge distances between grid vertices of the grid and an edge of the water area, wherein the grid vertices include edge grid vertices located at an edge of the area;
[0008] Determining vertex movement parameters of the edge mesh vertices based on edge distances between the mesh vertices and the edge of the region;
[0009] Based on the vertex movement parameter of the edge mesh vertex, control the edge mesh vertex to move toward the center of the water area until it is determined that the edge mesh vertex is in the central range of the water area, and determine the movement distance of the edge mesh vertex;
[0010] Based on the moving distance of the edge mesh vertex, the water area type corresponding to the edge mesh vertex is determined.
[0011] In a second aspect, an embodiment of the present application provides a water area division device for a map, the device comprising:
[0012] An acquisition module, used for acquiring a water area grid map of a target map, wherein the water area grid map includes at least one water area of the target map, and the water area is composed of a plurality of grids;
[0013] A distance determination module, used to determine the edge distance between the grid vertices of the grid and the area edge of the water area, wherein the grid vertices include edge grid vertices located at the edge of the area;
[0014] A parameter determination module, used for determining a vertex movement parameter of the edge mesh vertex based on an edge distance between the mesh vertex and the edge of the region;
[0015] A moving module, for controlling the edge mesh vertex to move toward the center of the water area based on the vertex movement parameter of the edge mesh vertex, until it is determined that the edge mesh vertex is in the central range of the water area, and determining the moving distance of the edge mesh vertex;
[0016] The type determination module is used to determine the water area type corresponding to the above edge mesh vertex based on the movement distance of the above edge mesh vertex.
[0017] In a third aspect, an embodiment of the present application further provides an electronic device, comprising a memory storing a plurality of instructions; a processor loads the instructions from the memory to execute the steps of any method for dividing a water area of a map provided in an embodiment of the present application.
[0018] In a fourth aspect, an embodiment of the present application further provides a computer-readable storage medium, which stores a plurality of instructions suitable for loading by a processor to execute the steps of any method for dividing a water area of a map provided in an embodiment of the present application.
[0019] In a fifth aspect, an embodiment of the present application also provides a computer program product, including a computer program or instructions, which, when executed by a processor, implements the steps in the method for dividing a water area of any map provided in the embodiment of the present application.
[0020] By adopting the scheme of the embodiment of the present application, a water area grid map of the target map can be obtained, wherein the water area grid map includes at least one water area of the target map, and the water area is composed of multiple grids, and then the edge distance between the grid vertices of the grid and the area edge of the water area is determined, wherein the grid vertices include edge grid vertices located at the edge of the area. Then, based on the edge distance between the grid vertices and the edge of the area, the vertex movement parameters of the edge grid vertices are determined. Finally, based on the vertex movement parameters of the edge grid vertices, the edge grid vertices are controlled to move toward the center of the water area until it is determined that the edge grid vertices are in the central range of the water area, and the movement distance of the edge grid vertices is determined, so as to determine the water area type corresponding to the edge grid vertex based on the movement distance of the edge grid vertex, so as to automatically control the movement of the edge grid vertices to clarify the corresponding water area type based on the movement distance, thereby avoiding the marking anomaly when the water area is manually marked, so as to improve the accuracy of the water area division in the map. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For those skilled in the art, other drawings can be obtained based on these drawings without creative work.
[0022] Figure 1 This is a schematic diagram of an embodiment of a method for dividing a water area of a map provided in an embodiment of the present application;
[0023] Figure 2 is a schematic diagram of a target map provided in an embodiment of the present application;
[0024] Figure 3 is a schematic diagram of a water area grid map provided in an embodiment of the present application;
[0025] Figure 4 is a schematic diagram of the distribution of edge mesh vertices provided in an embodiment of the present application;
[0026] Figure 5 This is a schematic diagram showing a water area provided in an embodiment of the present application;
[0027] Figure 6 is a schematic diagram of an example of calculating a vertex movement vector provided in an embodiment of the present application;
[0028] Figure 7 is a schematic diagram of vertex movement vectors of mesh vertices provided in an embodiment of the present application;
[0029] Figure 8 is a schematic diagram of the movement process of edge mesh vertices provided in an embodiment of the present application;
[0030] Fig. 9 is a schematic diagram of the distribution of edge mesh vertices after movement provided in an embodiment of the present application;
[0031] Fig.10 This is another schematic diagram showing a water area provided in an embodiment of the present application;
[0032] Fig.11 is a schematic diagram of the distribution of water area types provided in the embodiments of the present application;
[0033] Fig.12 is a schematic diagram of the distribution of water area types after data noise reduction provided in an embodiment of the present application;
[0034] Fig.13 It is a schematic diagram of the structure of a water area division device for a map provided in an embodiment of the present application;
[0035] Fig.14 It is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0036] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without making creative work are within the scope of protection of the present application. At the same time, in the description of the embodiments of the present application, the terms "first", "second", etc. are only used to distinguish the descriptions and cannot be understood as indicating or implying relative importance. Thus, the features defined as "first" and "second" may explicitly or implicitly include one or more features. In the description of the embodiments of the present application, the meaning of "multiple" is two or more, unless otherwise clearly and specifically defined.
[0037] Embodiments of the present application provide a method, device, electronic device, and computer-readable storage medium for dividing water areas on a map.
[0038] Specifically, this embodiment will be described from the perspective of a water division device for a map, which can be integrated into an electronic device, that is, the water division method for a map in the embodiment of the present application can be executed by an electronic device, which can be associated with an Unreal Engine and / or a digital content creation tool HOUDINI to implement the water division method for a map provided in the embodiment of the present application, and optionally, the electronic device can include: a terminal device. The terminal device can be a mobile phone, a tablet computer, a smart Bluetooth device, a laptop, a game console, or a personal computer (PC) and other devices.
[0039] The water division method of a map provided in an embodiment of the present application can be applied to a water division system of a map. The water division system of the map can include a player terminal device and a server, and the terminal can be a device including both receiving and transmitting hardware, that is, a device having receiving and transmitting hardware capable of performing two-way communication on a two-way communication link. The player terminal device and the server can perform two-way communication through a network.
[0040] Optionally, the server may be an independent server, or a server network or server cluster composed of servers, including but not limited to a computer, a network host, a single network server, a plurality of network server sets or a cloud server composed of multiple servers. The cloud server is composed of a large number of computers or network servers based on cloud computing.
[0041] The following is a detailed description in conjunction with the accompanying drawings. In this embodiment, the execution subject is a terminal device as an example. It should be noted that the description order of the following embodiments is not intended to limit the preferred order of the embodiments. Although the logical order is shown in the flowchart, in some cases, the steps shown or described may be performed in an order different from that shown in the accompanying drawings.
[0042] The water area division method of a map of the present embodiment is by obtaining a water area grid map of a target map, wherein the water area grid map includes at least one water area of the target map, and the water area is composed of multiple grids; determining the edge distance between the grid vertices of the grid and the area edge of the water area, wherein the grid vertices include edge grid vertices located at the edge of the area; determining the vertex movement parameters of the edge grid vertices based on the edge distances between the grid vertices and the area edge; controlling the edge grid vertices to move toward the center of the water area based on the vertex movement parameters of the edge grid vertices until it is determined that the edge grid vertices are within the central range of the water area, and determining the movement distance of the edge grid vertices; determining the water area type corresponding to the edge grid vertex based on the movement distance of the edge grid vertex, so as to improve the accuracy of water area division in the map.
[0043] Please refer to Figure 1 Taking a terminal as an example, this embodiment provides a method for dividing water areas on a map. The specific process of the method for dividing water areas on a map may be as follows: Steps 101 to 105, wherein:
[0044] Step 101: Acquire a water grid map of a target map, wherein the water grid map includes at least one water area of the target map, and the water area is composed of a plurality of grids.
[0045] The target map is a map for water area division, and the target map includes at least one water area, which may be an area composed of different types of water resources such as streams, rivers, lakes or oceans.
[0046] In this embodiment, the terminal obtains a water area grid map corresponding to the target map, so as to identify and process each water area of the target map based on the water area grid map, thereby clarifying the area type of each water area of the target map.
[0047] Among them, the grids that make up the water area in the above-mentioned water area grid map can be triangles, rectangles, etc., which can be set specifically according to needs and are not limited here.
[0048] In some embodiments, the above-mentioned method of obtaining the water grid map of the target map may include: the terminal can directly obtain the water grid map corresponding to the target map which has been pre-divided into grids, the size of the water grid map matches the target map, and the size of the water area in the water grid map matches the size of the water area position in the target map; and / or, the terminal can generate the water grid map corresponding to the target map based on the target map.
[0049] Specifically, the terminal may generate a water area grid map corresponding to the target map based on the target map, which may include: the terminal may obtain the target map to be processed, such as Figure 2 The target map shown, Figure 2 The black area in the figure is the water area. Then, the terminal can determine the water area in the target map based on the water area data in the target map, wherein the water area data may include the location and area of the water area, etc. The water area data can be obtained by the terminal recognition or by user input, and can be set according to the needs, which is not limited here.
[0050] Finally, the terminal can generate a water mask map based on the water area in the target map. For example, the mask information corresponding to the water area in the target map is set to 1, and the mask information of the non-water area in the target map is set to 0. Then, by setting filtering conditions, such as mask<0.01, the non-water area is eliminated to obtain a water mask map containing only the water area. In addition, in order to facilitate the identification of the water area, the terminal can also convert the terrain field in the water mask map into a grid to generate multiple grids in the water area of the water mask map to obtain the water grid map of the target map, such as Figure 3 shown.
[0051] Step 102: determine the edge distance between the grid vertices of the above-mentioned grid and the area edge of the above-mentioned water area, wherein the above-mentioned grid vertices include edge grid vertices located at the edge of the above-mentioned area.
[0052] In this embodiment, since the water area in the above-mentioned water grid map is composed of multiple grids, and each grid is composed of grid vertices, the terminal can determine the edge distance between each grid vertex of each grid and the area edge of the water area, so that the terminal can further identify the type of the water area based on the edge distance to divide the water area in the target map.
[0053] It can be understood that since the water area in the water area grid map is composed of grids, there are also some edge grids in the grid that are located at the edge of the water area. At least one grid vertex in the edge grid is located on the edge of the area. In this regard, in this embodiment, the grid vertices located at the edge of the area in the edge grid are used as edge grid vertices, that is, some of the grid vertices of the grids that constitute the water area are edge grid vertices.
[0054] In some embodiments, the method of determining the edge mesh vertices may include: the terminal may traverse the non-shared edges in the water area, and use the mesh vertices located on the non-shared edges as the edge mesh vertices. The terminal may set the unshared attribute in the built-in organization method (Group method) to determine the non-shared edges in the mesh area, such as Figure 3 The regional edge of the water area in the water area is determined to determine the mesh vertices on the non-shared edge in the water area, and then the Blast method is used to remove the mesh vertices on the shared edge, such as Figure 4 As shown, Figure 4 The mesh vertices retained after the culling in are used as edge mesh vertices, so as to realize that the mesh vertices on the non-shared edges are used as edge mesh vertices, and the edge mesh vertices are stored in a preset variable so that the variable can be called when the edge mesh vertices are processed later.
[0055] In some embodiments, the method of determining the edge distance between the grid vertex of the above-mentioned grid and the area edge of the above-mentioned water area may include: the terminal may calculate the shortest distance between the grid vertex and the area edge; or, the terminal may use the distance between the above-mentioned grid vertex and the target edge grid vertex as the edge distance between the above-mentioned grid vertex and the above-mentioned area edge, wherein the above-mentioned target edge grid vertex is the edge grid vertex closest to the above-mentioned grid vertex.
[0056] In some embodiments, after determining the edge distance between the grid vertices of the above-mentioned grid and the area edge of the above-mentioned water area, the terminal can store the edge distance of each grid vertex in the vertex attribute (dist attribute) of each grid vertex, so that when needed, the corresponding edge distance can be directly obtained from the vertex attribute of the grid vertex.
[0057] In some embodiments, in order to facilitate relevant users to observe the distribution of various water areas in the water grid map, different positions of the water area in the water grid map can be assigned corresponding color values based on the distance of each grid vertex from the edge of the area to present a gradient effect, thereby facilitating users to observe the distribution of the water areas.
[0058] Specifically, after determining the edge distance between the grid vertex of the above-mentioned grid and the regional edge of the above-mentioned water area, it can also include: the terminal can determine the target color value corresponding to the above-mentioned grid vertex based on the preset color mapping relationship and the edge distance of the above-mentioned grid vertex, wherein the above-mentioned color mapping relationship is used to indicate the mapping relationship between the above-mentioned edge distance and the color value. Then, the terminal can display the regional color of the above-mentioned water area in the above-mentioned water area grid map based on the target color value corresponding to the above-mentioned grid vertex.
[0059] The color value may be higher when the edge distance is larger, or may be smaller when the edge distance is larger. The specific setting can be made according to the requirements and is not limited here.
[0060] For example, if the mapping relationship between edge distance and color value is set as follows: edge distance [0-500] corresponds to color value [0-1], if the edge distance exceeds 500, the corresponding color value is 1, so that the corresponding color value can be determined based on the edge distance of the mesh vertex, and if 0 is set to black and 1 is set to white, then Figure 5 As shown, in Figure 5 In the water area of the water grid map shown, the farther the grid vertices are from the edge of the area, the whiter the color is.
[0061] Step 103: Determine vertex movement parameters of the edge mesh vertices based on the edge distance between the mesh vertices and the region edge.
[0062] In this embodiment, after obtaining the edge distance between the grid vertex and the edge of the area, the terminal can clarify the distribution of each grid vertex in the corresponding water area, and thus determine the vertex movement parameters of the edge grid vertices at the edge of the water area based on the distribution of each grid vertex in the corresponding water area, so as to explore the water area based on the movement of the edge grid vertex to the center of the water area, thereby clarifying the type of water area where the edge grid vertex is located.
[0063] The vertex movement parameters are used to control the edge mesh vertices to move toward the center of the water area.
[0064] The vertex movement parameter is used to indicate the direction and distance of movement. For example, the vertex movement parameter can be a vertex movement vector. The vertex movement vector, as a direction vector, can be used to indicate the direction of vertex movement, and the modulus of the vertex movement vector can be used to indicate the distance of vertex movement. The longer the modulus, the greater the distance of movement. Since the vertex movement parameter is used to control the edge mesh vertex to move toward the center of the water area, the vertex movement vector is a vector pointing to the center of the water area.
[0065] In some embodiments, the above-mentioned determination of the vertex movement parameter of the edge mesh vertex based on the edge distance between the mesh vertex and the edge of the region may include: the terminal may determine at least two first mesh vertices adjacent to the edge mesh vertex from the mesh vertices. Then, the terminal determines the vertex movement parameter of the edge mesh vertex based on the relative direction of the edge mesh vertex and each of the first mesh vertices, and the edge distance of each of the first mesh vertices.
[0066] It can be understood that, since the mesh vertices include edge mesh vertices, the first mesh vertices adjacent to the edge mesh vertices may also include other edge mesh vertices.
[0067] In this embodiment, the terminal determines how to move the edge mesh vertex based on relevant information of the first mesh vertices around the edge mesh vertex, so as to enable the edge mesh vertex to move toward the center of the water area.
[0068] Specifically, the vertex movement parameters include vertex movement vectors. The vertex movement parameters of the edge mesh vertices are determined based on the relative directions of the edge mesh vertices and the first mesh vertices, and the edge distances of the first mesh vertices. The method may include: the terminal may determine the direction vectors of the edge mesh vertices and the first mesh vertices based on the relative directions of the edge mesh vertices and the first mesh vertices. Then, the terminal calculates the distance difference between the edge distance of the edge mesh vertex and the edge distance of the first mesh vertices. Finally, the terminal may perform comprehensive processing on the product of the direction vector and the distance difference of each first mesh vertex based on the product of the direction vector and the distance difference of each first mesh vertex to determine the vertex movement vector of the edge mesh vertex.
[0069] The comprehensive processing may be performed by calculating the sum of the products corresponding to the first mesh vertices to obtain the vertex movement vector of the edge mesh vertex. In addition, for ease of management, the sum of the products corresponding to the first mesh vertices may be further normalized to obtain the normalized vector as the vertex movement vector.
[0070] For example, Figure 6 As shown, in Figure 6Mesh vertices A, B, C, D, E, F, and G are set in. At this time, if the vertex movement vector of mesh vertex C is calculated, the first direction vectors of mesh vertex C and mesh vertex B, the second direction vectors of mesh vertex C and mesh vertex A, and the third direction vectors of mesh vertex C and mesh vertex D need to be calculated respectively. If the edge distance of mesh vertex C is set to 0, the edge distance of mesh vertex B is set to 0.5, the edge distance of mesh vertex A is set to 1, and the edge distance of mesh vertex D is set to 0.1, then, by calculating the first product of the first direction vector and -0.5, calculating the second product of the second direction vector and -1, and calculating the third product of the third direction vector and -0.1, then calculating the sum of the first product, the second product, and the third product, and performing modulus normalization processing on the sum of the first product, the second product, and the third product, so that the normalized vector is used as the above-mentioned vertex movement vector. If the edge distance is mapped to the interval from 0 to 1, the position of the mesh vertex A is the center position of the water area, and the vertex movement vector of the mesh vertex C is a vector pointing to A.
[0071] In some embodiments, since the mesh vertices may have to move multiple times to get closer and closer to the center of the water area, the vertex movement parameters of the edge mesh vertices can be determined while the vertex movement parameters of each mesh vertex are determined, so that after the edge mesh vertices are moved, the vertex movement parameters of the edge mesh vertices can be determined based on the vertex movement parameters of each mesh vertex.
[0072] For example, Figure 7 As shown, Figure 7 The water area shown includes the vertex movement vectors of each mesh vertex, from Figure 7 It can be seen that the vertex movement vector of each mesh vertex points to the center of the water area.
[0073] Step 104: Based on the vertex movement parameters of the edge mesh vertices, control the edge mesh vertices to move toward the center of the water area until it is determined that the edge mesh vertices are in the central range of the water area, and determine the movement distance of the edge mesh vertices.
[0074] In this embodiment, the terminal can control the movement of edge mesh vertices toward the center of the water area based on the vertex movement parameters of the edge mesh vertices, thereby converting the edge of the water area into a point, and continuously pushing the point toward the center of the water area until the center of the water area is reached. The movement distance of the point, that is, the movement distance of the above-mentioned edge mesh vertex, is determined, and the water area where the edge mesh vertex is located is explored based on the movement distance of the edge mesh vertex, thereby clarifying the type of the water area where the edge mesh vertex is located.
[0075] It can be understood that when the edge grid vertex is within the central range of the water area, it means that the edge grid vertex is close to the center of the water area, wherein the central range can be understood as a range divided by the center of the water area, for example, the range is divided by the central position of the water area in the moving direction of the edge grid vertex.
[0076] For example, Figure 8 As shown in the figure, the grid vertices at the edge of the water area in the water area grid map move toward the center of the water area, such as Figure 8 The edge mesh vertices around the arrow in the middle move toward the center of the water area according to the direction of the arrow until the edge mesh vertices move to a position close to the center of the water area, such as Fig. 9 As shown, Fig. 9 The edge mesh vertices of the water area are moved closer to the center of the water area.
[0077] It is understandable that since one movement of the edge mesh vertex may not necessarily be within the central range of the above-mentioned water area, but there may be multiple movements, when it is determined that the above-mentioned edge mesh vertex is not within the central range of the above-mentioned water area, it is necessary to redetermine the vertex movement parameters of the moved edge mesh vertex so as to control the edge mesh vertex to continue moving based on the redetermined vertex movement parameters.
[0078] Among them, the above-mentioned method of re-determining vertex movement parameters may include: the terminal may return to execute the step of determining the vertex movement parameters of the edge mesh vertices based on the edge distance between the above-mentioned mesh vertices and the above-mentioned area edge, so as to obtain the vertex movement parameters of the edge mesh vertices after the movement; or, the terminal may determine the vertex movement parameters of the edge mesh vertices after the movement based on the vertex movement parameters of each mesh vertex determined in advance; or, the two may be combined, and the terminal may determine the vertex movement parameters of at least some of the mesh vertices based on the edge distance between the mesh vertices and the above-mentioned area edge while returning to execute the step of determining the vertex movement parameters of the edge mesh vertices based on the edge distance between the mesh vertices and the above-mentioned area edge, so as to determine the vertex movement parameters of the edge mesh vertices after the movement based on the vertex movement parameters of at least some of the mesh vertices.
[0079] Specifically, the determination condition that the edge mesh vertex is located in the center of the water area may include: determining whether the edge mesh vertex is located in the center range of the water area based on the moving distance indicated by the vertex moving parameter, or determining whether the edge mesh vertex is located in the center range of the water area based on the number of times the edge mesh vertex moves, that is, if the moving distance indicated by the vertex moving parameter is less than or equal to a preset distance threshold, determining that the edge mesh vertex is located in the center range of the water area; and / or, if the number of times the edge mesh vertex moves is not less than a preset number threshold, determining that the edge mesh vertex is located in the center range of the water area.
[0080] Among them, the above-mentioned preset distance threshold and the above-mentioned preset number threshold can be set according to needs and are not limited here. For example, the above-mentioned preset distance threshold can be set to 0.5 units, and the above-mentioned preset number threshold can be set to 60 times.
[0081] In some embodiments, after controlling the edge mesh vertex to move toward the center of the water area based on the vertex movement parameters of the edge mesh vertex, the method may further include: the terminal may obtain the target position after the edge mesh vertex moves; if it is determined that the edge mesh vertex is not within the central range of the water area, then based on the target position, returning to execute the step of determining the vertex movement parameters of the edge mesh vertex based on the edge distance between the mesh vertex and the edge of the area.
[0082] In some embodiments, the step of returning to determine the vertex movement parameters of the edge mesh vertices based on the edge distance between the mesh vertices and the edge of the region based on the target position may include: the terminal may determine at least two second mesh vertices adjacent to the edge mesh vertex at the target position from the mesh vertices. Then, the terminal determines the vertex movement parameters of each of the second mesh vertices based on the edge distance between the mesh vertex and the edge of the region. Finally, the terminal determines the vertex movement parameters of the edge mesh vertices at the target position based on the vertex movement parameters of each of the second mesh vertices.
[0083] It is understandable that, since the mesh vertices include edge mesh vertices, the first mesh vertex adjacent to the second mesh vertex may also include edge mesh vertices. Furthermore, the terminal determines the vertex movement parameters of the moved edge mesh vertex when it moves again by determining the vertex movement parameters of the second mesh vertices around the moved edge mesh vertex.
[0084] Among them, the terminal can perform mean processing on the vertex movement parameters of each second mesh vertex to obtain the vertex movement parameters when the edge mesh vertex at the target position moves again, or the terminal can also perform interpolation processing on the vertex movement parameters of each second mesh vertex based on the relative position of the edge mesh vertex between each second mesh vertices to obtain the vertex movement parameters when the edge mesh vertex at the target position moves again, etc. The specific determination method can be set according to needs and is not limited here.
[0085] In some embodiments, the vertex movement parameters include vertex movement vectors, and the vertex movement parameters of each of the second mesh vertices are determined based on the edge distance between the mesh vertex and the edge of the region, and may include: the terminal may determine at least two third mesh vertices adjacent to the second mesh vertex from the mesh vertices. Then, the terminal determines the vertex movement vector of the second mesh vertex based on the relative direction of the second mesh vertex and each of the third mesh vertices, and the edge distance of each of the third mesh vertices.
[0086] It is understandable that, since the mesh vertices include edge mesh vertices, the third mesh vertex adjacent to the second mesh vertex may also include other edge mesh vertices. Furthermore, the terminal determines how the second mesh vertex moves through the relevant information of the third mesh vertices around the second mesh vertex, so as to enable the second mesh vertex to move toward the center of the water area, so as to determine the movement mode of the edge mesh vertices in each second mesh vertex based on the movement mode of the second mesh vertex.
[0087] Specifically, the vertex movement parameters include a vertex movement vector, and the above-mentioned determination of the vertex movement vector of the second mesh vertex based on the relative direction of the second mesh vertex and each of the third mesh vertices, and the edge distance of each of the third mesh vertices, may include: the terminal may determine the direction vectors of the second mesh vertex and each of the third mesh vertices based on the relative direction of the second mesh vertex and each of the third mesh vertices. Then, the terminal calculates the distance difference between the edge distance of the second mesh vertex and the edge distance of each of the third mesh vertices. Finally, the terminal may perform comprehensive processing on the product of the direction vector and the distance difference of each third mesh vertex based on the product of the direction vector and the distance difference of each third mesh vertex to determine the vertex movement vector of the second mesh vertex.
[0088] The comprehensive processing may be performed by calculating the sum of the products corresponding to the third mesh vertices to obtain the vertex movement vector of the second mesh vertex. In addition, for ease of management, the sum of the products corresponding to the third mesh vertices may be further normalized to obtain the normalized vector as the vertex movement vector.
[0089] Step 105: Determine the water area type corresponding to the edge mesh vertex based on the moving distance of the edge mesh vertex.
[0090] It is understandable that different types of water bodies correspond to different areas of water. For example, streams are usually smaller streams formed from springs or rainfall in mountainous or hilly areas, and are characterized by narrow width and fast water flow; while lakes are usually larger bodies of water that can be formed by rivers, streams or groundwater and accumulate on the surface, and are characterized by larger areas and slower water movement.
[0091] Therefore, in this embodiment, the terminal can determine the type of water area corresponding to the edge grid vertex based on the moving distance of the edge grid vertex, and thus set the water area corresponding to the edge grid vertex before or after the movement to the corresponding water area type, so as to automatically divide different types of water areas, thereby improving the accuracy of water area division in the map; and since the division is performed by the movement of the edge grid vertex, the consistency and authenticity of the terrain features can also be ensured.
[0092] Among them, the method of determining the type of water area based on the moving distance of the edge grid vertices can include: achieving it by setting a threshold interval, for example, a width less than a certain value (such as less than 1m) is a stream, a width within a certain range (such as greater than or equal to 1m and less than 50m) is a river, a width within a larger range (such as greater than or equal to 50m and less than 200m) is a lake, and a larger width (such as greater than or equal to 200m) is an ocean; or, a preset recognition model can be established to identify the matching water area type through the moving distance of the edge grid vertices, etc., which can be set specifically according to needs and is not limited here.
[0093] It is understandable that due to the different complexities of the terrain features of different game maps, if manual marking is used, once the river is designed, it will be very difficult to modify or adjust it, and manual re-marking is required, which greatly limits the changes and diversity of the game map. The water area division method of the map mentioned in this embodiment can realize automatic marking of the water area in the map, greatly improving the flexibility of the water area division of the map, so that when the map changes, the water area of the changed map can be automatically re-divided. In addition, the method mentioned in this embodiment can be used in the corresponding engine through a graphical interface platform, reducing adaptation problems in the development process.
[0094] In addition, since the manual marking of water areas on the map requires a lot of production time and labor costs, it is inefficient, especially for large-scale game maps. By processing the water area division method of the map mentioned in this embodiment, it is possible to automatically mark the water areas in the map to improve production efficiency and save human resources.
[0095] In some embodiments, after determining the water area type corresponding to the above-mentioned edge mesh vertices, it also includes: setting a corresponding group for each water area type to store the edge mesh vertices of the determined water area type into the corresponding group, so as to realize the recording of the water area type corresponding to each water area of the target map.
[0096] In some embodiments, in order to facilitate the user to view the water area type of the water area of the target map, corresponding colors can be set for different water area types, such as Fig.10 As shown, different water areas are set with corresponding colors.
[0097] In some embodiments, because the water area of the same water area type may be wide or narrow, the division of the water area types is intertwined and not particularly smooth, resulting in the determined water area types being fragmented and incomplete, such as Fig.11 As shown, Fig.11 The same water area contains colors corresponding to different water area types, which means that the water area type set for some locations in the same water area is different from the water area type corresponding to the whole. Therefore, the terminal can use the method of transmitting data from adjacent areas to each other to regularize and integrate the data, so as to obtain more complete and continuous water areas of the same type through data noise reduction.
[0098] Specifically, after determining the water area type corresponding to the edge grid vertex, the method may further include: the terminal may obtain the water area types corresponding to a preset number of edge grid vertices around the edge grid vertex. Then, based on the preset number of water area types, the terminal may update the water area type of the edge grid vertex to a target water area type, wherein the target water area type is the water area type with the largest number among the preset number of water area types.
[0099] For example, the terminal can set corresponding colors for different water area types, such as red, green, and blue. Then, the terminal obtains the colors corresponding to the 100 edge mesh vertices around the edge mesh vertex, and accumulates them to obtain the result value after the accumulation of each color, such as 89 for blue, 11 for green, and 0 for red. Then, the terminal can use the water area type corresponding to blue as the target water area type to update it to the water area type of the current edge mesh vertex, such as Fig.12 As shown, Fig.12 Shown is a schematic diagram of the water area type corresponding to the water area after data noise reduction.
[0100] It is understandable that due to the different distribution of water area types in the target map, such as "ocean" type water areas are only distributed at the edge of the target map, while "river" type water areas may be distributed around the terrain of the target map. Therefore, data noise reduction can be performed based on the distribution position of the water areas, that is, for water areas distributed in the inland area of the center of the target map, only some water area types can be compared. For example, red is set as the color corresponding to the "ocean" type water area. Then, when updating the water area type of the water area in the inland area of the center of the target map, only the result values corresponding to green and blue can be accumulated to speed up the calculation.
[0101] Finally, the terminal can write the water area type of each edge vertex after data noise reduction into the vertex color attribute of the corresponding water area. By writing different numerical values or color information on the vertex color, different types of water areas can be easily distinguished and colored on the material.
[0102] From the above content, it can be seen that by obtaining the water grid map of the target map, wherein the water grid map includes at least one water area of the target map, and the water area is composed of multiple grids, and then determining the edge distance between the grid vertices of the grid and the area edge of the water area, wherein the grid vertices include edge grid vertices located at the edge of the area. Then, based on the edge distance between the grid vertices and the edge of the area, the vertex movement parameters of the edge grid vertices are determined. Finally, based on the vertex movement parameters of the edge grid vertices, the edge grid vertices are controlled to move toward the center of the water area until it is determined that the edge grid vertices are in the central range of the water area, and the movement distance of the edge grid vertices is determined, so as to determine the water area type corresponding to the edge grid vertex based on the movement distance of the edge grid vertex, so as to automatically control the movement of the edge grid vertices to clarify the corresponding water area type based on the movement distance, thereby avoiding the marking anomaly when the water area is manually marked, so as to improve the accuracy of the water division in the map.
[0103] This embodiment also provides a water area division device for a map, and the water area division device for a map can be integrated in a terminal device. Fig.13 As shown, the water area division device of the map may include:
[0104] The acquisition module 1301 is used to acquire a water area grid map of a target map, wherein the water area grid map includes at least one water area of the target map, and the water area is composed of a plurality of grids;
[0105] A distance determination module 1302 is used to determine the edge distance between the grid vertices of the grid and the area edge of the water area, wherein the grid vertices include edge grid vertices located at the edge of the area;
[0106] A parameter determination module 1303, configured to determine a vertex movement parameter of the edge mesh vertex based on an edge distance between the mesh vertex and the edge of the region;
[0107] A moving module 1304 is used to control the edge mesh vertex to move toward the center of the water area based on the vertex movement parameter of the edge mesh vertex until it is determined that the edge mesh vertex is in the central range of the water area, and determine the moving distance of the edge mesh vertex;
[0108] The type determination module 1305 is used to determine the water area type corresponding to the edge mesh vertex based on the moving distance of the edge mesh vertex.
[0109] In some embodiments, the parameter determination module 1303 is specifically used to:
[0110] Determine at least two first mesh vertices adjacent to the edge mesh vertex from the mesh vertices;
[0111] Based on the relative directions of the edge mesh vertices and each of the first mesh vertices, and the edge distances of each of the first mesh vertices, vertex movement parameters of the edge mesh vertices are determined.
[0112] In some embodiments, the vertex movement parameter includes a vertex movement vector, and the parameter determination module 1303 is specifically used for:
[0113] Determining direction vectors of the edge mesh vertex and each of the first mesh vertices based on the relative directions of the edge mesh vertex and each of the first mesh vertices;
[0114] Calculate the distance difference between the edge distance of the edge mesh vertex and the edge distance of each of the first mesh vertices;
[0115] Based on the product of the direction vector of each first mesh vertex and the distance difference, a vertex movement vector of the edge mesh vertex is determined.
[0116] In some embodiments, the water area division device of the map further includes an execution module, and the execution module is specifically used to:
[0117] Get the target position of the edge mesh vertex after moving;
[0118] If it is determined that the edge mesh vertex is not in the central range of the water area, based on the target position, the step of returning to determine the vertex movement parameter of the edge mesh vertex based on the edge distance between the mesh vertex and the edge of the area is performed.
[0119] In some embodiments, the execution module is specifically used to:
[0120] Determine, from the mesh vertices, at least two second mesh vertices adjacent to the edge mesh vertex at the target position;
[0121] Determining a vertex movement parameter of each of the second mesh vertices based on an edge distance between the mesh vertices and the region edge;
[0122] Based on the vertex movement parameters of each of the second mesh vertices, vertex movement parameters of the edge mesh vertices at the target position are determined.
[0123] In some embodiments, the vertex movement parameter includes a vertex movement vector, and the execution module is specifically used for:
[0124] Determine at least two third mesh vertices adjacent to the second mesh vertex from the mesh vertices;
[0125] Based on the relative directions of the second mesh vertex and each of the third mesh vertices, and the edge distances of each of the third mesh vertices, a vertex movement vector of the second mesh vertex is determined.
[0126] In some embodiments, the determination condition that the edge mesh vertex is within the central range of the water area includes:
[0127] If the moving distance indicated by the vertex moving parameter is less than or equal to a preset distance threshold, it is determined that the edge mesh vertex is in the central range of the water area; and / or,
[0128] If the movement times of the edge mesh vertex is not less than a preset times threshold, it is determined that the edge mesh vertex is in the central range of the water area.
[0129] In some embodiments, the water area division device of the map further includes a display module, and the display module is specifically used for:
[0130] Determine a target color value corresponding to the mesh vertex based on a preset color mapping relationship and an edge distance of the mesh vertex, wherein the color mapping relationship is used to indicate a mapping relationship between the edge distance and the color value;
[0131] Based on the target color values corresponding to the mesh vertices, the regional color of the water area is displayed in the water area mesh map.
[0132] In some embodiments, the distance determination module 1302 is specifically used to:
[0133] The distance between the mesh vertex and the target edge mesh vertex is used as the edge distance between the mesh vertex and the edge of the region, wherein the target edge mesh vertex is the edge mesh vertex closest to the mesh vertex.
[0134] In some embodiments, the water area division device of the map further includes a type updating module, and the type updating module is specifically used to:
[0135] Obtain the water area types corresponding to a preset number of edge mesh vertices around the above edge mesh vertex;
[0136] Based on a preset number of water area types, the water area type of the edge mesh vertex is updated to a target water area type, wherein the target water area type is the largest water area type among the preset number of water area types.
[0137] From the above content, it can be seen that by obtaining the water grid map of the target map, wherein the water grid map includes at least one water area of the target map, and the water area is composed of multiple grids, and then determining the edge distance between the grid vertices of the grid and the area edge of the water area, wherein the grid vertices include edge grid vertices located at the edge of the area. Then, based on the edge distance between the grid vertices and the edge of the area, the vertex movement parameters of the edge grid vertices are determined. Finally, based on the vertex movement parameters of the edge grid vertices, the edge grid vertices are controlled to move toward the center of the water area until it is determined that the edge grid vertices are in the central range of the water area, and the movement distance of the edge grid vertices is determined, so as to determine the water area type corresponding to the edge grid vertex based on the movement distance of the edge grid vertex, so as to automatically control the movement of the edge grid vertices to clarify the corresponding water area type based on the movement distance, thereby avoiding the marking anomaly when the water area is manually marked, so as to improve the accuracy of the water division in the map.
[0138] Accordingly, an embodiment of the present application further provides an electronic device, which may be a terminal, and the terminal may be a smart phone, a tablet computer, a laptop computer, a touch screen, a game console, a personal computer (PC, Personal Computer), a personal digital assistant (Personal Digital Assistant, PDA) and other terminal devices. Alternatively, the electronic device may be a server.
[0139] like Fig.14 As shown, Fig.14 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. The electronic device 1400 includes a processor 1401 having one or more processing cores, a memory 1402 having one or more computer-readable storage media, and a computer program stored in the memory 1402 and executable on the processor. The processor 1401 is electrically connected to the memory 1402. It will be understood by those skilled in the art that the electronic device structure shown in the figure does not constitute a limitation on the electronic device, and may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently.
[0140] The processor 1401 is the control center of the electronic device 1400, and uses various interfaces and lines to connect various parts of the entire electronic device 1400. By running or loading software programs and / or units stored in the memory 1402, and calling data stored in the memory 1402, the processor 1401 executes various functions of the electronic device 1400 and processes data, thereby monitoring the electronic device 1400 as a whole. The processor 1401 can be a central processing unit CPU, a graphics processing unit GPU, a network processor (Network Processor, NP), etc., and can implement or execute the various methods, steps and logic block diagrams disclosed in the embodiments of the present application.
[0141] In the embodiment of the present application, the processor 1401 in the electronic device 1400 will load instructions corresponding to the processes of one or more application programs into the memory 1402 according to the following steps, and the processor 1401 will run the application programs stored in the memory 1402 to implement various functions, such as:
[0142] Acquire a water area grid map of a target map, wherein the water area grid map includes at least one water area of the target map, and the water area is composed of a plurality of grids;
[0143] Determining edge distances between grid vertices of the grid and an edge of the water area, wherein the grid vertices include edge grid vertices located at an edge of the area;
[0144] Determining vertex movement parameters of the edge mesh vertices based on edge distances between the mesh vertices and the edge of the region;
[0145] Based on the vertex movement parameter of the edge mesh vertex, control the edge mesh vertex to move toward the center of the water area until it is determined that the edge mesh vertex is in the central range of the water area, and determine the movement distance of the edge mesh vertex;
[0146] Based on the moving distance of the edge mesh vertex, the water area type corresponding to the edge mesh vertex is determined.
[0147] Therefore, the electronic device 1400 provided in this embodiment can bring the following technical effects: the accuracy of water area division in the map can be improved.
[0148] The specific implementation of the above operations can be found in the previous embodiments, which will not be described in detail here.
[0149] Optional, such as Fig.14 As shown, the electronic device 1400 further includes: a touch screen 1403, a radio frequency circuit 1404, an audio circuit 1405, an input unit 1406, and a power supply 1407. The processor 1401 is electrically connected to the touch screen 1403, the radio frequency circuit 1404, the audio circuit 1405, the input unit 1406, and the power supply 1407, respectively. Those skilled in the art can understand that Fig.14 The electronic device structure shown in the figure does not constitute a limitation of the electronic device, and may include more or less components than shown in the figure, or combine certain components, or arrange the components differently.
[0150] The touch display screen 1403 can be used to display a graphical user interface and receive operation instructions generated by the user acting on the graphical user interface. The touch display screen 1403 may include a display panel and a touch panel. Among them, the display panel may be used to display information input by the user or information provided to the user and various graphical user interfaces of the electronic device, and these graphical user interfaces may be composed of graphics, text, icons, videos and any combination thereof. Optionally, the display panel may be configured in the form of a liquid crystal display (LCD, Liquid Crystal Display), an organic light emitting diode (OLED, Organic Light-EmittingDiode) and the like. The touch panel may be used to collect the user's touch operation on or near it (such as the user using any suitable object or attachment such as a finger, a stylus, etc. on the touch panel or near the touch panel), and generate corresponding operation instructions, and the operation instructions execute corresponding programs. Optionally, the touch panel may include two parts, a touch detection device and a touch controller. Among them, the touch detection device detects the user's touch orientation, detects the signal brought by the touch operation, and transmits the signal to the touch controller; the touch controller receives the touch information from the touch detection device, converts it into the touch point coordinates, and then sends it to the processor 1401, and can receive the command sent by the processor 1401 and execute it. The touch panel can cover the display panel. When the touch panel detects a touch operation on or near it, it is transmitted to the processor 1401 to determine the type of touch event, and then the processor 1401 provides a corresponding visual output on the display panel according to the type of touch event. In an embodiment of the present application, the touch panel and the display panel can be integrated into the touch display screen 1403 to realize the input and output functions. However, in some embodiments, the touch panel and the touch panel can be used as two independent components to realize the input and output functions. That is, the touch display screen 1403 can also be used as a part of the input unit 1406 to realize the input function.
[0151] The radio frequency circuit 1404 may be used to send and receive radio frequency signals, so as to establish wireless communication with a network device or other electronic devices through wireless communication, and to send and receive signals between the network device or other electronic devices.
[0152] The audio circuit 1405 can be used to provide an audio interface between the user and the electronic device through a speaker and a microphone. The audio circuit 1405 can transmit the electrical signal converted from the received audio data to the speaker, which is converted into a sound signal for output; on the other hand, the microphone converts the collected sound signal into an electrical signal, which is received by the audio circuit 1405 and converted into audio data, and then the audio data is output to the processor 1401 for processing, and then sent to another electronic device through the radio frequency circuit 1404, or the audio data is output to the memory 1402 for further processing. The audio circuit 1405 may also include an earplug jack to provide communication between an external headset and an electronic device.
[0153] The input unit 1406 may be used to receive input numbers, character information or user feature information (such as fingerprint, iris, facial information, etc.), and generate keyboard, mouse, joystick, optical or trackball signal input related to user settings and function control.
[0154] The power supply 1407 is used to supply power to various components of the electronic device 1400. Optionally, the power supply 1407 can be logically connected to the processor 1401 through a power management system, so that the power management system can manage charging, discharging, and power consumption. The power supply 1407 can also include one or more DC or AC power supplies, recharging systems, power failure detection circuits, power converters or inverters, power status indicators, and other arbitrary components.
[0155] although Fig.14 Not shown, the electronic device 1400 may also include a camera, a sensor, a wireless fidelity module, a Bluetooth module, etc., which will not be described in detail here.
[0156] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0157] A person of ordinary skill in the art will appreciate that all or part of the steps in the various methods of the above embodiments may be completed by instructions, or by controlling related hardware through instructions. The instructions may be stored in a computer-readable storage medium and loaded and executed by a processor.
[0158] To this end, an embodiment of the present application provides a computer-readable storage medium, in which a plurality of computer programs are stored, and the computer program can be loaded by a processor to execute any of the water division methods of a map provided in the embodiment of the present application. The computer program can execute the following steps of the water division method of a map:
[0159] Acquire a water area grid map of a target map, wherein the water area grid map includes at least one water area of the target map, and the water area is composed of a plurality of grids;
[0160] Determining edge distances between grid vertices of the grid and an edge of the water area, wherein the grid vertices include edge grid vertices located at an edge of the area;
[0161] Determining vertex movement parameters of the edge mesh vertices based on edge distances between the mesh vertices and the edge of the region;
[0162] Based on the vertex movement parameter of the edge mesh vertex, control the edge mesh vertex to move toward the center of the water area until it is determined that the edge mesh vertex is in the central range of the water area, and determine the movement distance of the edge mesh vertex;
[0163] Based on the moving distance of the edge mesh vertex, the water area type corresponding to the edge mesh vertex is determined.
[0164] It can be seen that the computer program can be loaded by the processor to execute any of the water division methods for a map provided in the embodiments of the present application, thereby bringing the following technical effects: the accuracy of the water division in the map can be improved.
[0165] The specific implementation of the above operations can be found in the previous embodiments, which will not be described in detail here.
[0166] The computer-readable storage medium may include: a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc.
[0167] Since the computer program stored in the computer-readable storage medium can execute any of the methods for dividing a water area on a map provided in the embodiments of the present application, the beneficial effects that can be achieved by any of the methods for dividing a water area on a map provided in the embodiments of the present application can be achieved. Please refer to the previous embodiments for details and will not be repeated here.
[0168] According to one aspect of the present application, a computer program product or a computer program is also provided, the computer program product or the computer program including computer instructions, the computer instructions being stored in a computer-readable storage medium. A processor of an electronic device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the electronic device executes the methods provided in various optional implementations of the above embodiments.
[0169] In the above-mentioned embodiments of the water division device for maps, computer-readable storage medium, electronic device, and computer program product, the description of each embodiment has its own emphasis. For parts not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments. Those skilled in the art can clearly understand that for the convenience and simplicity of description, the specific working process and beneficial effects of the water division device for maps, computer-readable storage medium, computer program product, electronic device, and corresponding units described above can refer to the description of the water division method for maps in the above embodiments, and will not be repeated here.
[0170] The above is a detailed introduction to the water area division method, device, electronic device, computer-readable storage medium and computer program product for a map provided in an embodiment of the present application. Specific examples are used in this article to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method of the present application and its core idea; at the same time, for technical personnel in this field, according to the idea of the present application, there will be changes in the specific implementation method and scope of application. In summary, the content of this specification should not be understood as a limitation on the present application.
Claims
1. A method for dividing water areas of a map, characterized in that: The method comprises: Acquire a water grid map of a target map, wherein the water grid map includes at least one water area of the target map, and the water area is composed of a plurality of grids; Determining edge distances between grid vertices of the grid and an area edge of the water area, wherein the grid vertices include edge grid vertices located at an edge of the area; Determining vertex movement parameters of the edge mesh vertices based on edge distances between the mesh vertices and the region edge; Based on the vertex movement parameter of the edge mesh vertex, control the edge mesh vertex to move toward the center of the water area until it is determined that the edge mesh vertex is in the central range of the water area, and determine the movement distance of the edge mesh vertex; Based on the moving distance of the edge mesh vertex, the water area type corresponding to the edge mesh vertex is determined.
2. The method for dividing water areas of a map according to claim 1, characterized in that: The step of determining the vertex movement parameter of the edge mesh vertex based on the edge distance between the mesh vertex and the region edge includes: Determine at least two first mesh vertices adjacent to the edge mesh vertex from the mesh vertices; Based on the relative directions of the edge mesh vertices and each of the first mesh vertices and the edge distances of each of the first mesh vertices, vertex movement parameters of the edge mesh vertices are determined.
3. The method for dividing water areas of a map according to claim 2, characterized in that: The vertex movement parameter includes a vertex movement vector, and determining the vertex movement parameter of the edge mesh vertex based on the relative direction of the edge mesh vertex and each of the first mesh vertices and the edge distance of each of the first mesh vertices includes: Determining direction vectors of the edge mesh vertex and each of the first mesh vertices based on the relative directions of the edge mesh vertex and each of the first mesh vertices; Calculating the distance difference between the edge distance of the edge mesh vertex and the edge distance of each of the first mesh vertices; The vertex movement vector of the edge mesh vertex is determined based on the product of the direction vector of each first mesh vertex and the distance difference.
4. The method for dividing water areas of a map according to claim 1, characterized in that: After controlling the edge mesh vertices to move toward the center of the water area based on the vertex movement parameters of the edge mesh vertices, the method further includes: Obtaining the target position of the edge mesh vertex after moving; If it is determined that the edge mesh vertex is not in the central range of the water area, based on the target position, return to the step of determining the vertex movement parameter of the edge mesh vertex based on the edge distance between the mesh vertex and the edge of the area.
5. The method for dividing water areas of a map according to claim 4, characterized in that: The step of returning to perform, based on the target position, a step of determining a vertex movement parameter of the edge mesh vertex based on an edge distance between the mesh vertex and the edge of the region, comprises: Determine, from the mesh vertices, at least two second mesh vertices adjacent to the edge mesh vertex at the target position; Determining a vertex movement parameter of each of the second mesh vertices based on an edge distance between the mesh vertex and the region edge; Based on the vertex movement parameters of each of the second mesh vertices, vertex movement parameters of the edge mesh vertices at the target position are determined.
6. The method for dividing water areas of a map according to claim 5, characterized in that: The vertex movement parameter includes a vertex movement vector, and determining the vertex movement parameter of each second mesh vertex based on the edge distance between the mesh vertex and the region edge includes: Determine at least two third mesh vertices adjacent to the second mesh vertex from among the mesh vertices; Based on the relative directions of the second mesh vertex and each of the third mesh vertices and the edge distance of each of the third mesh vertices, a vertex movement vector of the second mesh vertex is determined.
7. The method for dividing water areas of a map according to claim 1, characterized in that: The determination conditions that the edge mesh vertex is within the central range of the water area include: If the moving distance indicated by the vertex moving parameter is less than or equal to a preset distance threshold, determining that the edge mesh vertex is in the central range of the water area; and / or, If the movement times of the edge mesh vertex is not less than a preset times threshold, it is determined that the edge mesh vertex is in the central range of the water area.
8. The method for dividing water areas of a map according to claim 1, characterized in that: After determining the edge distance between the grid vertex of the grid and the area edge of the water area, the method further includes: Determine a target color value corresponding to the mesh vertex based on a preset color mapping relationship and an edge distance of the mesh vertex, wherein the color mapping relationship is used to indicate a mapping relationship between the edge distance and the color value; The regional color of the water area is displayed in the water area grid map based on the target color value corresponding to the grid vertex.
9. The method for dividing water areas of a map according to claim 1, characterized in that: The determining the edge distance between the grid vertices of the grid and the area edge of the water area includes: The distance between the mesh vertex and a target edge mesh vertex is used as the edge distance between the mesh vertex and the edge of the region, wherein the target edge mesh vertex is the edge mesh vertex closest to the mesh vertex.
10. The method for dividing water areas of a map according to any one of claims 1 to 9, characterized in that: After determining the water area type corresponding to the edge grid vertex, the method further includes: Obtaining water area types corresponding to a preset number of edge mesh vertices around the edge mesh vertex; Based on a preset number of water area types, the water area type of the edge mesh vertex is updated to a target water area type, wherein the target water area type is the water area type with the largest number among the preset number of water area types.
11. A device for dividing water areas on a map, characterized in that: The device comprises: An acquisition module, used for acquiring a water grid map of a target map, wherein the water grid map includes at least one water area of the target map, and the water area is composed of a plurality of grids; a distance determination module, configured to determine an edge distance between a grid vertex of the grid and an edge of the water area, wherein the grid vertex includes an edge grid vertex located at an edge of the area; a parameter determination module, configured to determine a vertex movement parameter of the edge mesh vertex based on an edge distance between the mesh vertex and the edge of the region; A moving module, used to control the edge mesh vertex to move toward the center of the water area based on the vertex movement parameter of the edge mesh vertex, until it is determined that the edge mesh vertex is in the central range of the water area, and determine the moving distance of the edge mesh vertex; The type determination module is used to determine the water area type corresponding to the edge mesh vertex based on the movement distance of the edge mesh vertex.
12. An electronic device, characterized in that: It comprises a processor and a memory, wherein the memory stores a plurality of instructions; the processor loads instructions from the memory to execute the steps of the method for dividing water areas of a map as described in any one of claims 1 to 10.
13. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a plurality of instructions, and the instructions are suitable for being loaded by a processor to execute the steps of the method for dividing a water area of a map as described in any one of claims 1 to 10.
Citation Information
Patent Citations
Method and device for rendering water flow area in virtual scene and computer equipment
CN115193034A
Mesh division boundary adsorption method and device for geographic information system
CN115601525A