Map boundary area construction method, electronic device and program product
By generating quadrilateral meshes and reorganizing boundary segments into geometrically connected polylines, the problems of wasted raster rendering resources and missing topology in vector modeling are solved, achieving efficient visual representation of game scenes and improved real-time interactivity.
Patent Information
- Application Number
- CN202511089171.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-08-04
- Publication Date
- 2025-11-25
AI Technical Summary
In existing technologies, boundary rendering based on raster data suffers from severe resource waste in large-scale scenes, with serious jagged edges and mosaic distortion. Vector boundary topology modeling, on the other hand, lacks topological information, resulting in insufficient real-time performance and failing to meet the requirements of strategy games.
By generating quadrilateral meshes, accurately corresponding to pixel boundary intersections, filtering and identifying adjacent edges with different identifiers, and reorganizing discrete boundary segments into a geometrically connected set of boundary polylines, a parametric path geometry mesh is generated, achieving a seamless conversion from vector data to renderable geometry.
While preserving the accuracy of the original geographic information, it solved the problems of jagged distortion and topological breaks, improving the visual performance and real-time interactivity of the game scene.
Smart Images

Figure CN121010715A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, specifically to a method for constructing map boundary areas, an electronic device, and a program product. Background Technology
[0002] In the development of strategy games, grid-based boundary rendering technology or vector-based boundary topology modeling technology are commonly used to perform 3D modeling of map boundaries.
[0003] Boundary rendering based on raster data relies on color gradient calculation of discrete pixels to complete boundary recognition; however, due to the inherent characteristics of raster data, in large scenes, it is necessary to maintain an ultra-high resolution bitmap to ensure boundary clarity, which wastes video memory resources and easily causes mosaic distortion when scaling the scene, with obvious jagged edges on the boundary.
[0004] The vector boundary topology-based modeling technique maintains the map boundary dataset based on the vector data storage architecture and directly generates it into the game scene rendering pipeline for visualization rendering. However, the data structure has the problem of missing topological information. It only stores discrete boundary line elements and lacks the topological correlation between regions, which leads to systemic obstacles in spatial relationship calculation. In particular, when dealing with non-convex polygonal regions, it cannot meet the real-time requirements of strategy games. Summary of the Invention
[0005] This application provides a method for constructing map boundary areas, an electronic device, and a program product, which solves the jagged and mosaic problems commonly found in traditional grid boundary visualization, and significantly improves the visual performance of game scenes.
[0006] In a first aspect, embodiments of this application provide a method for constructing a map boundary region, the method comprising:
[0007] A quadrilateral grid is generated based on the resolution of the original raster pixels, such that the vertices of the quadrilateral grid correspond to the boundary intersections of the original raster pixels, and each quadrilateral patch unit corresponds to a single pixel region in the original raster pixels; wherein, the quadrilateral patch unit is formed by connecting four adjacent vertices.
[0008] For each quadrilateral patch, determine the pixel region affiliation and obtain the identifier code of the pixel region corresponding to the quadrilateral patch;
[0009] Traverse the adjacent edges in the quadrilateral grid, filter out the adjacent edges with different identifier codes of the adjacent quadrilateral faces on both sides, and form a set of discrete boundary line segments;
[0010] Based on the vertex connection relationship between the discrete boundary line segments, the line segments with shared vertices are reorganized into a geometrically connected set of boundary polylines; wherein, the shared vertex is the coordinate of the endpoint of two discrete boundary line segments that coincide.
[0011] A parameterized path geometry mesh is generated based on the boundary polyline set.
[0012] Secondly, embodiments of this application also provide an electronic device, including a memory storing multiple instructions; a processor loads instructions from the memory to execute the steps of any of the map boundary region construction methods provided in embodiments of this application.
[0013] Thirdly, embodiments of this application also provide a computer program product, including a computer program or instructions, which, when executed by a processor, implement the steps in any of the map boundary region construction methods provided in embodiments of this application.
[0014] This application's embodiments generate regular quadrilateral meshes based on the original raster resolution, ensuring that mesh vertices precisely correspond to pixel boundary intersections and each facet unit strictly corresponds to a single pixel region, establishing a spatial alignment foundation between geometry and pixel data. By calculating the geometric center coordinates of each facet and sampling the original raster, the identifier code of the pixel region is obtained, providing a feature basis for boundary determination. Then, the adjacent edges of the mesh are traversed, and edges with different identifier codes on both sides are filtered, directly filtering redundant internal edges to form a set of discrete boundary line segments. Based on vertex connection relationships, the discrete line segments are recombined into geometrically connected polylines containing open and closed paths, solving the topological breakage problem. Finally, a parametric path geometry mesh is generated based on the recombined polylines, achieving a seamless conversion from vector data to renderable geometry, effectively avoiding the jagged distortion and excessively coarse foreground defects of traditional raster rendering. While preserving the accuracy of the original geographic information, it achieves smoothness in boundary expression and improved real-time interactivity, providing an efficient solution for scenarios such as game maps. Attached Figure Description
[0015] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0016] Figure 1 This is a schematic flowchart of an embodiment of the method for constructing map boundary areas provided in this application.
[0017] Figure 2 This is a schematic diagram of the map area input image provided in the embodiments of this application;
[0018] Figure 3 This is a partial schematic diagram illustrating the correspondence between the basic grid and pixel centers provided in the embodiments of this application;
[0019] Figure 4 This is a partial schematic diagram of the basic grid for the RGB color of the sampling area provided in the embodiments of this application;
[0020] Figure 5 This is a partial schematic diagram of the mesh after deleting redundant internal edges provided in an embodiment of this application;
[0021] Figure 6 This is a partial schematic diagram of the discrete state before polyline reconstruction provided in the embodiments of this application;
[0022] Figure 7 This is a partial schematic diagram of the continuous path after polyline reconstruction provided in the embodiments of this application;
[0023] Figure 8 This is a schematic diagram of the triangle index construction rules provided in the embodiments of this application;
[0024] Figure 9 This is a partial schematic diagram of the generation of striped meshes provided in the embodiments of this application;
[0025] Figure 10 This is a schematic diagram illustrating the effect of traditional image edge detection schemes in distant scenes;
[0026] Figure 11 This is a schematic diagram of the boundary rendering effect of the map boundary region construction method provided in the embodiments of this application in the distant view;
[0027] Figure 12 This is a schematic diagram illustrating the effect of traditional image edge detection schemes in close-up scenes;
[0028] Figure 13 This is a schematic diagram of the boundary rendering effect of the map boundary region construction method provided in the embodiments of this application in close-up view;
[0029] Figure 14 This is a schematic flowchart of another embodiment of the map boundary region construction method provided in this application;
[0030] Figure 15 This is a schematic diagram of the structure of one embodiment of the map boundary area construction device provided in this application;
[0031] Figure 16 This is a schematic diagram of another embodiment of the map boundary area construction device provided in this application;
[0032] Figure 17 This is a schematic diagram of the structure of the electronic device provided in the embodiments of this application. Detailed Implementation
[0033] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0034] This application provides a method for constructing map boundary areas, an electronic device, and a program product.
[0035] Specifically, this embodiment will be described from the perspective of a map boundary region construction device. This map boundary region construction device can be integrated into an electronic device, that is, the map region construction method of this application embodiment can be executed by an electronic device. Optionally, the electronic device may include a terminal device. The terminal device may be a mobile phone, tablet computer, smart Bluetooth device, laptop computer, game console, or personal computer (PC), etc.
[0036] The method for constructing map boundary regions provided in this application can be applied to systems such as game map boundary 3D construction systems. This game map boundary 3D construction system can include a player terminal device and a server. The terminal can be a device that includes both receiving and transmitting hardware, i.e., a device with receiving and transmitting hardware capable of performing bidirectional communication over a bidirectional communication link. The player terminal device and the server can communicate bidirectionally via a network.
[0037] Optionally, the server can be a standalone server, or a server network or server cluster, including but not limited to computers, network hosts, single network servers, multiple network server sets, or cloud servers composed of multiple servers. Cloud servers consist of a large number of computers or network servers based on cloud computing.
[0038] The following detailed description is provided 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 order of description in the following embodiments is not intended to limit the preferred order of the embodiments. Although a logical order is shown in the flowcharts, in some cases, the steps shown or described may be performed in a different order than that shown in the accompanying drawings.
[0039] The map boundary region construction method in this embodiment, through a closed-loop process of basic grid construction, accurate identifier sampling, intelligent boundary filtering, automatic topology reorganization, and parametric grid generation, effectively solves the jagged and mosaic problems commonly found in traditional raster boundary visualization while preserving the accuracy of geographic information, and significantly improves the visual performance of game scenes.
[0040] Please refer to Figure 1 The specific process for constructing the boundary region of this map can be implemented through the following steps 101 to 105, wherein:
[0041] Step 101: Generate a quadrilateral mesh based on the resolution of the original raster pixels, such that the vertices of the quadrilateral mesh correspond to the boundary intersections of the original raster pixels, and each quadrilateral patch unit corresponds to a single pixel region in the original raster pixels.
[0042] The quadrilateral patch unit is a planar quadrilateral formed by connecting four adjacent grid vertices, used to represent the geometric range of a single pixel region in the original raster pixel.
[0043] In some embodiments of this application, the original raster pixels are map boundary images of strategy games, wherein the same color area corresponds to an independent management unit.
[0044] Specifically, the raw raster pixels are two-dimensional map image data stored in the form of a pixel matrix. Each pixel contains color information (such as RGB values), and the same color area represents an independent management unit (such as a country or region) in the game. The characteristics of the raw raster pixels include: the data has not undergone geometric topology processing, the pixel coordinates directly correspond to the spatial location of the game map, and the resolution is defined by the number of rows (M) and columns (N) of the pixel matrix.
[0045] In some embodiments of this application, generating a quadrilateral grid based on the resolution of the original raster pixels includes:
[0046] Based on the resolution N×M of the original raster pixels, a regular quadrilateral mesh with a vertex size of (N+1)×(M+1) is constructed; where M and N are both natural numbers.
[0047] The vertices of the quadrilateral grid are generated by mapping linear indices to row and column two-dimensional indices, and the positions of the vertices are aligned with the boundary intersections of the original grid pixels.
[0048] Wherein, the linear index is the one-dimensional consecutive number of vertices in the memory array; the row and column two-dimensional indexes are the column direction index and row direction index of the vertex in the grid space.
[0049] Please also refer to Figure 2 , 3, Figure 2 This is a schematic diagram of the map area input image provided in the embodiments of this application. Figure 3 This is a partial schematic diagram illustrating the correspondence between the basic grid and pixel centers provided in the embodiments of this application.
[0050] For example, when performing step 101, the input is as follows: Figure 2 The original raster pixel map shown (resolution 2700×2700) is used to construct a vertex mesh of 2701 rows × 2701 columns. Figure 3 ).
[0051] The vertices of the quadrilateral grid are mapped to row and column coordinates using linear indices:
[0052] The linear indices are grouped by column number, the remainder is used as the column index, and the integer quotient is used as the row index, ultimately generating a uniform grid for the coverage map.
[0053] Among them, the linear index k of the vertex and the two-dimensional index (a, b) satisfy the following, and the correspondence between the coordinates (x, y) satisfies the following formula (1):
[0054]
[0055] like Figure 3 As shown, the grid vertices (white dots in the figure) are precisely located at the boundary intersections of the original raster pixels (squares in the figure).
[0056] A single quadrilateral facet (e.g.) Figure 3 The medium gray area is enclosed by four vertices, and its geometric extent completely covers an original raster pixel (e.g., ...). Figure 2 (Medium monochrome block region).
[0057] This establishes a one-to-one mapping relationship between pixel regions and geometric patches, providing a topological basis for subsequent sampling.
[0058] Step 102: Determine the pixel region affiliation for each quadrilateral patch and obtain the identifier code of the pixel region corresponding to the quadrilateral patch.
[0059] In some embodiments of this application, the pixel region attribution is determined for each quadrilateral patch, and the identifier code of the pixel region corresponding to the quadrilateral patch is obtained, including:
[0060] Calculate the coordinates of the geometric center of each of the quadrilateral facets;
[0061] Based on the geometric center coordinates, the original grid pixels are sampled to obtain the identification code of the pixel region corresponding to the quadrilateral patch.
[0062] In some embodiments of this application, calculating the geometric center coordinates of each quadrilateral patch includes:
[0063] The coordinates of the geometric center are obtained by calculating the average of the coordinates of the four vertices of the quadrilateral facet.
[0064] Specifically, each quadrilateral facet of the quadrilateral grid consists of four vertices P, and the average of the coordinates of the four vertices is the geometric center coordinate P of the facet. M The average value of the coordinates of the four vertices is calculated using formula (2).
[0065]
[0066] In some embodiments of this application, the pixel region attribution is determined for each quadrilateral patch, and the identifier code of the pixel region corresponding to the quadrilateral patch is obtained, including:
[0067] Based on the geometric center coordinates of each quadrilateral patch, the original grid pixels are sampled for nearest point to obtain RGB color values, and the RGB color values are converted into integer values as the identification code of the corresponding pixel area.
[0068] The mapping relationship between RGB colors and the region's identifier code satisfies formula (3):
[0069] V = (R×255)×65536 + (G×255)×256 + (B×255) Formula (3)
[0070] In formula (3), R, G, and B represent normalized color components, and V represents the region's identifier code.
[0071] Please see Figure 4 , Figure 4 This is a partial schematic diagram of the basic grid for the RGB color of the sampling area provided in the embodiments of this application.
[0072] For example, a quadrilateral facet (such as the gray area) is selected from the basic grid, with the coordinates of its four vertices being P1, P2, P3, and P4, respectively. The center coordinate P is calculated according to formula (2). M = (P1+P2+P3+P4) / 4, such that P M Located at the geometric center of the facet.
[0073] Based on P M Coordinate positioning of original raster pixels ( Figure 2 ), because P M Located at the center of the patch, it must fall within the corresponding single pixel area; the RGB color value of the pixel is obtained by sampling the nearest point (e.g., the blue area corresponds to RGB[0.2, 0.4, 0.8]).
[0074] Convert RGB color values to integer codes by multiplying each color component by 255 and rounding down, then combining them by weight (red component × 65536 + green component × 256 + blue component) to generate a unique region identifier (e.g., [51, 102, 204] → 3, 373, 260).
[0075] like Figure 4 As shown, patches of the same color region (such as all orange patches) receive the same identifier code, while patches of different colors receive different codes.
[0076] In this embodiment, a spatial mapping relationship with the original raster pixels is established by calculating the geometric center coordinates of the patch. The raster pixel index is then queried using nearest-point sampling to obtain the identifier code of the corresponding pixel region. This process establishes a correspondence between each patch unit and the raster region ID, providing a feature basis for subsequent topology optimization.
[0077] Step 103: Traverse the adjacent edges in the quadrilateral grid, and filter out the adjacent edges with different identifier codes of the adjacent quadrilateral faces on both sides to form a set of discrete boundary line segments.
[0078] In some embodiments of this application, adjacent edges with different identifier codes for two adjacent quadrilateral faces are selected, including:
[0079] For each adjacent edge, obtain the two adjacent quadrilateral faces associated with it;
[0080] Compare the identification codes of the two quadrilateral patches;
[0081] In cases where the identifier codes are different, the adjacent edges are retained as boundary edges.
[0082] In some embodiments of this application, the adjacent edges are deleted when the identifier codes are the same.
[0083] For each adjacent edge, boundary determination is performed using the region identifier codes of its left and right adjacent quadrilateral faces: if the region identifier codes of the quadrilateral faces on both sides are the same, the edge is determined to be an internal redundant edge and is deleted; otherwise, it is retained as a region boundary. The mesh after this processing retains only the contour boundaries between different regions, forming a set of discretized boundary line segments.
[0084] In some embodiments of this application, comparing the identifier codes of two quadrilateral patches includes:
[0085] For each adjacent edge, extract the sets S0 and S1 of all quadrilateral faces to which the two vertices P0 and P1 of the adjacent edge belong; where S0 = {all quadrilateral faces containing vertex P0}, S1 = {all quadrilateral faces containing vertex P1}.
[0086] Calculate the intersection S of the quadrilateral patch sets S0 and S1. shared =S0∩S1;
[0087] In the intersection S shared If there are different quadrilateral faces with the same region identifier code, then the adjacent edge is deleted; otherwise, the adjacent edge is retained.
[0088] Specifically, for each shared polygon S∈S shared Read its region number V and form a set W = {V|S∈S} shared}
[0089] If there exist two distinct shared surfaces S1 and S2 ∈ S shared If their region numbers V are equal, then delete the current polygon.
[0090] Please see Figure 5 , Figure 5 This is a partial schematic diagram of the mesh after deleting redundant internal edges, provided in an embodiment of this application.
[0091] For example, suppose edge E1 has adjacent faces F1 (identified by V=1) and F2 (identified by V=2). Since V1≠V2, edge E1 is retained as a boundary edge.
[0092] Vertex P of opposite edge E2 a The set of associated faces is {S1, S2}; vertex P β The set of related surfaces is {S2, S3}; the intersection is S shared = {S2}, but S2 is a single face (not different faces), so edge E2 is retained as a boundary edge.
[0093] Step 104: Based on the vertex connection relationship between the discrete boundary line segments, reorganize the line segments sharing vertices into a geometrically connected set of boundary polylines.
[0094] In this context, shared vertices refer to two discrete boundary segments that have overlapping endpoint coordinates. The reassembly process establishes path continuity by traversing such vertices.
[0095] In some embodiments of this application, the boundary polyline set includes open paths and closed loop paths; based on the vertex connection relationships between the discrete boundary segments, segments sharing vertices are reorganized into a geometrically connected boundary polyline set, including:
[0096] Starting from an unvisited boundary edge, dynamically record the vertex sequence;
[0097] Iteratively extend the path along adjacent edges;
[0098] Output an open path if the path cannot be extended, or output a closed-loop path if the path is closed.
[0099] In some embodiments of this application, the iterative path extension along adjacent edges is performed by depth-first traversal, including dynamically generating a sequence of vertices and marking visited adjacent edges.
[0100] In some embodiments of this application, performing the iterative path extension along adjacent edges via depth-first traversal includes:
[0101] The set of adjacent edge endpoints associated with the current vertex is sorted and redundant elements are eliminated to generate a shared array with unique elements; wherein, the current vertex is the vertex currently being processed;
[0102] Remove the current vertex from the neighbor array to form an adjacency dataset, and terminate the current vertex processing flow if the adjacency dataset is empty;
[0103] Based on the preset vertex priority rules, verify the current vertex's dominant authority over the path extension process;
[0104] In the case that the adjacency dataset has a binary feature, create mutually independent open path containers and initialize the adjacency points as path start points;
[0105] Perform a depth-first traversal to extend the path sequence along adjacent edges;
[0106] Output geometric topological entities based on path sequence characteristics.
[0107] In some embodiments of this application, a sorting operation and redundant element elimination process are performed on the set of adjacent edge endpoints associated with the current vertex to generate a neighbor array with unique elements, including:
[0108] Obtain the endpoints of all adjacent edges of the current vertex to form an initial shared array; wherein, the initial shared array includes the current vertex and the shared vertices directly connected to the current vertex;
[0109] Perform a sorting operation (ascending or descending) on the initial shared array;
[0110] Remove consecutive duplicate elements from the initial shared array to obtain a first shared array with unique elements.
[0111] Specifically, consecutive duplicate elements in the initial shared array are removed by calling the sortedRemoveDuplicates function.
[0112] Sorting and deduplication are necessary preprocessing steps because they simplify the logic of subsequent path tracing. Sorting arranges shared vertices in order of their numbers, facilitating quick comparison and eligibility determination; deduplication avoids path redundancy caused by duplicate vertices, ensuring the accuracy of path reconstruction.
[0113] For example, let the initial shared array be N. array = [v0, v1, ... v] k ], where v i This represents the vertex index. After sorting, it becomes an ordered array; the deduplication function ensures that N... array If there are no consecutive duplicate values, adjust the size of the output array to the number of unique elements.
[0114] The current vertex itself is removed from the initial shared array to form a pure adjacency dataset. If the adjacency dataset is empty, the current vertex processing flow is terminated. The specific implementation principle is as follows:
[0115] By traversing the initial shared array and deleting elements with the same index as the current vertex, the elements of the current vertex are removed. After removal, a clean first shared array N is obtained. neighbors This only includes external connected vertices. Removing the current vertex itself is a crucial step in avoiding self-loops in the path, because depth-first traversal path tracing only focuses on external adjacencies; the vertex itself does not participate in path construction. If the number of shared vertices in the second shared array after removal is 0, it means that the current vertex has no valid connections, and the processing of the current vertex is skipped.
[0116] For example, if the current vertex is 5 and the shared array is [3, 5, 7], after removal, Nneighbors = [3, 7].
[0117] In the embodiments of this application, the deduplication operation ensures that the closed-loop path has no redundant vertices, optimizing the mesh data. The output of this step can be used for subsequent resampling and rendering, solving the defect of missing topological correlation in traditional schemes. The reconstruction effect is demonstrated through image comparison: before reconstruction, the polyline is discrete and discontinuous; after reconstruction, a smooth and continuous path is formed.
[0118] In some embodiments of this application, the dominant authority of the current vertex over the path extension process is verified based on a preset vertex priority rule, including:
[0119] If the identifier code of the current vertex and the identifier code of the shared vertex satisfy any of the following conditions, it is determined that the current vertex does not have the dominant authority, and the dominant authority is transferred to the vertex with the smaller identifier code:
[0120] The current vertex identifier code is greater than the unique shared vertex identifier code;
[0121] The current vertex identifier code is greater than the minimum identifier code among the two adjacent shared vertices;
[0122] The current vertex identifier code is greater than the maximum identifier code of all shared vertices.
[0123] Specifically, the number of shared vertices in the first shared array is 1, and the identifier code of the current vertex is greater than the identifier code of the shared vertices (i.e., the current vertex > N). neighbors In the case of [0]), the current vertex processing flow is abandoned (because the neighboring vertex is smaller and should dominate the path);
[0124] The number of shared vertices in the first shared array is 2, and the identifier code of the current vertex is greater than the minimum identifier code of the two shared vertices (i.e., the current vertex > min(N)). neighbors [0], N neighbors In the case of [1]), the current vertex processing flow is abandoned;
[0125] The identifier code of the current vertex is greater than the maximum value of the identifier codes of all shared vertices (i.e., current vertex > max(N)). neighbors In the case of ), the current vertex processing flow is abandoned.
[0126] In some embodiments of this application, the dominant authority of the current vertex is activated if the identifier encoding of the current vertex satisfies the following conditions:
[0127] The identifier code of the current vertex is less than the minimum identifier code of all shared vertices.
[0128] Checking if the current vertex is eligible to be the starting point of a path prevents duplicate path construction and conflicts. By ensuring that the smallest vertex dominates the path, race conditions in multi-threaded or recursive processing are avoided, thus optimizing algorithm efficiency.
[0129] In some embodiments of this application, when the number of shared vertices in the first shared array is 2, it is determined that the adjacency dataset has a bipartite feature.
[0130] In some embodiments of this application, when the adjacency dataset has a bipartite feature, shared vertices are used as path starting points to create mutually independent paths, including:
[0131] With the first shared vertex N neighbors [0] is used as the starting point of the path; create the first path array.
[0132] With the second shared vertex N neighbors [1] Use it as the starting point of the path to create a second path array.
[0133] The path array is used to store the vertex sequence, and the initial state only contains the starting point.
[0134] The number of shared vertices is 2, which means that the current vertex is the middle point or the end point of the path. Initializing two paths can handle the forking case, which lays the foundation for depth-first traversal and ensures that both open paths and closed paths can be captured.
[0135] In some embodiments of this application, performing a depth-first traversal extension path sequence along adjacent edges includes:
[0136] Establish the iterative relationship between the predecessor vertex and the current vertex, where the predecessor vertex is initialized as the starting point of the path, and the current vertex is initialized as the next vertex after the starting point of the path;
[0137] Dynamically obtain the first shared array of the current vertex;
[0138] Detect the potential change of the first shared array and trigger the iteration termination condition;
[0139] If the iteration termination condition is not triggered, the valid adjacent point is added to the path sequence, and the predecessor vertex is updated to the current vertex and the current vertex is the valid adjacent point. Then, the step of dynamically obtaining the first shared data of the current vertex continues.
[0140] For example, let the previous vertex be P. start Let P be the starting point of the path, and let P be the current vertex. next The input parameters include the starting point P. start The next vertex P next and including P next The path array.
[0141] In some embodiments of this application, dynamically obtaining the first shared array of the current vertex includes: obtaining the complete adjacency dataset of the current vertex, performing a sorting and deduplication operation on the complete adjacency dataset, removing the current vertex and the previous vertex from the processed dataset, and outputting the effective adjacency dataset, i.e., the first shared array as described above.
[0142] In some embodiments of this application, detecting the potential change of the first shared array and triggering an iteration termination condition includes:
[0143] If the number of remaining shared vertices in the first shared array is not equal to 1 (i.e., 0 or more neighbors), output the first state information and terminate the traversal of the current path. Here, the first state information indicates that the path extends to an endpoint or branch point; and / or
[0144] If the number of remaining shared vertices in the first shared array is equal to 1, verify the relationship between the identifier code of the unique shared vertex in the first shared array and the identifier code of the path starting point to trigger the iteration termination condition.
[0145] In some embodiments of this application, verifying the relationship between the identifier code of the unique shared vertex in the first shared array and the identifier code of the path starting point to trigger an iteration termination condition includes:
[0146] The identifier code of the unique shared vertex is less than the identifier code of the path start point (P). neighbor <P start In the case of a given situation, output second status information indicating the transfer of permissions; wherein the second status information indicates that the current path should be handled by the vertex with the smaller identifier encoding;
[0147] The identifier code of the unique shared vertex is equal to the identifier code of the path start point (P). neighbor =P start In the case of a closed loop path, output the third state information indicating the formation of the closed loop path and terminate the traversal of the current path.
[0148] In some embodiments of this application, appending valid adjacent points to the path sequence without triggering an iteration termination condition includes:
[0149] If the identifier code of the unique shared vertex is greater than the identifier code of the path start point, then the unique shared vertex P... neighbor Add to the path sequence.
[0150] For example, the state value of the first state information is 0, indicating that the path extends to the endpoint or fork point, triggering the transfer of permissions and abandoning the processing flow of the current vertex; the state value of the second state information is 1, indicating that the current path should be processed by the vertex with the smaller identifier code, and the current vertex is the endpoint of the open path; the state value of the third state information is 2, indicating that a closed path is formed, and the current vertex is a closed path.
[0151] In some embodiments of this application, outputting geometric topological entities based on path sequence features includes:
[0152] If the first state information is output, the current path is an open path, and the vertex sequence is directly output as a polyline primitive;
[0153] If the third state information is output, the current path is a closed loop path. Perform the deduplication operation of the first and last vertices (remove duplicate starting points) and output the closed loop polyline primitive.
[0154] Combine all the output polyline primitives into a geometrically connected set of boundary polylines.
[0155] Specifically, based on the output of the traceEdges function, the path sequence is processed into a set of final boundary polylines.
[0156] In the embodiments of this application, discrete line segments are reconstructed into continuous polylines by performing path tracing (calling the traceEdges function). Depth-first traversal efficiently connects adjacent edges, records vertex sequences in real time, and marks visit states, solving the problem of missing topological information. The state machine design (returning 0 / 1 / 2) ensures that the path automatically terminates at the end or when a loop is closed, improving real-time performance and making it particularly suitable for high-frequency interactions in game engines.
[0157] In some embodiments of this application, an open path is output when the path cannot be extended, or a closed-loop path is output when the path is closed, including:
[0158] When the path is an open path, the vertex sequence is directly output as a polyline primitive;
[0159] If the path is a closed path, perform deduplication of the first and last vertices and output the closed-loop polyline primitive;
[0160] The output polylines form a set of geometrically connected boundary polylines.
[0161] In some embodiments of this application, performing deduplication of the first and last vertices on the closed-loop path includes:
[0162] Detect the first and last repetitions of the vertex sequence of the closed-loop path;
[0163] Remove duplicate vertices at the end of the vertex sequence.
[0164] Please also refer to Figure 6 , 7 , Figure 6 This is a partial schematic diagram of the discrete state before polyline reconstruction provided in the embodiments of this application. Figure 7 This is a partial schematic diagram of the continuous path after polyline reconstruction provided in the embodiments of this application.
[0165] For example, select Figure 6 For unvisited boundary edges (such as the red line segment), initialize the path sequence with the two endpoints P0 and P1: [P0, P1].
[0166] Extend the path along the adjacent edge of P1:
[0167] If there is an unvisited adjacent edge (such as edge P1→P2), add P2 to the sequence: [P0, P1, P2];
[0168] Repeat until it can no longer be extended.
[0169] When a vertex has no unvisited adjacent edges (e.g., P2 has only one neighbor, P1), the output sequence is [P0, P1, P2](…). Figure 7 (Blue broken line);
[0170] When the path vertex coincides with the starting point (e.g., P5→P3 is a closed loop in the sequence [P3, P4, P5, P3]), delete the last repeated point P3 and output [P3, P4, P5](…). Figure 7 (Yellow broken line).
[0171] All output polylines satisfy the following condition: there exists an original boundary edge between adjacent vertices (e.g., ...). Figure 7 P1→P2 is Figure 6 (Edges are preserved), and different polylines are not connected (e.g., blue / yellow polylines are not interconnected).
[0172] Step 105: Generate a parameterized path geometry mesh based on the boundary polyline set.
[0173] In the embodiments of this application, in scenarios with extremely high real-time requirements, a mesh can be directly generated based on the recombined set of boundary polylines.
[0174] In some embodiments of this application, generating a parameterized path geometry mesh based on the boundary polyline set includes:
[0175] Traverse each vertex of the boundary polyline set and calculate the spatial transformation parameters based on the vertex's position type in the path.
[0176] Generate the two-sided cross-section vertex of each vertex according to the spatial transformation parameters;
[0177] Perform quadrilateral triangulation on the vertices of adjacent sections;
[0178] Generate vertex texture coordinates based on path geometric features;
[0179] The vertices, triangle faces, and associated attributes generated segment by segment are integrated into a single mesh entity.
[0180] The vertex data of the single mesh entity includes position, normal, and texture coordinates, while the face data includes a triangle index sequence. The output is a parametric path geometry that supports width and subdivision precision adjustment.
[0181] In some embodiments of this application, traversing each vertex of the boundary polyline and calculating spatial transformation parameters based on the vertex's position type in the path includes:
[0182] For the path start / end point, calculate the path normal based on the directions of adjacent vertices, and generate a symmetric offset based on the path width parameter;
[0183] For intermediate vertices, the average normal is calculated based on the adjacent directions before and after, and the adaptive offset is dynamically calculated based on the path angle.
[0184] like Figure 9 As shown, specifically, the default normal vector (used for tangent calculation) is set to (0, 0, 1). Variables that store the previous vertex are: PrevVert1, PrevVert2 (the two vertices of the previous section), PrevTangent1, PrevTangent2 (the two tangents of the previous section), PrevUV1, PrevUV2 (the two UV coordinates of the previous section).
[0185] Traverse each vertex of the boundary polyline set and calculate the spatial transformation parameters based on the vertex's position type in the path. The specific implementation principle is as follows:
[0186] For each vertex P i (i = 0, 1, ..., n-1), calculate the direction, normal vector, and offset of the vertex:
[0187] For the starting point (i = 0):
[0188] The vertex direction is d = normalize(P1 - P0);
[0189] The normal vector is n = normalize(d × (0, 0, 1)), where (0, 0, 1) is the vertically upward vector;
[0190] The offset is o = n × Width / 2, where Width is the strip width input by the user.
[0191] For the endpoint (i = n-1):
[0192] The vertex direction is d = normalize(P) n-1 -P n-2 );
[0193] The normal vector is n = normalize(d × (0, 0, 1)), where (0, 0, 1) is the vertically upward vector;
[0194] The offset is o = n × Width / 2, where Width is the strip width input by the user.
[0195] For the midpoint
[0196] Forward direction: a = normalize(P) i -P i-1 );
[0197] Backward direction: b = normalize(P) i+1 -P i );
[0198] Average direction: d = normalize(a + b);
[0199] The normal vector is n = normalize(d × (0, 0, 1));
[0200] Calculate the included angle using formula (4):
[0201]
[0202] The offset is o = n × t.
[0203] In some embodiments of this application, generating bilateral cross-section vertices for each vertex based on the spatial transformation parameters includes:
[0204] The offset direction is calculated using the normal square vector and the offset.
[0205] Generate inner vertices along the negative normal direction;
[0206] Generate outer vertices along the positive direction of the normal.
[0207] Specifically, the two vertices of the current section are calculated based on the offset:
[0208] v1 = P i –o, v2 = P i +o
[0209] Calculate the tangent (perpendicular to the normal vector, pointing to both sides of the band):
[0210] t1 = –n, t2 = n
[0211] Connect the previous section and the current section to form a quadrilateral (when i>0):
[0212] Add four vertices (in the order of the two vertices from the previous section and the two vertices from the current section):
[0213] Vertices:[v prev1 v prev2 [v1, v2]
[0214] Add four tangents (in the same order as above):
[0215] Tangents:[t prev1 , t prev2 [t1, t2]
[0216] In some embodiments of this application, quadrilateral triangulation is performed on the vertices of adjacent cross sections, including:
[0217] Connect the two vertices of the previous section to the current section in sequence to form a quadrilateral;
[0218] The quadrilateral is split into two triangular facets;
[0219] Record the clockwise / counterclockwise order of the triangle vertex indices.
[0220] like Figure 8 As shown, specifically, the distance between the current cross section and the previous cross section is calculated as follows: Δs = ||P i-1 -P i ||
[0221] Accumulated x-coordinates of uv (along the length direction): x new =x prev +Δs / Width
[0222] The y coordinates of the two vertices of the current section are 0 and 1.
[0223] Add the UV coordinates of the four vertices of the previous and current sections to the UV sequence:
[0224] [P prev UV1, P prev UV2, UV1, UV2]
[0225] Add a triangle index (two triangles form a quadrilateral):
[0226] A quadrilateral consists of four vertices (indexed in the order of addition: 0, 1, 2, 3):
[0227] Triangle 1: 0, 2, 1
[0228] Triangle 2: 1, 2, 3
[0229] Update previous section variables: Save the vertices, tangents, and UVs of the current section as "previous section" variables.
[0230] In some embodiments of this application, generating vertex texture coordinates based on the geometric features of the path includes:
[0231] Update the accumulated parameters based on the ratio of vertex spacing to path width;
[0232] Assign vertical texture coordinates to the vertices of both sides of the cross section to generate a continuous texture map along the path.
[0233] In the embodiments of this application, texture coordinates are accumulated based on the ratio between vertex spacing and path width to achieve continuous texture mapping along the path direction; finally, the vertices, triangle patches and associated data generated segment by segment are integrated into a continuous mesh to form a parametric path geometry with adjustable width, subdivision precision and morphological features.
[0234] Please also refer to Figures 10 to 13 , Figure 10 This is a schematic diagram illustrating the effect of traditional image edge detection schemes in distant scenes. When using boundary rendering technology based on raster data, the map boundaries exhibit obvious jagged distortion in distant views. This phenomenon stems from the discrete nature of raster data—when the viewing angle is zoomed out, the discrete pixels generated by the edge detection algorithm cannot form a smooth curve, resulting in a stepped, jagged appearance at the boundary. Figure 12 This is a schematic diagram of the effect of traditional image edge detection schemes in close-up views. Under low-angle conditions, traditional schemes expose more serious structural defects, with fixed and unadjustable boundary lines that appear abnormally large in close-up views. When magnified, pixelated mosaics appear in the boundary areas. These problems severely restrict the immersive experience of strategy games, especially in complex terrain areas.
[0235] Figure 11 This is a schematic diagram of the boundary rendering effect of the map boundary region construction method provided in the embodiments of this application in the distant view. Through the parametric path geometry mesh generation technology, the embodiments of this application realize the vectorized boundary polyline in the distant view, which is then smoothed by resampling to form a path with continuous curvature; the system dynamically adjusts the mesh subdivision accuracy according to the viewing distance; and the memory usage is reduced compared to the traditional raster scheme. Figure 13 This is a schematic diagram of another embodiment of the map boundary region construction method provided in this application. In a close-up view, the embodiment of this application controls the boundary thickness in real time through the path width parameter, the strip grid still maintains a smooth outline when magnified, and the UV coordinates along the path direction ensure that the texture is not stretched or deformed.
[0236] In the embodiments of this application, a regular quadrilateral mesh is generated based on the original raster resolution, so that the mesh vertices precisely correspond to the pixel boundary intersections and each facet unit strictly corresponds to a single pixel region, establishing a spatial alignment basis for geometry and pixel data. By calculating the geometric center coordinates of each facet and sampling the original raster, the identifier code of the pixel region is obtained, providing a feature basis for boundary determination. Then, the adjacent edges of the mesh are traversed, and the edges with different identifier codes on both sides are filtered to directly filter redundant internal edges to form a set of discrete boundary line segments. Based on the vertex connection relationship, the discrete line segments are reorganized into geometrically connected polylines containing open paths and closed loop paths to solve the topological breakage problem. Finally, a parameterized path geometry mesh is generated based on the reorganized polylines, realizing a seamless conversion from vector data to renderable geometry, effectively avoiding the jagged distortion and overly coarse foreground defects of traditional raster rendering. While preserving the accuracy of the original geographic information, it achieves smoothness of boundary expression and real-time interactivity improvement, providing an efficient solution for game maps and other scenarios.
[0237] Please see Figure 14 , Figure 14 This is a schematic flowchart of another embodiment of the map boundary region construction method provided in this application.
[0238] In this embodiment, generating a parameterized path geometry mesh based on the boundary polyline set includes:
[0239] The boundary polyline set is recursively subdivided and smoothed, and smooth polylines with uniformly distributed vertices are generated by equidistant resampling.
[0240] A parametric path geometry mesh is generated based on the smooth polyline.
[0241] Specifically, the method for constructing the map boundary region can be implemented through the following steps 201 to 206, wherein:
[0242] Step 201: Generate a regular quadrilateral mesh based on the resolution of the original raster pixels, such that the vertices of the quadrilateral mesh correspond to the boundary intersections of the original raster pixels, and each quadrilateral patch unit corresponds to a single pixel region in the original raster pixels.
[0243] The quadrilateral patch unit is a planar quadrilateral formed by connecting four adjacent grid vertices, used to represent the geometric range of a single pixel region in the original raster pixel.
[0244] Step 202: Determine the pixel region affiliation for each quadrilateral patch and obtain the unique identifier code of the pixel region corresponding to the quadrilateral patch.
[0245] Step 203: Traverse the adjacent edges in the quadrilateral grid, and filter out the adjacent edges with different identifier codes of the adjacent quadrilateral faces on both sides to form a set of discrete boundary line segments.
[0246] Step 204: Based on the vertex connection relationship between the discrete boundary line segments, reorganize the line segments sharing vertices into a geometrically connected set of boundary polylines, including open paths and closed loop paths.
[0247] Step 205: Recursively subdivide and smooth the boundary polyline set, and generate smooth polylines with uniformly distributed vertices through equidistant resampling.
[0248] In some embodiments of this application, the boundary polyline set is recursively subdivided and smoothed, and smooth polylines with uniformly distributed vertices are generated through equidistant resampling, including:
[0249] Perform a predetermined number of recursive iterations on the input polyline vertex sequence;
[0250] Based on the vertex sequence after iterative processing, perform equidistant cutting along the path;
[0251] Output a set of smooth polylines with uniformly distributed vertices.
[0252] The smooth polyline set is characterized by: continuously varying curvature of the polyline path, spacing between adjacent vertices equal to the target segment length, and preservation of the original topology type for open and closed paths.
[0253] In some embodiments of this application, each iteration operation includes two sequential processes:
[0254] Insert a midpoint between each pair of adjacent vertices to generate a subdivided vertex sequence;
[0255] A weighted average is calculated for the non-endpoint vertices to generate a smooth vertex sequence.
[0256] In this calculation, the positions of the endpoint vertices remain unchanged, while the positions of the internal vertices are obtained by weighted calculation of the positions of their neighboring vertices.
[0257] Specifically, input the polyline vertex sequence: P = [P0, P1, P2, P...] n-1 ], iteration number k; output subdivided resampling point sequence Q.
[0258] The broken line is subdivided and smoothed through k rounds of iterations, with each iteration consisting of two stages:
[0259] Subdivision stage: Insert a midpoint between each pair of adjacent points to generate a subdivision point set R, as shown in formula (5):
[0260]
[0261] Smoothing phase: Perform a weighted average on the non-endpoints with a weight of 1:2:1 to generate a point set S.
[0262] Where the endpoints and vertices remain unchanged: s0 = r0, s m-1 =r m-1 The internal points (j = 1, 2, ..., m-2) are calculated using formula (6).
[0263]
[0264] As described above, after k iterations, the subdivided resampling point sequence Q is obtained.
[0265] In some embodiments of this application, based on the smoothed vertex sequence, equidistant cutting is performed along the path direction, including:
[0266] Initialize the cumulative length parameter and the starting point of the new polyline;
[0267] Traverse each segment of the original path, dynamically calculate the length of the current segment, cut off the excess part according to the target segment length, and generate equidistant sampling points through linear interpolation;
[0268] Add the path endpoint to the new polyline sequence.
[0269] Specifically, input the polyline point sequence Q = [q0, q1, q2, q...] n-1 ], Target segment length L. Output equidistant resampling point sequence T.
[0270] Initialize the new polyline: t0 = q0, cumulative length s = 0;
[0271] Traverse each segment of the polyline (i = 1, 2, ..., n-1);
[0272] Calculate the current line segment length d i =‖q i -q i-1 ||;
[0273] Based on the target segment length, iteratively cut (when s+d) i >L);
[0274] Calculate the difference parameter u = (Ls) / d i ;
[0275] Generate a new point t inew =q i-1 +t(q i -q i-1 );
[0276] Update cumulative length s←s+d i ;
[0277] Add the endpoint of point set Q to point set S←S∪{q} n-1}
[0278] For example, the input is the boundary polyline output in step S4 ( Figure 7 The output is a smooth, uniform polygonal line. Figure 8 );like Figure 7 A local polyline [P0, P1] is inserted with the midpoint P. m Generate [P0, P m [P1];
[0279] For P m Perform a weighted average: P m = (P0 + 2P) m +P1) / 4
[0280] Set the target length L, and distribute the vertices of the polyline evenly according to L.
[0281] Step 206: Generate a parametric path geometry mesh based on the smooth polyline.
[0282] In the embodiments of this application, by performing recursive subdivision and equidistant resampling on the recombined boundary polylines, smooth polylines with uniformly distributed vertices are generated, and parameterized path geometry is generated based on the smooth polylines, which can ensure the geometric quality of the parameterized mesh.
[0283] The specific implementation principles of steps 201 to 204 and step 206 in the embodiments of this application can be found in [reference needed]. Figures 1 to 13 The corresponding textual explanations are not elaborated here.
[0284] This embodiment also provides a device for constructing map boundary areas, which can be integrated into a terminal device. For example, as... Figure 15 As shown, the map boundary area construction device 300 may include:
[0285] The regular mesh generation module 301 is used to generate a regular quadrilateral mesh according to the resolution of the original raster pixels, such that the vertices of the quadrilateral mesh correspond to the boundary intersections of the original raster pixels, and each quadrilateral patch unit corresponds to a single pixel region in the original raster pixels; wherein, the quadrilateral patch unit is formed by connecting four adjacent vertices.
[0286] The region identification sampling module 302 is used to determine the pixel region affiliation of each quadrilateral patch and obtain the identification code of the pixel region corresponding to the quadrilateral patch;
[0287] The discrete boundary filtering module 303 traverses the adjacent edges in the quadrilateral grid and filters out the adjacent edges with different identifier codes of the adjacent quadrilateral faces on both sides, forming a set of discrete boundary line segments.
[0288] The polyline topology reorganization module 304 is used to reorganize line segments with shared vertices into a geometrically connected set of boundary polylines based on the vertex connection relationship between the discrete boundary line segments; wherein, the shared vertex is the coordinate of the endpoint of two discrete boundary line segments that coincide.
[0289] The parameterized mesh generation module 305 is used to generate a parameterized path geometry mesh based on the boundary polyline set.
[0290] In some embodiments of this application, the regular mesh generation module 301 is further configured to:
[0291] Based on the resolution N×M of the original raster pixels, a regular quadrilateral mesh with a vertex size of (N+1)×(M+1) is constructed; where M and N are both natural numbers.
[0292] The vertices of the quadrilateral grid are generated by mapping linear indices to row and column two-dimensional indices, and the positions of the vertices are aligned with the boundary intersections of the original grid pixels.
[0293] In some embodiments of this application, the area identification sampling module 302 is further configured to:
[0294] Based on the geometric center coordinates of each quadrilateral patch, the original grid pixels are sampled for nearest point to obtain RGB color values, and the RGB color values are converted into unique integer values as the identification code of the corresponding pixel area.
[0295] In some embodiments of this application, the discrete boundary filtering module 303 is further configured to:
[0296] For each adjacent edge, obtain the two adjacent quadrilateral faces associated with it;
[0297] Compare the identification codes of the two quadrilateral patches;
[0298] In cases where the identifier codes are different, the adjacent edges are retained as boundary edges;
[0299] If the identifier codes are the same, delete the adjacent edges.
[0300] In some embodiments of this application, the discrete boundary filtering module 303 is further configured to:
[0301] For each adjacent edge, extract the sets S0 and S1 of all quadrilateral faces to which the two vertices P0 and P1 of the adjacent edge belong; where S0 = {all quadrilateral faces containing vertex P0}, S1 = {all quadrilateral faces containing vertex P1}.
[0302] Calculate the intersection S of the quadrilateral patch sets S0 and S1. shared =S0∩S1;
[0303] In the intersection S shared If there are different quadrilateral faces with the same region identifier code, then the adjacent edge is deleted; otherwise, the adjacent edge is retained.
[0304] In some embodiments of this application, the boundary polyline set includes open paths and closed loop paths; the polyline topology reorganization module 304 is further configured to:
[0305] Starting from an unvisited boundary edge, dynamically record the vertex sequence;
[0306] Iteratively extend the path along adjacent edges;
[0307] Output an open path if the path cannot be extended, or output a closed-loop path if the path is closed.
[0308] In some embodiments of this application, the polyline topology reorganization module 304 is further configured to:
[0309] The set of adjacent edge endpoints associated with the current vertex is sorted and redundant elements are eliminated to generate a shared array with unique elements; wherein, the current vertex is the vertex currently being processed;
[0310] Remove the current vertex from the neighbor array to form an adjacency dataset, and terminate the processing flow of the current vertex if the adjacency dataset is empty;
[0311] Based on the preset vertex priority rules, verify the current vertex's dominant authority over the path extension process;
[0312] In the case where the adjacency dataset has a binary feature, the shared vertex is used as the starting point to create mutually independent paths;
[0313] Perform a depth-first traversal to extend the path sequence along adjacent edges;
[0314] Output geometric topological entities based on the characteristics of the path sequence.
[0315] In some embodiments of this application, the polyline topology reorganization module 304 is further configured to:
[0316] Obtain the endpoints of all adjacent edges of the current vertex to form an initial shared array; wherein, the initial shared array includes the current vertex and the shared vertices directly connected to the current vertex;
[0317] Perform a sorting operation on the initial shared array;
[0318] Remove consecutive duplicate elements from the initial shared array to obtain a first shared array with unique elements.
[0319] In some embodiments of this application, the polyline topology reorganization module 304 is further configured to:
[0320] If the identifier code of the current vertex and the identifier code of the shared vertex satisfy any of the following conditions, it is determined that the current vertex does not have the dominant authority, and the dominant authority is transferred to the vertex with the smaller identifier code:
[0321] The current vertex identifier code is greater than the unique shared vertex identifier code;
[0322] The current vertex identifier code is greater than the minimum identifier code among the two adjacent shared vertices;
[0323] The current vertex identifier code is greater than the maximum identifier code of all shared vertices;
[0324] In some embodiments of this application, the polyline topology reorganization module 304 is further configured to:
[0325] If the identifier code of the current vertex is less than the minimum identifier code of all shared vertices, the dominant permission of the current vertex is activated.
[0326] In some embodiments of this application, the polyline topology reorganization module 304 is further configured to:
[0327] When the number of shared vertices in the first shared array is 2, it is determined that the adjacency dataset has a binary feature;
[0328] Create a first path array using the first shared vertex as the starting point of the path;
[0329] Create a second path array using the second shared vertex as the starting point of the path.
[0330] In some embodiments of this application, the polyline topology reorganization module 304 is further configured to:
[0331] Establish the iterative relationship between the predecessor vertex and the current vertex, where the predecessor vertex is initialized as the starting point of the path, and the current vertex is initialized as the next vertex after the starting point of the path;
[0332] Dynamically obtain the first shared array of the current vertex;
[0333] Detect the potential change of the first shared array and trigger the iteration termination condition;
[0334] If the iteration termination condition is not triggered, the valid adjacent point is added to the path sequence, and the predecessor vertex is updated to the current vertex and the current vertex is the valid adjacent point. Then, the step of dynamically obtaining the first shared data of the current vertex continues.
[0335] In some embodiments of this application, the polyline topology reorganization module 304 is further configured to:
[0336] If the number of remaining shared vertices in the first shared array is not equal to 1, output the first state information and terminate the traversal of the current path; wherein, the first state information indicates that the path extends to an endpoint or fork point; and / or
[0337] If the number of remaining shared vertices in the first shared array is equal to 1, verify the relationship between the identifier code of the unique shared vertex in the first shared array and the identifier code of the path starting point to trigger the iteration termination condition.
[0338] In some embodiments of this application, the polyline topology reorganization module 304 is further configured to:
[0339] If the identifier code of the unique shared vertex is less than the identifier code of the path start point, output second status information indicating permission transfer; wherein, the second status information indicates that the current path should be processed by the vertex with the smaller identifier code;
[0340] If the identifier of the unique shared vertex is equal to the identifier of the path start point, output the third state information indicating the formation of the closed loop path and terminate the traversal of the current path.
[0341] In some embodiments of this application, the polyline topology reorganization module 304 is further configured to:
[0342] If the identifier code of the unique shared vertex is greater than the identifier code of the path start point, the unique shared vertex is appended to the path sequence.
[0343] In some embodiments of this application, the parameterized mesh generation module 305 is further configured to:
[0344] If the first state information is output, the current path is an open path, and the vertex sequence is directly output as a polyline primitive;
[0345] If the third state information is output, the current path is a closed loop path. Perform the deduplication operation of the first and last vertices and output the closed loop polyline primitive.
[0346] Combine all the output polyline primitives into a geometrically connected set of boundary polylines.
[0347] In some embodiments of this application, the parameterized mesh generation module 305 is further configured to:
[0348] Detect the first and last repetitions of the vertex sequence of the closed-loop path;
[0349] Remove duplicate vertices at the end of the vertex sequence.
[0350] In some embodiments of this application, the parameterized mesh generation module 305 is further configured to:
[0351] Traverse each vertex of the boundary polyline and calculate the spatial transformation parameters based on the vertex's position type in the path;
[0352] Generate the two-sided cross-section vertex of each vertex according to the spatial transformation parameters;
[0353] Perform quadrilateral triangulation on the vertices of adjacent sections;
[0354] Generate vertex texture coordinates based on the geometric features of the path;
[0355] The vertices, triangle patches, and associated attributes generated segment by segment are integrated into a single mesh entity; wherein, the vertex data of the single mesh entity includes position, normal, and texture coordinates, and the patch data includes a triangle index sequence.
[0356] In some embodiments of this application, the parameterized mesh generation module 305 is further configured to:
[0357] For the path start / end point, calculate the path normal based on the directions of adjacent vertices, and generate a symmetric offset based on the path width parameter;
[0358] For intermediate vertices, the average normal is calculated based on the adjacent directions before and after, and the adaptive offset is dynamically calculated based on the path angle.
[0359] In some embodiments of this application, the parameterized mesh generation module 305 is further configured to:
[0360] The offset direction is calculated using the normal square vector and the offset.
[0361] Generate inner vertices along the negative normal direction;
[0362] Generate outer vertices along the positive direction of the normal.
[0363] In some embodiments of this application, the parameterized mesh generation module 305 is further configured to:
[0364] Update the accumulated parameters based on the ratio of vertex spacing to path width;
[0365] Assign vertical texture coordinates to the vertices of both sides of the cross section to generate a continuous texture map along the path.
[0366] Please see Figure 16 , Figure 16 This is a schematic diagram of another embodiment of the map boundary region construction apparatus provided in this application. The map boundary region construction apparatus 400 may include:
[0367] The regular mesh generation module 401 is used to generate a regular quadrilateral mesh according to the resolution of the original raster pixels, such that the vertices of the quadrilateral mesh correspond to the boundary intersections of the original raster pixels, and each quadrilateral patch unit corresponds to a single pixel region in the original raster pixels; wherein, the quadrilateral patch unit is formed by connecting four adjacent vertices.
[0368] The region identification sampling module 402 is used to determine the pixel region affiliation of each quadrilateral patch and obtain the identification code of the pixel region corresponding to the quadrilateral patch;
[0369] The discrete boundary filtering module 403 traverses the adjacent edges in the quadrilateral grid and filters out the adjacent edges with different identifier codes of the adjacent quadrilateral faces on both sides, forming a set of discrete boundary line segments.
[0370] The polyline topology reorganization module 404 is used to reorganize line segments with shared vertices into a geometrically connected set of boundary polylines based on the vertex connection relationship between the discrete boundary line segments; wherein, the shared vertex is the coordinate of the endpoint of two discrete boundary line segments that coincide.
[0371] The polyline resampling module 405 is used to recursively subdivide and smooth the boundary polyline set, and generate smooth polylines with uniformly distributed vertices through equidistant resampling.
[0372] The parametric mesh generation module 406 is used to generate a parametric path geometry mesh based on the smooth polyline.
[0373] In some embodiments of this application, the polyline resampling module 405 is further configured to:
[0374] Perform a predetermined number of recursive iterations on the input polyline vertex sequence;
[0375] Based on the vertex sequence after iterative processing, perform equidistant cutting along the path;
[0376] Output a set of smooth polylines with uniformly distributed vertices.
[0377] In some embodiments of this application, the polyline resampling module 405 is further configured to:
[0378] Insert a midpoint between each pair of adjacent vertices to generate a subdivided vertex sequence;
[0379] A weighted average is calculated for the non-endpoint vertices to generate a smooth vertex sequence.
[0380] In some embodiments of this application, the polyline resampling module 405 is further configured to:
[0381] Initialize the cumulative length parameter and the starting point of the new polyline;
[0382] Traverse each segment of the original path, dynamically calculate the length of the current segment, cut off the excess part according to the target segment length, and generate equidistant sampling points through linear interpolation;
[0383] Add the path endpoint to the new polyline sequence.
[0384] The specific implementation principles of the regular mesh generation module 401, the region identifier sampling module 402, the discrete boundary filtering module 403, the polyline topology reconstruction module 404, and the parameterized mesh generation module 406 in the embodiments of this application can be found in [reference needed]. Figure 14 The corresponding textual explanations are not elaborated here.
[0385] In the embodiments of this application, a regular quadrilateral mesh is generated based on the original raster resolution, ensuring that the mesh vertices precisely correspond to the pixel boundary intersections and each facet unit strictly corresponds to a single pixel region, establishing a spatial alignment basis between geometry and pixel data. By calculating the geometric center coordinates of each facet and sampling the original raster, a unique identifier code for the pixel region is obtained, providing a feature basis for boundary determination. Then, the adjacent edges of the mesh are traversed, and edges with different identifier codes on both sides are filtered, directly filtering redundant internal edges to form a set of discrete boundary line segments. Based on the vertex connection relationship, the discrete line segments are reorganized into geometrically connected polylines containing open paths and closed loop paths, solving the topological breakage problem. Finally, a parameterized path geometry mesh is generated based on the reorganized polylines, realizing a seamless conversion from vector data to renderable geometry, effectively avoiding the jagged distortion and overly coarse foreground defects of traditional raster rendering. While preserving the accuracy of the original geographic information, it achieves smoothness of boundary expression and improved real-time interactivity, providing an efficient solution for scenarios such as game maps.
[0386] Accordingly, this application also provides an electronic device, which can be a terminal, such as a smartphone, tablet computer, laptop computer, touch screen, game console, personal computer (PC), personal digital assistant (PDA), or other terminal device. Alternatively, the electronic device can be a server.
[0387] like Figure 17 As shown, Figure 17 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. The electronic device 500 includes a processor 501 with one or more processing cores, a memory 502 with one or more computer-readable storage media, and a computer program stored on the memory 502 and executable on the processor. The processor 501 and the memory 502 are electrically connected. Those skilled in the art will understand 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, or combine certain components, or have different component arrangements.
[0388] The processor 501 is the control center of the electronic device 500. It connects various parts of the electronic device 500 via various interfaces and lines. By running or loading software programs and / or units stored in the memory 502, and by calling data stored in the memory 502, it executes various functions and processes data of the electronic device 500, thereby providing overall monitoring of the electronic device 500. The processor 501 can be a central processing unit (CPU), a graphics processing unit (GPU), a network processor (NP), etc., and can implement or execute the methods, steps, and logic diagrams disclosed in the embodiments of this application.
[0389] In this embodiment, the processor 501 in the electronic device 500 loads the instructions corresponding to the processes of one or more applications into the memory 502 according to the following steps, and the processor 501 runs the applications stored in the memory 502 to realize various functions, such as:
[0390] A regular quadrilateral grid is generated based on the resolution of the original raster pixels, such that the vertices of the quadrilateral grid correspond to the boundary intersections of the original raster pixels, and each quadrilateral patch unit corresponds to a single pixel region in the original raster pixels; wherein, the quadrilateral patch unit is formed by connecting four adjacent vertices.
[0391] For each quadrilateral patch, determine the pixel region affiliation and obtain the identifier code of the pixel region corresponding to the quadrilateral patch;
[0392] Traverse the adjacent edges in the quadrilateral grid, filter out the adjacent edges with different identifier codes of the adjacent quadrilateral faces on both sides, and form a set of discrete boundary line segments;
[0393] Based on the vertex connection relationship between the discrete boundary line segments, the line segments with shared vertices are reorganized into a geometrically connected set of boundary polylines; wherein, the shared vertex is the coordinate of the endpoint of two discrete boundary line segments that coincide.
[0394] A parameterized path geometry mesh is generated based on the boundary polyline set.
[0395] In the embodiments of this application, a regular quadrilateral mesh is generated according to the original raster resolution, so that the mesh vertices precisely correspond to the pixel boundary intersections and each facet unit strictly corresponds to a single pixel region, establishing a spatial alignment basis for geometry and pixel data. By calculating the geometric center coordinates of each facet and sampling the original raster, the identifier code of the pixel region is obtained, providing a feature basis for boundary determination. Then, the adjacent edges of the mesh are traversed, and the edges with different identifier codes on both sides are filtered to directly filter redundant internal edges to form a set of discrete boundary line segments. Based on the vertex connection relationship, the discrete line segments are reorganized into geometrically connected polylines containing open paths and closed loop paths to solve the topological breakage problem. Finally, a parameterized path geometry mesh is generated based on the reorganized polylines, realizing a seamless conversion from vector data to renderable geometry, effectively avoiding the jagged distortion and overly coarse foreground defects of traditional raster rendering. While preserving the accuracy of the original geographic information, it achieves smoothness of boundary expression and real-time interactivity improvement, providing an efficient solution for game maps and other scenarios.
[0396] For details on the implementation of each of the above operations, please refer to the previous examples, which will not be repeated here.
[0397] Optional, such as Figure 5 As shown, the electronic device 500 also includes: a touch display screen 503, a radio frequency circuit 504, an audio circuit 505, an input unit 506, and a power supply 507. The processor 501 is electrically connected to the touch display screen 503, the radio frequency circuit 504, the audio circuit 505, the input unit 506, and the power supply 507. Those skilled in the art will understand that... Figure 5 The electronic device structure shown does not constitute a limitation on the electronic device and may include more or fewer components than shown, or combine certain components, or have different component arrangements.
[0398] The touch display screen 503 can be used to display a graphical user interface (GUI) and receive operation commands generated by the user interacting with the GUI. The touch display screen 503 may include a display panel and a touch panel. The display panel can be used to display information input by the user or information provided to the user, as well as various graphical user interfaces of the electronic device. These graphical user interfaces can be composed of graphics, text, icons, video, and any combination thereof. Optionally, the display panel can be configured using a liquid crystal display (LCD), organic light-emitting diode (OLED), or other similar technologies. The touch panel can be used to collect touch operations performed by the user on or near it (such as operations performed by the user using a finger, stylus, or any suitable object or accessory on or near the touch panel), generate corresponding operation commands, and execute the corresponding program according to the operation commands. Optionally, the touch panel may include two parts: a touch detection device and a touch controller. The touch detection device detects the user's touch location and the signal generated by the touch operation, transmitting the signal to the touch controller. The touch controller receives touch information from the touch detection device, converts it into touch point coordinates, and sends it to the processor 501. It can also receive and execute commands from the processor 501. The touch panel can cover the display panel. When the touch panel detects a touch operation on or near it, it transmits the information to the processor 501 to determine the type of touch event. Subsequently, the processor 501 provides corresponding visual output on the display panel based on the type of touch event. In this embodiment, the touch panel and the display panel can be integrated into the touch display screen 503 to achieve input and output functions. However, in some embodiments, the touch panel and the touch display screen 503 can be implemented as two independent components to achieve input and output functions. That is, the touch display screen 503 can also be used as part of the input unit 506 to achieve input functions.
[0399] The radio frequency circuit 504 can be used to transmit and receive radio frequency signals to establish wireless communication with network devices or other electronic devices, and to transmit and receive signals with network devices or other electronic devices.
[0400] Audio circuitry 505 can be used to provide an audio interface between a user and an electronic device via a speaker and a microphone. Audio circuitry 505 converts received audio data into electrical signals, transmits them to the speaker, and the speaker converts them into sound signals for output. Conversely, the microphone converts collected sound signals into electrical signals, which are then received by audio circuitry 505, converted back into audio data, and then processed by processor 501 before being transmitted via radio frequency circuitry 504 to, for example, another electronic device, or output to memory 502 for further processing. Audio circuitry 505 may also include an earphone jack to facilitate communication between peripheral headphones and electronic devices.
[0401] The input unit 506 can be used to receive input numbers, characters, or user characteristic information (such as fingerprints, iris, facial information, etc.), and to generate keyboard, mouse, joystick, optical, or trackball signal inputs related to user settings and function control.
[0402] Power supply 507 is used to supply power to various components of electronic device 500. Optionally, power supply 507 can be logically connected to processor 501 through a power management system, thereby enabling functions such as charging, discharging, and power consumption management through the power management system. Power supply 507 may also include one or more DC or AC power supplies, recharging systems, power fault detection circuits, power converters or inverters, power status indicators, and other arbitrary components.
[0403] although Figure 5 As not shown in the diagram, the electronic device 500 may also include a camera, sensor, wireless fidelity module, Bluetooth module, etc., which will not be described in detail here.
[0404] In the above embodiments, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions of other embodiments.
[0405] Those skilled in the art will understand that all or part of the steps in the various methods of the above embodiments can be performed by instructions, or by instructions controlling related hardware. These instructions can be stored in a computer-readable storage medium and loaded and executed by a processor.
[0406] Therefore, embodiments of this application provide a computer-readable storage medium storing multiple computer programs that can be loaded by a processor to execute any of the map boundary region construction methods provided in this application. The computer program can execute the steps of the map boundary region construction method as follows:
[0407] A regular quadrilateral mesh is generated based on the original raster resolution, ensuring that the mesh vertices precisely correspond to the pixel boundary intersections and each facet unit strictly corresponds to a single pixel region, establishing a spatial alignment basis between geometry and pixel data. By calculating the geometric center coordinates of each facet and sampling the original raster, the identifier code of the pixel region is obtained, providing a feature basis for boundary determination. Then, the adjacent edges of the mesh are traversed, and edges with different identifier codes on both sides are filtered out, directly filtering redundant internal edges to form a set of discrete boundary line segments. Based on the vertex connection relationship, the discrete line segments are reorganized into geometrically connected polylines containing open paths and closed loop paths, solving the topological breakage problem. Finally, a parametric path geometry mesh is generated based on the reorganized polylines, realizing a seamless conversion from vector data to renderable geometry, effectively avoiding the jagged distortion and excessive coarseness of the foreground in traditional raster rendering. While preserving the accuracy of the original geographic information, it improves the smoothness of boundary expression and real-time interactivity, providing an efficient solution for game maps and other scenarios.
[0408] In the embodiments of this application, a regular quadrilateral mesh is generated according to the original raster resolution, so that the mesh vertices precisely correspond to the pixel boundary intersections and each facet unit strictly corresponds to a single pixel region, establishing a spatial alignment basis for geometry and pixel data. By calculating the geometric center coordinates of each facet and sampling the original raster, the identifier code of the pixel region is obtained, providing a feature basis for boundary determination. Then, the adjacent edges of the mesh are traversed, and the edges with different identifier codes on both sides are filtered to directly filter redundant internal edges to form a set of discrete boundary line segments. Based on the vertex connection relationship, the discrete line segments are reorganized into geometrically connected polylines containing open paths and closed loop paths to solve the topological breakage problem. Finally, a parameterized path geometry mesh is generated based on the reorganized polylines, realizing a seamless conversion from vector data to renderable geometry, effectively avoiding the jagged distortion and overly coarse foreground defects of traditional raster rendering. While preserving the accuracy of the original geographic information, it achieves smoothness of boundary expression and real-time interactivity improvement, providing an efficient solution for game maps and other scenarios.
[0409] For details on the implementation of each of the above operations, please refer to the previous examples, which will not be repeated here.
[0410] The computer-readable storage medium may include: read-only memory (ROM), random access memory (RAM), disk or optical disk, etc.
[0411] Since the computer program stored in the computer-readable storage medium can execute any of the map boundary region construction methods provided in the embodiments of this application, the beneficial effects that any of the map boundary region construction methods provided in the embodiments of this application can achieve can be realized, as detailed in the preceding embodiments, and will not be repeated here.
[0412] According to one aspect of this application, a computer program product or computer program is also provided, comprising computer instructions stored in a computer-readable storage medium. A processor of an electronic device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the electronic device to perform the methods provided in the various optional implementations of the above embodiments.
[0413] In the above embodiments of the map boundary area construction apparatus, computer-readable storage medium, electronic device, and computer program product, the descriptions of each embodiment have different focuses. Parts not described in detail in a particular embodiment can be referred to in the relevant descriptions of other embodiments. Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes and beneficial effects of the map boundary area construction apparatus, computer-readable storage medium, computer program product, electronic device, and their corresponding units described above can be referred to the description of the map boundary area construction method in the above embodiments, and will not be repeated here.
[0414] The foregoing has provided a detailed description of a method, apparatus, electronic device, and storage medium for constructing a map boundary region according to embodiments of this application. Specific examples have been used to illustrate the principles and implementation methods of this application. The descriptions of the embodiments above are only for the purpose of helping to understand the method and core ideas of this application. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of this application. Therefore, the content of this specification should not be construed as a limitation of this application.
Claims
1. A method for constructing map boundary regions, characterized in that, The method includes: A quadrilateral grid is generated based on the resolution of the original raster pixels, such that the vertices of the quadrilateral grid correspond to the boundary intersections of the original raster pixels, and each quadrilateral patch unit corresponds to a single pixel region in the original raster pixels; wherein, the quadrilateral patch unit is formed by connecting four adjacent vertices. For each quadrilateral patch, determine the pixel region affiliation and obtain the identifier code of the pixel region corresponding to the quadrilateral patch; Traverse the adjacent edges in the quadrilateral grid, filter out the adjacent edges with different identifier codes of the adjacent quadrilateral faces on both sides, and form a set of discrete boundary line segments; Based on the vertex connection relationship between the discrete boundary line segments, the line segments with shared vertices are reorganized into a geometrically connected set of boundary polylines; wherein, the shared vertex is the coordinate of the endpoint of two discrete boundary line segments that coincide. A parameterized path geometry mesh is generated based on the boundary polyline set.
2. The method according to claim 1, characterized in that, Generate a regular quadrilateral grid based on the resolution of the original raster pixels, including: Based on the resolution N×M of the original raster pixels, a regular quadrilateral mesh with a vertex size of (N+1)×(M+1) is constructed; where M and N are both natural numbers. The vertices of the quadrilateral grid are generated by mapping linear indices to row and column two-dimensional indices, and the positions of the vertices are aligned with the boundary intersections of the original grid pixels.
3. The method according to claim 1, characterized in that, For each of the quadrilateral patches, the pixel region is assigned to a specific location, and the identifier code of the corresponding pixel region is obtained, including: Based on the geometric center coordinates of each quadrilateral patch, the original grid pixels are sampled for nearest point to obtain RGB color values, and the RGB color values are converted into integer values as the identification code of the corresponding pixel area.
4. The method according to claim 1, characterized in that, Filter out adjacent edges with different identifier codes for two adjacent quadrilateral faces, including: For each adjacent edge, obtain the two adjacent quadrilateral faces associated with it; Compare the identification codes of the two quadrilateral patches; In cases where the identifier codes are different, the adjacent edges are retained as boundary edges.
5. The method according to claim 4, characterized in that, If the identifier codes are the same, delete the adjacent edges.
6. The method according to claim 5, characterized in that, Comparing the identifier codes of the two quadrilateral faces includes: For each adjacent edge, extract the sets S0 and S1 of all quadrilateral faces to which the two vertices P0 and P1 of the adjacent edge belong; where S0 = {all quadrilateral faces containing vertex P0}, S1 = {all quadrilateral faces containing vertex P1}. Calculate the intersection S of the quadrilateral patch sets S0 and S1. shared =S0∩S1; In the intersection S shared If there are different quadrilateral faces with the same region identifier code, then the adjacent edge is deleted; otherwise, the adjacent edge is retained.
7. The method according to claim 1, characterized in that, The boundary polyline set includes open paths and closed loop paths; based on the vertex connection relationships between the discrete boundary segments, segments sharing vertices are reorganized into a geometrically connected boundary polyline set, including: Starting from an unvisited boundary edge, dynamically record the vertex sequence; Iteratively extend the path along adjacent edges; Output an open path if the path cannot be extended, or output a closed-loop path if the path is closed.
8. The method according to claim 7, characterized in that, Iteratively extend the path along adjacent edges, including: The set of adjacent edge endpoints associated with the current vertex is sorted and redundant elements are eliminated to generate a shared array with unique elements; wherein, the current vertex is the vertex currently being processed; Remove the current vertex from the neighbor array to form an adjacency dataset, and terminate the processing flow of the current vertex if the adjacency dataset is empty; Based on the preset vertex priority rules, verify the current vertex's dominant authority over the path extension process; In the case where the adjacency dataset has a binary feature, the shared vertex is used as the starting point to create mutually independent paths; Perform a depth-first traversal to extend the path sequence along adjacent edges; Output geometric topological entities based on the characteristics of the path sequence.
9. The method according to claim 8, characterized in that, Perform sorting and redundant element removal on the set of adjacent edge endpoints associated with the current vertex to generate a neighbor array with unique elements, including: Obtain the endpoints of all adjacent edges of the current vertex to form an initial shared array; wherein, the initial shared array includes the current vertex and the shared vertices directly connected to the current vertex; Perform a sorting operation on the initial shared array; Remove consecutive duplicate elements from the initial shared array to obtain a first shared array with unique elements.
10. The method according to claim 8, characterized in that, Based on preset vertex priority rules, verify the current vertex's dominant authority over the path extension process, including: If the identifier code of the current vertex and the identifier code of the shared vertex satisfy any of the following conditions, it is determined that the current vertex does not have the dominant authority, and the dominant authority is transferred to the vertex with the smaller identifier code: The current vertex identifier code is greater than the unique shared vertex identifier code; The current vertex identifier code is greater than the minimum identifier code among the two adjacent shared vertices; The current vertex identifier code is greater than the maximum identifier code of all shared vertices.
11. The method according to claim 8, characterized in that, Based on preset vertex priority rules, verify the current vertex's dominant authority over the path extension process, including: If the identifier code of the current vertex is less than the minimum identifier code of all shared vertices, the dominant permission of the current vertex is activated.
12. The method according to claim 9, characterized in that, When the number of shared vertices in the first shared array is 2, it is determined that the adjacency dataset has a binary feature; In the case where the adjacency dataset has a bipartite feature, creating mutually independent paths using the shared vertex as the path starting point includes: Create a first path array using the first shared vertex as the starting point of the path; Create a second path array using the second shared vertex as the starting point of the path.
13. The method according to claim 9, characterized in that, Perform a depth-first traversal to extend the path sequence along adjacent edges, including: Establish the iterative relationship between the predecessor vertex and the current vertex, where the predecessor vertex is initialized as the starting point of the path, and the current vertex is initialized as the next vertex after the starting point of the path; Dynamically obtain the first shared array of the current vertex; Detect the potential change of the first shared array and trigger the iteration termination condition; If the iteration termination condition is not triggered, the valid adjacent point is added to the path sequence, and the predecessor vertex is updated to the current vertex and the current vertex is the valid adjacent point. Then, the step of dynamically obtaining the first shared data of the current vertex continues.
14. The method according to claim 13, characterized in that, Detecting the potential change of the first shared array and triggering the iteration termination condition includes: If the number of remaining shared vertices in the first shared array is not equal to 1, output the first state information and terminate the traversal of the current path; wherein, the first state information indicates that the path extends to an endpoint or fork point; and / or If the number of remaining shared vertices in the first shared array is equal to 1, verify the relationship between the identifier code of the unique shared vertex in the first shared array and the identifier code of the path starting point to trigger the iteration termination condition.
15. The method according to claim 14, characterized in that, Verifying the relationship between the identifier code of the unique shared vertex in the first shared array and the identifier code of the path starting point to trigger the iteration termination condition includes: If the identifier code of the unique shared vertex is less than the identifier code of the path start point, output second status information indicating permission transfer; wherein, the second status information indicates that the current path should be processed by the vertex with the smaller identifier code; If the identifier of the unique shared vertex is equal to the identifier of the path start point, output the third state information indicating the formation of the closed loop path and terminate the traversal of the current path.
16. The method according to claim 15, characterized in that, If the iteration termination condition is not triggered, add valid adjacent nodes to the path sequence, including: If the identifier code of the unique shared vertex is greater than the identifier code of the path start point, the unique shared vertex is appended to the path sequence.
17. The method according to claim 15, characterized in that, Output geometric topological entities based on path sequence features, including: If the first state information is output, the current path is an open path, and the vertex sequence is directly output as a polyline primitive; If the third state information is output, the current path is a closed loop path. Perform the deduplication operation of the first and last vertices and output the closed loop polyline primitive. Combine all the output polyline primitives into a geometrically connected set of boundary polylines.
18. The method according to claim 1, characterized in that, Generate a parameterized path geometry mesh based on the boundary polyline set, including: Traverse each vertex of the boundary polyline set and calculate the spatial transformation parameters based on the vertex's position type in the path. Generate the two-sided cross-section vertex of each vertex according to the spatial transformation parameters; Perform quadrilateral triangulation on the vertices of adjacent sections; Generate vertex texture coordinates based on the geometric features of the path; The vertices, triangle patches, and associated attributes generated segment by segment are integrated into a single mesh entity; wherein, the vertex data of the single mesh entity includes position, normal, and texture coordinates, and the patch data includes a triangle index sequence.
19. The method according to claim 18, characterized in that, Iterate through each vertex of the boundary polyline set and calculate the spatial transformation parameters based on the vertex's position type in the path, including: For the path start / end point, calculate the path normal based on the directions of adjacent vertices, and generate a symmetric offset based on the path width parameter; For intermediate vertices, the average normal is calculated based on the adjacent directions before and after, and the adaptive offset is dynamically calculated based on the path angle.
20. The method according to claim 18, characterized in that, Generating vertex texture coordinates based on path-based geometric features includes: Update the accumulated parameters based on the ratio of vertex spacing to path width; Assign vertical texture coordinates to the vertices of both sides of the cross section to generate a continuous texture map along the path.
21. The method according to claim 1, characterized in that, Generate a parameterized path geometry mesh based on the boundary polyline set, including: The boundary polyline set is recursively subdivided and smoothed, and smooth polylines with uniformly distributed vertices are generated by equidistant resampling. A parametric path geometry mesh is generated based on the smooth polyline.
22. The method according to claim 21, characterized in that, The boundary polyline set is recursively subdivided and smoothed, and smooth polylines with uniformly distributed vertices are generated through equidistant resampling, including: Perform a predetermined number of recursive iterations on the input polyline vertex sequence; Based on the vertex sequence after iterative processing, perform equidistant cutting along the path; Output a set of smooth polylines with uniformly distributed vertices.
23. The method according to claim 1, characterized in that, For each of the quadrilateral patches, the pixel region is assigned to a specific location, and the identifier code of the corresponding pixel region is obtained, including: Calculate the coordinates of the geometric center of each of the quadrilateral facets; Based on the geometric center coordinates, the original grid pixels are sampled to obtain the identification code of the corresponding pixel region.
24. An electronic device, characterized in that, It includes a memory and a processor; the memory stores a computer program, and the processor is used to run the computer program in the memory to perform the operations in the method for constructing the map boundary area according to any one of claims 1 to 23.
25. A computer program product, characterized in that, Includes a computer program or instructions that, when executed by a processor, implement the steps of the method for constructing a map boundary region as described in any one of claims 1 to 23.