A method and device for generating a road network model, a storage medium and an electronic device
By automatically generating road network models using user-drawn curves and preset parameters, the problem of long development cycles for road network models is solved, enabling rapid generation and flexible adjustment, thus improving development efficiency.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- BOE TECHNOLOGY GROUP CO LTD
- Filing Date
- 2022-02-22
- Publication Date
- 2026-07-28
AI Technical Summary
In existing technologies, the development cycle of road network models is slow, consuming a lot of manpower and time, resulting in low application development efficiency.
By acquiring the curves drawn by the user, the intersection points and road segment endpoints are determined to form independent graphic units, and a road network model is automatically generated according to preset parameters, including the connection between intersection units and non-intersection units.
It can automatically generate road network models in a short time, saving manpower and time costs, improving application development efficiency, and supporting subsequent parameter adjustments to optimize the user experience.
Smart Images

Figure CN115187734B_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of computer technology, and in particular to a method, apparatus, storage medium, and electronic device for generating a road network model. Background Technology
[0002] Currently, various games, films, advertisements, and interactive 3D visualizations involve the creation of numerous road models for human living spaces. This repetitive modeling of road networks consumes significant manpower and time. Furthermore, during application development, each intersection or road segment needs to be modeled individually based on its specific conditions, further lengthening the road network modeling cycle and resulting in low overall application development efficiency. Summary of the Invention
[0003] The purpose of this disclosure is to provide a method, apparatus, storage medium, and electronic device for generating road network models, in order to solve the problems of slow development cycles and waste of a lot of manpower and time costs in the prior art.
[0004] The embodiments of this disclosure adopt the following technical solution: a method for generating a road network model, comprising: acquiring at least one curve drawn by a user, wherein each curve is used to represent a road; determining the intersection points between all the curves and the road segment endpoints of all the curves; determining the midpoints between adjacent intersection points; forming independent first graphic units for each intersection point and the line segments between all the road segment endpoints and / or midpoints adjacent to the intersection point, wherein the U-direction of all first graphic units corresponding to any intersection point is a direction originating from the intersection point and extending along the curve away from the intersection point; extending outward by a preset length from each intersection point along the curve direction away from the intersection point to determine the connecting endpoints corresponding to the intersection point; Traverse all adjacent connecting endpoints of each intersection point and the inner broken lines formed between the intersection point and the intersection point, and determine the outer midpoint and outer endpoint of each inner broken line according to a preset curvature and a preset width; form the outer curve corresponding to the inner broken line according to the outer midpoint and the outer endpoint; form the intersection unit of the intersection point according to all the inner broken lines and all the outer curves corresponding to the inner broken lines; form an independent second graphic unit for each connecting endpoint and the line segments between all the road segment endpoints and / or the midpoints adjacent to the connecting endpoint; form a non-intersection unit based on the second graphic unit and the preset width; connect all adjacent intersection units and non-intersection units to form a road network model.
[0005] This disclosure also provides a road network model generation apparatus, comprising: an acquisition module for acquiring at least one curve drawn by a user, wherein each curve represents a road; an intersection point and road segment endpoint generation module for determining the intersection points between all the curves and the road segment endpoints of all the curves; a first graphic unit generation module for determining the midpoints between adjacent intersection points, forming independent first graphic units for each intersection point and the line segments between all road segment endpoints and / or midpoints adjacent to the intersection point, wherein the U-direction of all first graphic units corresponding to any intersection point is a direction originating from the intersection point and extending along the curve away from the intersection point; a connection endpoint generation module for extending outward by a preset length from each intersection point along the curve direction away from the intersection point to determine the connection endpoints corresponding to the intersection points; and a traversal module for traversing each... An inner polygonal line is formed between all two adjacent connecting endpoints of the intersection point and the intersection point, and the outer midpoint and outer endpoint of each inner polygonal line are determined according to a preset curvature and a preset width; an outer curve generation module is used to form an outer curve corresponding to the inner polygonal line based on the outer midpoint and the outer endpoint; an intersection unit generation module is used to form an intersection unit of the intersection point based on all the inner polygonal lines and all the outer curves corresponding to the inner polygonal lines; a second graphic unit generation module is used to form an independent second graphic unit for each connecting endpoint and the line segments between all the road segment endpoints and / or the midpoints adjacent to the connecting endpoint; a non-intersection unit generation module is used to form a non-intersection unit based on the second graphic unit and the preset width; a road network generation module is used to connect all adjacent intersection units and non-intersection units to form a road network model.
[0006] This disclosure also provides a storage medium storing a computer program, which, when executed by a processor, implements the steps of the road network model generation method described above.
[0007] This disclosure also provides an electronic device, including at least a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program in the memory to implement the steps of the above-described method for generating a road network model.
[0008] The beneficial effects of this disclosure are as follows: by acquiring multiple curves drawn by the user to represent the road according to the user's needs, and based on the characteristics such as the intersection points and road segment endpoints between the curves, combined with preset parameters such as preset length, preset width, and preset curvature related to the road, a road network model can be automatically generated in a short time for simulation, which greatly shortens the road network model establishment cycle and achieves the goal of saving manpower and time costs. Attached Figure Description
[0009] To more clearly illustrate the technical solutions in the embodiments of this disclosure or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in this disclosure. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0010] Figure 1 This is a flowchart of the method for generating a road network model in the first embodiment of this disclosure;
[0011] Figure 2 This is a schematic diagram of a curve drawn by a user in the first embodiment of this disclosure;
[0012] Figure 3 This is a schematic diagram of the intersection and road segment endpoints in the first embodiment of this disclosure;
[0013] Figure 4 This is a U-direction schematic diagram of the first graphic unit in the first embodiment of this disclosure;
[0014] Figure 5 This is a schematic diagram of the connection endpoints in the first embodiment of this disclosure;
[0015] Figure 6 This is a schematic diagram of the inner broken line and the outer extension curve in the first embodiment of this disclosure;
[0016] Figure 7 This is a schematic diagram of an intersection unit in the first embodiment of this disclosure;
[0017] Figure 8 This is a schematic diagram of a non-intersection unit in the first embodiment of this disclosure;
[0018] Figure 9 This is a schematic diagram of the road network model in the first embodiment of this disclosure;
[0019] Figure 10 This is a schematic diagram of the structure of the road network model generation device in the second embodiment of this disclosure;
[0020] Figure 11 This is a schematic diagram of the structure of the electronic device in the fourth embodiment of this disclosure. Detailed Implementation
[0021] Various embodiments and features of this disclosure are described herein with reference to the accompanying drawings.
[0022] It should be understood that various modifications can be made to the embodiments described herein. Therefore, the above description should not be considered as limiting, but merely as an example of embodiments. Other modifications within the scope and spirit of this disclosure will be apparent to those skilled in the art.
[0023] The accompanying drawings, which are included in and form part of this specification, illustrate embodiments of the present disclosure and, together with the general description of the disclosure given above and the detailed description of the embodiments given below, serve to explain the principles of the disclosure.
[0024] These and other features of this disclosure will become apparent from the following description of preferred forms of embodiments given as non-limiting examples, with reference to the accompanying drawings.
[0025] It should also be understood that although this disclosure has been described with reference to some specific examples, many other equivalent forms of this disclosure can be definitively implemented by those skilled in the art, which have the features of the claims and are therefore within the scope of protection defined herein.
[0026] The above and other aspects, features and advantages of this disclosure will become more apparent when taken in conjunction with the accompanying drawings and in view of the following detailed description.
[0027] Specific embodiments of this disclosure are described thereafter with reference to the accompanying drawings; however, it should be understood that the claimed embodiments are merely examples of this disclosure, which may be implemented in various ways. Well-known and / or repeated functions and structures are not described in detail to avoid unnecessary or redundant details that could obscure this disclosure. Therefore, the specific structural and functional details claimed herein are not intended to be limiting, but merely to serve as the basis and representative basis for the claims to teach those skilled in the art to use this disclosure in a variety of substantially any suitable detailed structures.
[0028] This specification may use the phrases “in one embodiment,” “in another embodiment,” “in yet another embodiment,” or “in still another embodiment,” all of which may refer to one or more of the same or different embodiments according to this disclosure.
[0029] Currently, various games, films, advertisements, and interactive 3D visualizations involve the creation of numerous road models for human living spaces. This repetitive modeling of road networks consumes significant manpower and time. Furthermore, during application development, each intersection or road segment needs to be modeled individually based on its specific conditions, further lengthening the road network modeling cycle and resulting in low overall application development efficiency.
[0030] To address the aforementioned issues, the first embodiment of this disclosure provides a method for generating road network models, which enables the automatic generation of corresponding road network models based on user-drawn curves. This significantly shortens the road network model creation cycle and reduces human resource consumption during application development, thereby improving the overall development efficiency of the application. Figure 1 A flowchart of the road network model generation method in this embodiment is shown, such as... Figure 1As shown, the method for generating the road network model provided in this embodiment mainly includes steps S1 to S10:
[0031] S1, obtain at least one curve drawn by the user.
[0032] In this embodiment, the user can draw curves according to the actual road network conditions required. Each curve corresponds to a road in the road network. During the drawing process, the curves can be used to draw the length of the road, the direction of the road, and the intersections between roads, etc. Figure 2 As shown. When actually drawing curves, users can draw directly using a mouse on a computer device, or draw on a tablet or drawing board connected to the computer device, or draw on paper and then input it into the computer device by taking a picture or scanning it. This application does not impose specific restrictions on this.
[0033] S2 determines the intersections between all curves and the endpoints of all curve segments.
[0034] In this embodiment, a curve represents a road, and the intersection point between two intersecting curves represents the intersection between the two roads. A road segment mainly refers to a continuous road without intersections. Based on all the curves obtained in step S1, the endpoint of a road segment is the end of a road. However, in the actual development process, an endpoint of a road segment may connect to the endpoint of another road segment, thus forming a complete and continuous new road segment. Alternatively, an endpoint of a road segment may connect to multiple other endpoints, in which case it may become an intersection point between curves, forming a new intersection. This embodiment mainly focuses on establishing the road network model corresponding to the currently obtained curves. Whether it will be connected to other road network models later can be set by the user according to their needs; this embodiment does not impose any restrictions.
[0035] Specifically, this embodiment determines intersection points and road segment endpoints by traversing the vertices. For each curve, it can be divided into two equal parts based on a shorter length. The endpoints of each segment are the vertices of the curve. For each vertex, the number of adjacent vertices indicates its position. For example, if a vertex is adjacent to 1 vertex, it is a road segment endpoint; if it is adjacent to 4 vertexes, it is an intersection point between two curves, having 2 adjacent vertices to each curve; if it is adjacent to exactly 2 vertexes, it is an ordinary point on the curve that is neither a road segment endpoint nor an intersection point. Therefore, when determining intersection points and road segment endpoints, vertices with more than 2 adjacent vertices can be identified as intersection points, and vertices with less than 2 adjacent vertices can be identified as road segment endpoints, provided that the number of adjacent vertices is a positive integer.
[0036] Furthermore, after determining the number of neighboring vertices for each vertex, a PN (PointNeighbour) attribute can be created for each vertex to record the specific value of the number of neighboring vertices for each vertex, which can be used as a primitive attribute of the vertex during primitive transformation in subsequent processes.
[0037] Figure 3 A schematic diagram of an intersection and road segment endpoint is shown, where A1 to A5 represent intersections and D1 to D8 represent road network endpoints.
[0038] In some embodiments, after all intersections are determined, the distance between any two intersections can be calculated to determine whether the distance is less than twice the preset length. The preset length L is the shortest distance between the center point of the intersection (i.e., the location of the intersection) and the end of the intersection. For any two intersections, if the distance between the center points of the two intersections is less than twice the preset length (i.e., 2L), it means that the distance between the two intersections is too close, and the distance between the end of any intersection and the center point does not meet the requirement of the preset length, nor does it meet the actual setting. Therefore, for two adjacent intersections with a distance less than 2L, they can be merged into one intersection to make the road network layout more reasonable and facilitate subsequent calculations and modeling.
[0039] S3, determine the midpoint between adjacent intersections, and form an independent first graphic unit for each intersection and the line segments between all road segment endpoints and / or midpoints adjacent to the intersection.
[0040] Each intersection point and the line segment between the road segment endpoints adjacent to that intersection point can be processed as an independent graphic unit, facilitating subsequent adjustment of the graphic element direction and overall road network modeling. However, for intersection points not adjacent to road segment endpoints, or intersection points adjacent to other intersection points, treating the line segment between two adjacent intersection points as a single graphic unit would lead to chaotic graphic element direction. In this case, the midpoint between two adjacent intersection points can be determined first. This midpoint can then be used as the road segment endpoint, and the line segment between this midpoint and the intersection points adjacent to it can be treated as an independent graphic unit. This transforms one line segment between adjacent intersection points into two line segments, and the resulting graphic unit can be directionally constrained according to the requirements for the intersection point's direction. In this embodiment, the U-direction of each intersection point and the line segments between all road segment endpoints and / or midpoints adjacent to that intersection point form an independent first graphic unit, with the U-direction originating from the intersection point and extending along the corresponding curve away from it, i.e., from u0 to u1. Figure 4 As shown. Specifically, when implementing the U-direction adjustment of each first graphic unit, the primitive attributes derived from the PN attributes of each vertex can be used to divide, shrink, or reverse each first graphic unit at the current intersection point, forming a structure like... Figure 4 The U-shaped effect shown.
[0041] S4, extend a predetermined length outward from each intersection point along the curve direction away from the intersection point to determine the connection endpoint corresponding to the intersection point.
[0042] A connecting endpoint refers to the endpoint where an intersection meets a non-intersection section. Generally, each connecting endpoint of an intersection is equidistant from the center point of the intersection; this distance is the preset length L. Therefore, after determining the center point (intersection point) of an intersection, extending the preset length from that intersection point along the corresponding curve direction away from the intersection point yields the connecting endpoint B corresponding to each intersection point. Figure 5 As shown here, it is important to note that... Figure 5 The diagram only shows the connection endpoints at intersection A1. In actual implementation, the connection endpoints need to be determined for each intersection. For an intersection, there are at least three connection endpoints. If the intersection is a crossroads, then there are four connection endpoints.
[0043] S5: Traverse all the inner broken lines formed by the two adjacent connecting endpoints of each intersection point and the intersection point, and determine the outer midpoint and outer endpoint of each inner broken line according to the preset curvature and preset width.
[0044] S6, based on the midpoint and endpoint of the extension, forms the extension curve corresponding to the inner broken line.
[0045] like Figure 6As shown, for any intersection point A, assuming its corresponding intersection is a crossroads, there should be four connecting endpoints, represented by B1 to B4 respectively. In the process of generating roads based on user-drawn curves, it is necessary to transform a road represented by a single curve into a road surface represented by two curves with a defined width. At this point, the curves need to be processed according to preset curvature C and preset width W, etc., to characterize the road attributes. The preset curvature C refers to the curvature of the curve at the intersection, and the preset width W represents the width of the road.
[0046] Specifically, for Figure 6 For the intersection point shown and its corresponding connecting endpoint, any two adjacent connecting endpoints can form an inner broken line with the intersection point, such as B2-A-B3. Figure 6 There are four inner bends in the road, each corresponding to a bend where two adjacent roads intersect. Therefore, an extended curve with an arc needs to be determined at each inner bend to form the curve section. When determining the extended curve, first, the midpoint E of the extended curve is determined based on the preset curvature C and the inner bend. Then, two extended endpoints F1 and F2 are determined based on the connection endpoint positions and the preset width W. Finally, a smooth curve connects F1, E, and F2 sequentially to form the extended curve F1-E-F2. It is important to note that F1, E, and F2 are all located on the same side of the inner bend, ensuring that the connected extended curves do not overlap with the extended curves corresponding to other inner bends. Figure 6 The distance between the outer endpoints F1 and B2 is half the preset width W. When determining the outer curve of the inner broken line B1-A-B2, the other half of the preset width can be formed accordingly. The road width after splicing is the same as the preset width. In addition, when determining the outer endpoints, 1 / 2W can be extended perpendicularly to the tangent of the curve where the connecting endpoint is located. This ensures that after all the outer curves corresponding to the inner broken lines are determined, the two outer endpoints determined based on the same connecting endpoint can be on the same straight line as the connecting endpoint. This also facilitates the docking of the generated intersection unit with other units.
[0047] In some embodiments, the inner broken line formed between adjacent connecting endpoints and the intersection can be determined by measuring the tan value of the vector formed by the intersection point and each connecting endpoint or by the cross product of the vectors. This avoids the computer selecting two non-adjacent connecting endpoints during execution, which could affect subsequent processing.
[0048] S7, form the intersection unit of the intersection point based on all the inner broken lines corresponding to each intersection point and all the outer extension curves corresponding to all the inner broken lines.
[0049] For an intersection point, connecting the outer curves corresponding to each inner broken line forms an intersection shape, thus creating the intersection unit corresponding to that intersection point, such as... Figure 7 As shown. In the actual connection process, the road surface can first be established for the area enclosed by an inner broken line and its corresponding outer extension curve, so that the hollow area enclosed by the lines becomes a road surface area with an actual plane. After the road surface is established for all inner broken lines and corresponding outer extension curves, they can be spliced to form the intersection unit.
[0050] In some embodiments, the inner broken line and its corresponding outer curve are first divided according to a preset subdivision value S, so that the inner broken line and the outer curve have the same number of subdivision points with the same numbering order. Then, the subdivision points on the inner broken line and the subdivision points on the outer curve are connected in the order of the subdivision points. Then, the small planes enclosed by the lines connecting the subdivision points are sequentially linked to form a plane, which serves as an intersection sub-unit. After all intersection sub-units are determined, all intersection sub-units are sequentially connected according to the positional relationship between the inner broken lines to form the intersection unit corresponding to the intersection point.
[0051] S8 forms an independent second graphic unit for each connecting endpoint and the line segments between all road segment endpoints and / or midpoints adjacent to the connecting endpoint.
[0052] S9 forms a non-intersection unit based on the second graphic unit and the preset width.
[0053] After the intersection units are determined, the road network still needs to establish independent road segments. Intersections are connected by road segments to form a complete road network model. Specifically, the connecting endpoints serve as the boundary points between intersections and road segments. An intersection is formed between the connecting endpoint and the intersection point, while a road segment is formed between the connecting endpoint and the road segment endpoint. Therefore, in this embodiment, each connecting endpoint and the line segments between all adjacent road segment endpoints and / or midpoints are treated as independent second graphic units. Based on this, and combined with a preset width W, the second graphic units presented as line segments are transformed into non-intersection units presented as planes.
[0054] Specifically, in the process of converting the second graphic unit into a non-intersection unit, half of the preset width can be extended from the two endpoints of the second graphic unit (one endpoint being a connecting endpoint, and the other endpoint being a road segment endpoint or midpoint) in a direction perpendicular to the tangent direction of the second graphic unit to form four extended endpoints G corresponding to the second graphic unit; after the extended endpoints are determined, the extended endpoints are connected sequentially to form a non-intersection unit, such as... Figure 8As shown. In addition, after the outer endpoints are determined, subdivision points can be determined according to preset subdivision values, and then the points are connected to form lines, the lines are connected to form surfaces, and finally a non-road segment unit with a road surface is formed.
[0055] S10 connects all adjacent intersection units and non-intersection units to form a road network model.
[0056] After determining the intersection units and non-intersection units, adjacent intersection units and non-intersection units can be connected sequentially according to the position and connection between the endpoints to obtain a complete road network model, such as... Figure 9 As shown. After the road network model is generated, the road-related parameters and the road network model used in the road network setup process can be packaged and provided to the game engine or application creation program as a plugin.
[0057] It should be understood that all road-related parameters used in this embodiment, including but not limited to preset length L, preset width W, preset curvature C, and preset subdivision S, can directly use common default values during the road network generation process to quickly establish a basic road network model. During subsequent model generation, debugging, or application, the corresponding parameter values of any one or more intersection units and / or non-intersection units in the road network model can be adjusted according to actual needs for intersections or road segments. Even the same intersection unit can have different settings; for example, the width of an east-west road can be W, and the width of a north-south road can be 2W. This embodiment does not impose such restrictions; as long as the above parameters are set as variable parameters, the corresponding self-adjustment function can be implemented after model generation.
[0058] In some embodiments, users can set road assets, such as shoulders, warning signs, and traffic lights, along the outer curve of each intersection unit according to actual needs. They can also set up buildings, green belts, or sidewalks on both sides of the road as needed to enrich the road network model and optimize the actual user experience.
[0059] This embodiment acquires multiple curves drawn by the user to represent roads according to their needs. Based on features such as intersections and road segment endpoints, combined with preset parameters related to roads, such as length, width, and curvature, it automatically generates a road network model in a short time for simulation. This significantly shortens the road network model creation cycle, saving manpower and time costs. Furthermore, after the road network model is generated, parameters can be adjusted based on different intersection or non-intersection units, enabling rapid customization and improving the user experience.
[0060] A second embodiment of this disclosure provides a road network model generation apparatus that can be installed in a computer device used for application development or game creation. Figure 10 This is a schematic diagram of the road network model generation device in this embodiment, which mainly includes: an acquisition module 10 for acquiring at least one curve drawn by the user, wherein each curve represents a road; an intersection point and road segment endpoint generation module 20 for determining the intersection points between all curves and the road segment endpoints of all curves; a first graphic unit generation module 30 for determining the midpoint between adjacent intersection points, forming an independent first graphic unit for each intersection point and the line segments between all road segment endpoints and / or midpoints adjacent to the intersection point, wherein the U direction of all first graphic units corresponding to any intersection point is a direction that starts from the intersection point and extends along the curve away from the intersection point; a connection endpoint generation module 40 for extending a preset length outward from each intersection point along the curve direction away from the intersection point to determine the connection endpoint corresponding to the intersection point; and a traversal module 50 for traversing... The system generates an inner polyline between each intersection point and all its adjacent connecting endpoints, and determines the outer midpoint and outer endpoint of each inner polyline based on a preset curvature and a preset width. The outer curve generation module 60 generates an outer curve corresponding to the inner polyline based on the outer midpoint and outer endpoint. The intersection unit generation module 70 generates an intersection unit for each intersection point based on all the inner polylines and all the outer curves corresponding to the inner polylines. The second graphic unit generation module 80 generates an independent second graphic unit for each connecting endpoint and the line segments between all road segment endpoints and / or midpoints adjacent to the connecting endpoint. The non-intersection unit generation module 90 generates a non-intersection unit based on the second graphic unit and a preset width. The road network generation module 100 connects all adjacent intersection units and non-intersection units to form a road network model.
[0061] In some embodiments, the intersection point and road segment endpoint generation module 20 is specifically used to: traverse the number of adjacent vertices of all vertices of all curves, where the number of adjacent vertices is a positive integer; determine vertices with a number of adjacent vertices greater than 2 as intersection points; and determine vertices with a number of adjacent vertices less than 2 as road segment endpoints.
[0062] In some embodiments, the intersection and road segment endpoint generation module 20 is also used to determine the distance between any two adjacent intersections; and to merge two intersections whose distance is less than twice the preset length.
[0063] In some embodiments, the intersection unit generation module 70 is specifically used to divide the inner broken line and the corresponding outer curve according to a preset subdivision, so that the inner broken line and the outer curve have the same number of subdivision points with the same number order; connect the subdivision points of the inner broken line and the subdivision points on the outer curve in sequence according to the order of the subdivision points to form an intersection sub-unit; connect all the intersection sub-units in sequence to form an intersection unit at the intersection point.
[0064] In some embodiments, the non-intersection unit generation module 90 is specifically used to extend 1 / 2 of a preset width in a direction perpendicular to the tangent direction of the second graphic unit based on the two endpoints of the second graphic unit to form four extended endpoints of the second graphic unit; and connect all the extended endpoints of the second graphic unit to form a non-intersection unit.
[0065] Specifically, the preset length, preset width, preset curvature, and preset subdivision are all variable parameters.
[0066] In some embodiments, the road network generation module 100 is further configured to set road assets extending along the outer curve of each intersection unit.
[0067] This embodiment acquires multiple curves drawn by the user to represent roads according to their needs. Based on features such as intersections and road segment endpoints, combined with preset parameters related to roads, such as length, width, and curvature, it automatically generates a road network model in a short time for simulation. This significantly shortens the road network model creation cycle, saving manpower and time costs. Furthermore, after the road network model is generated, parameters can be adjusted based on different intersection or non-intersection units, enabling rapid customization and improving the user experience.
[0068] The third embodiment of this disclosure provides a storage medium that can be installed in any computer device used for application or game development with road settings. Specifically, it is a computer-readable medium storing a computer program that, when executed by a processor, implements the method provided in any embodiment of this disclosure, including the following steps S31 to S40:
[0069] S31, Obtain at least one curve drawn by the user, wherein each curve is used to represent a road;
[0070] S32, determine the intersection points between all curves and the road segment endpoints of all curves;
[0071] S33, determine the midpoint between adjacent intersections, and form an independent first graphic unit for each intersection and the line segments between the endpoints and / or midpoints of all road segments adjacent to the intersection. The U direction of all first graphic units corresponding to any intersection is a direction that starts from the intersection and extends along the curve away from the intersection.
[0072] S34, extend a preset length outward from each intersection point along the curve direction away from the intersection point to determine the connection endpoint corresponding to the intersection point;
[0073] S35, traverse all the inner broken lines formed by the two adjacent connecting endpoints of each intersection point and the intersection point, and determine the outer midpoint and outer endpoint of each inner broken line according to the preset curvature and preset width;
[0074] S36, the extension curve corresponding to the inner broken line is formed based on the midpoint and endpoint of the extension;
[0075] S37, form the intersection unit of the intersection point based on all the inner broken lines and all the outer extension curves corresponding to each intersection point;
[0076] S38, each connecting endpoint and the line segments between all road segment endpoints and / or midpoints adjacent to the connecting endpoint are formed into independent second graphic units;
[0077] S39, forming a non-intersection unit based on the second graphic unit and the preset width;
[0078] S40 connects all adjacent intersection units and non-intersection units to form a road network model.
[0079] When a computer program is executed by a processor to determine the intersection points between all curves and the endpoints of all curve segments, the processor specifically performs the following steps: traverse all vertices of all curves and count the number of adjacent vertices, where the number of adjacent vertices is a positive integer; determine the vertices with a number of adjacent vertices greater than 2 as intersection points; and determine the vertices with a number of adjacent vertices less than 2 as endpoints of the curve segments.
[0080] After the computer program is executed by the processor to determine the intersection points between all curves and the endpoints of all curve segments, the processor also performs the following steps: determining the distance between any two adjacent intersection points; merging two intersection points whose distance is less than twice the preset length.
[0081] When a computer program is executed by a processor to form intersection units based on all inner broken lines and all outer curves corresponding to each intersection point, the processor specifically performs the following steps: Dividing the inner broken lines and their corresponding outer curves according to a preset subdivision, so that the inner broken lines and outer curves have the same number of subdivision points with the same numbering order; connecting the subdivision points of the inner broken lines and the subdivision points on the outer curves in sequence according to the order of the subdivision points to form intersection sub-units; connecting all intersection sub-units in sequence to form the intersection unit of the intersection point.
[0082] When the computer program is executed by the processor to form a non-intersection unit based on the second graphic unit and the preset width, the processor specifically performs the following steps: based on the two endpoints of the second graphic unit, extend 1 / 2 of the preset width in a direction perpendicular to the tangent direction of the second graphic unit to form four extended endpoints of the second graphic unit; connect all the extended endpoints of the second graphic unit to form a non-intersection unit.
[0083] Specifically, the preset length, preset width, preset curvature, and preset subdivision are all variable parameters.
[0084] After the computer program is executed by the processor to form a road network model, the processor also performs the following steps: setting road assets along the outer curve of each intersection unit.
[0085] This embodiment acquires multiple curves drawn by the user to represent roads according to their needs. Based on features such as intersections and road segment endpoints, combined with preset parameters related to roads, such as length, width, and curvature, it automatically generates a road network model in a short time for simulation. This significantly shortens the road network model creation cycle, saving manpower and time costs. Furthermore, after the road network model is generated, parameters can be adjusted based on different intersection or non-intersection units, enabling rapid customization and improving the user experience.
[0086] The fourth embodiment of this disclosure provides an electronic device that may include a system or platform for application development or game development that requires road setting, as shown in the schematic diagram below. Figure 11 As shown, the device includes at least a memory 1000 and a processor 2000. The memory 1000 stores a computer program, and the processor 2000 implements the methods provided in any embodiment of this disclosure when executing the computer program in the memory 1000. Exemplarily, the steps of the electronic device computer program are as follows: S41 to S50:
[0087] S41, Obtain at least one curve drawn by the user, wherein each curve is used to represent a road;
[0088] S42, determine the intersection points between all curves and the segment endpoints of all curves;
[0089] S43, determine the midpoint between adjacent intersections, and form an independent first graphic unit for each intersection and the line segments between the endpoints and / or midpoints of all road segments adjacent to the intersection. The U direction of all first graphic units corresponding to any intersection is a direction that starts from the intersection and extends along the curve away from the intersection.
[0090] S44, extend a preset length outward from each intersection point along the curve direction away from the intersection point to determine the connection endpoint corresponding to the intersection point;
[0091] S45, traverse all the inner broken lines formed by the two adjacent connecting endpoints of each intersection point and the intersection point, and determine the outer midpoint and outer endpoint of each inner broken line according to the preset curvature and preset width;
[0092] S46, The extension curve corresponding to the inner broken line is formed based on the extension midpoint and extension endpoint;
[0093] S47, form the intersection unit of the intersection point based on all the inner broken lines and all the outer extension curves corresponding to each intersection point;
[0094] S48, each connecting endpoint and the line segments between all road segment endpoints and / or midpoints adjacent to the connecting endpoint are formed into independent second graphic units;
[0095] S49, forming a non-intersection unit based on the second graphic unit and the preset width;
[0096] S50 connects all adjacent intersection units and non-intersection units to form a road network model.
[0097] When the processor executes the memory-stored program to determine the intersection points between all curves and the endpoints of all curve segments, it specifically executes the following computer program: iterates through all the adjacent vertices of all the vertices of all curves, where the number of adjacent vertices is a positive integer; determines the vertices with a number of adjacent vertices greater than 2 as intersection points; and determines the vertices with a number of adjacent vertices less than 2 as endpoints of road segments.
[0098] After executing the memory stored in the memory to determine the intersection points between all curves and the endpoints of all curve segments, the processor also executes the following computer program: determining the distance between any two adjacent intersection points; merging two intersection points whose distance is less than twice the preset length.
[0099] When the processor executes the intersection unit stored in memory, which is formed by all the inner broken lines and all the outer curves corresponding to each intersection point, it specifically executes the following computer program: Divide the inner broken lines and the corresponding outer curves according to the preset subdivision, so that the inner broken lines and the outer curves have the same number of subdivision points with the same numbering order; connect the subdivision points of the inner broken lines and the subdivision points on the outer curves in the order of the subdivision points to form intersection sub-units; connect all intersection sub-units in sequence to form intersection units of intersection points.
[0100] When the processor executes the non-intersection unit based on the second graphics unit and the preset width stored in the memory, it specifically executes the following computer program: based on the two endpoints of the second graphics unit, extend 1 / 2 of the preset width in a direction perpendicular to the tangent direction of the second graphics unit to form four extended endpoints of the second graphics unit; connect all the extended endpoints of the second graphics unit to form a non-intersection unit.
[0101] Specifically, the preset length, preset width, preset curvature, and preset subdivision are all variable parameters.
[0102] After executing the road network model stored in memory, the processor also executes the following computer program: setting up road assets along the extension curve of each intersection unit.
[0103] This embodiment acquires multiple curves drawn by the user to represent roads according to their needs. Based on features such as intersections and road segment endpoints, combined with preset parameters related to roads, such as length, width, and curvature, it automatically generates a road network model in a short time for simulation. This significantly shortens the road network model creation cycle, saving manpower and time costs. Furthermore, after the road network model is generated, parameters can be adjusted based on different intersection or non-intersection units, enabling rapid customization and improving the user experience.
[0104] The foregoing has provided a detailed description of several embodiments of this disclosure. However, this disclosure is not limited to these specific embodiments. Those skilled in the art can make various variations and modifications based on the concept of this disclosure, and all such variations and modifications should fall within the scope of protection claimed by this disclosure.
Claims
1. A method of generating a road network model, characterized by, include: Obtain at least one curve drawn by the user, where each curve represents a road; Determine the intersection points between all the curves and the endpoints of all the curve segments; Determine the midpoint between adjacent intersections, and form a first graphic unit for each intersection and the line segments between all road segment endpoints and / or midpoints adjacent to the intersection, wherein the U direction of all first graphic units corresponding to any intersection is a direction that starts from the intersection and extends along the curve away from the intersection. Extend a predetermined length outward from each intersection point along the curve direction away from the intersection point to determine the connection endpoint corresponding to the intersection point; Traverse all the inner broken lines formed by the two adjacent connecting endpoints of each intersection point and the intersection point, and determine the outer midpoint and outer endpoint of each inner broken line according to the preset curvature and preset width; The extension curve corresponding to the inner polygonal line is formed based on the midpoint and the endpoint of the extension. The intersection unit of the intersection point is formed based on all the inner broken lines corresponding to each intersection point and all the outer extension curves corresponding to all the inner broken lines. Each of the connecting endpoints and the line segments between all the road segment endpoints and / or the midpoints adjacent to the connecting endpoints are formed into a second graphic unit; A non-intersection unit is formed based on the second graphic unit and the preset width; Connect all adjacent intersection units and non-intersection units to form a road network model; The step of forming the intersection unit of the intersection point based on all the inner broken lines corresponding to each intersection point and all the outer extension curves corresponding to all the inner broken lines includes: The inner fold line and the corresponding outer curve are divided according to a preset subdivision, so that the inner fold line and the outer curve have the same number of subdivision points with the same number order. Connect the subdivision points of the inner broken line and the subdivision points on the outer extension curve in sequence according to the order of the subdivision points to form the intersection sub-unit; All the intersection sub-units are connected sequentially to form the intersection unit at the intersection point.
2. The generation method of claim 1, wherein, Determining the intersection points between all the curves and the road segment endpoints of all the curves includes: Iterate through all vertices of the curve and count the number of adjacent vertices, where the number of adjacent vertices is a positive integer; The vertex with a number of adjacent vertices greater than 2 is identified as the intersection point; The vertex with less than 2 adjacent vertices is determined as the endpoint of the road segment.
3. The generation method of claim 1, wherein, After determining the intersection points between all the curves and the road segment endpoints of all the curves, the method further includes: Determine the distance between any two adjacent intersection points; Merge two intersection points whose distance is less than twice the preset length.
4. The generation method of claim 1, wherein, The process of forming non-intersection units based on the second graphic unit and the preset width includes: Based on the two endpoints of the second graphic unit, extend 1 / 2 of the preset width in a direction perpendicular to the tangent direction of the second graphic unit to form four extended endpoints of the second graphic unit; Connect all the extended endpoints of the second graphic unit to form the non-intersection unit.
5. The generation method of claim 1, wherein, The preset length, preset width, preset curvature, and preset subdivision are all variable parameters.
6. The generation method of any one of claims 1 to 5, wherein, After forming the road network model, the process also includes: Set up road assets along the outer curve of each intersection unit.
7. An apparatus for generating a road network model, characterized by comprising: include: The acquisition module is used to acquire at least one curve drawn by the user, where each curve represents a road; An intersection and road segment endpoint generation module is used to determine the intersection points between all the curves and the road segment endpoints of all the curves; The first graphic unit generation module is used to determine the midpoint between adjacent intersections, and to form an independent first graphic unit for each intersection and the line segments between all the road segment endpoints and / or midpoints adjacent to the intersection. The U direction of all first graphic units corresponding to any intersection is a direction that starts from the intersection and extends along the curve away from the intersection. A connection endpoint generation module is used to extend a preset length outward from each intersection point along the curve direction in a direction away from the intersection point, so as to determine the connection endpoint corresponding to the intersection point; The traversal module is used to traverse all the inner polylines formed by the two adjacent connecting endpoints of each intersection point and the intersection point, and determine the outer midpoint and outer endpoint of each inner polyline according to the preset curvature and preset width. An extension curve generation module is used to generate an extension curve corresponding to the inner polyline based on the extension midpoint and the extension endpoint; An intersection unit generation module is used to form an intersection unit for each intersection point based on all the inner broken lines corresponding to each intersection point and all the outer extension curves corresponding to all the inner broken lines. The second graphic unit generation module is used to form an independent second graphic unit for each of the connecting endpoints and the line segments between all the road segment endpoints and / or the midpoints adjacent to the connecting endpoints; A non-intersection unit generation module is used to form a non-intersection unit based on the second graphic unit and the preset width; A road network generation module is used to connect all adjacent intersection units and non-intersection units to form a road network model; The intersection unit generation module is also used to divide the inner broken line and the corresponding outer curve of the inner broken line according to a preset subdivision, so that the inner broken line and the outer curve have the same number of subdivision points with the same number order. Connect the subdivision points of the inner broken line and the subdivision points on the outer extension curve in sequence according to the order of the subdivision points to form the intersection sub-unit; All the intersection sub-units are connected sequentially to form the intersection unit at the intersection point.
8. A storage medium storing a computer program, characterized by When the computer program is executed by a processor, it implements the steps of the method for generating the road network model according to any one of claims 1 to 6.
9. An electronic device comprising at least a memory, a processor, said memory having stored thereon a computer program, characterized in that, When the processor executes the computer program on the memory, it implements the steps of the method for generating the road network model according to any one of claims 1 to 6.