Drawing method and apparatus, and electronic device and storage medium

By using the design of target steering vertices and target buffer vertices in map visualization, the problem of accumulated arrow deformation at the direction corners of the road is solved, achieving a more accurate and visual drawing effect.

WO2025055583A1PCT designated stage expired Publication Date: 2025-03-20BEIJING ZHANGDIANZISHI TECH CO LTD
View PDF 6 Cites 0 Cited by

Patent Information

Application Number
PCT/CN2024/108810
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Priority Date
2023-09-13
Filing Date
2024-07-31
Publication Date
2025-03-20

AI Technical Summary

Technical Problem

In map visualization, when drawing direction arrows on roads containing corners, the arrows are prone to deformation, especially when the roads contain multiple corners, this deformation will accumulate, affecting the display effect and the direction of the arrows.

Method used

By obtaining the initial road data of the road to be drawn, the initial steering vertex and the initial buffer vertex are generated, and the target steering vertex and the target buffer vertex are obtained according to the road width, the drawing position of the target object is determined, and the target object is then drawn in the road. This method forms a buffer area at the corners, limiting the deformation of the target object only occurs at the corners, and avoiding the accumulation of deformation.

Benefits of technology

Through the design of target steering vertices and target buffer vertices, ensure that the deformation of the target object only occurs at the corners, avoid deformation accumulation, and improve drawing accuracy and visual effects of the map.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2024108810_20032025_PF_FP_ABST
    Figure CN2024108810_20032025_PF_FP_ABST
Patent Text Reader

Abstract

Provided in the present disclosure are a drawing method and apparatus, and an electronic device and a storage medium. The method comprises: acquiring initial road data of a road to be subjected to drawing, wherein the initial road data comprises at least one initial turning vertex, and the initial turning vertex represents a vertex located at a corner in said road; generating at least one initial buffer vertex on each of the two sides of the initial turning vertex, and on the basis of the road width of said road, obtaining a target turning vertex corresponding to the initial turning vertex and target buffer vertices corresponding to the initial buffer vertices; and on the basis of the target turning vertex and the target buffer vertices, determining a drawing position of a target object in said road, and on the basis of the drawing position, drawing the target object in said road.
Need to check novelty before this filing date? Find Prior Art

Description

Drawing method, device, electronic device and storage medium

[0001] This application claims priority to Chinese patent application No. 202311181537.8 filed on September 13, 2023, and the contents of the above-mentioned Chinese patent application disclosure are hereby incorporated by reference in their entirety as part of this application. Technical Field

[0002] The present disclosure relates to a drawing method, device, electronic device and storage medium. Background Art

[0003] Currently, with the continuous development of browser drawing technology, Web Graphics Library (WebGL) technology can be used to achieve map visualization. In map visualization, it may be necessary to draw roads with direction arrows, but usually roads include continuous line segments with various turns.

[0004] Summary of the Invention

[0005] The embodiments of the present disclosure at least provide a drawing method, device, electronic device, and storage medium.

[0006] The present disclosure provides a drawing method, including:

[0007] Acquire initial road data of a road to be drawn, wherein the initial road data includes at least one initial turning vertex, and the initial turning vertex represents a vertex located at a corner of the road to be drawn;

[0008] generating at least one initial buffer vertex on both sides of the initial turning vertex, and obtaining a target turning vertex corresponding to the initial turning vertex and a target buffer vertex corresponding to the initial buffer vertex according to the width of the road to be drawn;

[0009] A drawing position of a target object in the road to be drawn is determined according to the target turning vertex and the target buffer vertex, and the target object is drawn in the road to be drawn according to the drawing position.

[0010] The present disclosure also provides a drawing device, including:

[0011] an acquisition module configured to acquire initial road data of a road to be drawn, wherein the initial road data includes at least one initial turning vertex, and the initial turning vertex represents a vertex located at a corner of the road to be drawn;

[0012] A generating module configured to generate at least one initial buffer vertex on both sides of the initial turning vertex;

[0013] an expansion module configured to obtain, according to a width of the road to be drawn, a target turning vertex corresponding to the initial turning vertex and a target buffer vertex corresponding to the initial buffer vertex;

[0014] The drawing module is configured to determine a drawing position of a target object in the road to be drawn according to the target turning vertex and the target buffer vertex, and draw the target object in the road to be drawn according to the drawing position.

[0015] An optional implementation of the present disclosure further provides an electronic device, including a processor and a memory, wherein the memory stores machine-readable instructions executable by the processor, and the processor is configured to execute the machine-readable instructions stored in the memory. When the machine-readable instructions are executed by the processor, the processor executes the above-mentioned drawing method, or steps in any possible implementation of the above-mentioned drawing method.

[0016] An optional implementation of the present disclosure further provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the computer program implements the above-mentioned drawing method or the steps in any possible implementation of the above-mentioned drawing method.

[0017] It should be understood that the above general description and the following detailed description are merely exemplary and explanatory, and are not intended to limit the technical solutions of the present disclosure.

[0018] In order to make the above-mentioned objectives, features and advantages of the present disclosure more obvious and easy to understand, preferred embodiments are given below and described in detail with reference to the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS

[0019] In order to more clearly illustrate the technical solutions of the embodiments of the present disclosure, the following briefly introduces the drawings required for use in the embodiments. The drawings herein are incorporated into and constitute a part of the specification. These drawings illustrate embodiments consistent with the present disclosure and, together with the specification, are used to illustrate the technical solutions of the present disclosure. It should be understood that the following drawings only illustrate certain embodiments of the present disclosure and should not be regarded as limiting the scope. For those of ordinary skill in the art, other relevant drawings can be obtained based on these drawings without inventive effort.

[0020] FIG1 shows a flow chart of a drawing method provided by an embodiment of the present disclosure;

[0021] FIG2 shows a schematic diagram of a specific application scenario of the drawing method provided by an embodiment of the present disclosure;

[0022] FIG3 shows a schematic diagram showing the effect of a drawing method provided by an embodiment of the present disclosure;

[0023] FIG4 shows a schematic diagram of a possible drawing principle in a multi-corner scenario provided by an embodiment of the present disclosure;

[0024] FIG5 shows a schematic diagram of another possible application of the drawing principle in a multi-corner scenario provided by an embodiment of the present disclosure;

[0025] FIG6 shows a schematic diagram of a drawing device provided by an embodiment of the present disclosure;

[0026] FIG7 shows a schematic diagram of an electronic device provided by an embodiment of the present disclosure. DETAILED DESCRIPTION

[0027] It is understandable that before using the technical solutions disclosed in the various embodiments of this disclosure, the type, scope of use, usage scenarios, etc. of the personal information involved in this disclosure should be informed to the user and the user's authorization should be obtained in an appropriate manner in accordance with relevant laws and regulations.

[0028] In order to make the purpose, technical solutions and advantages of the embodiments of the present disclosure clearer, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the drawings in the embodiments of the present disclosure. Obviously, the described embodiments are only part of the embodiments of the present disclosure, rather than all of the embodiments. The components of the embodiments of the present disclosure generally described and shown here can be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of the present disclosure is not intended to limit the scope of the present disclosure for protection, but merely represents the selected embodiments of the present disclosure. Based on the embodiments of the present disclosure, all other embodiments obtained by those skilled in the art without making creative work are within the scope of protection of the present disclosure.

[0029] Research has found that in the field of map visualization, when relevant technologies draw arrows indicating direction on roads containing corners, the rendered arrows often produce large deformations. When the road contains multiple corners, this deformation will continue to accumulate, seriously affecting the display effect and weakening the role of the arrows in indicating direction.

[0030] Based on the above research, the present disclosure provides a drawing method. According to initial road data of a road to be drawn, the initial road data may include at least one initial turning vertex located at a corner of the road to be drawn, at least one initial buffer vertex is generated on each side of the initial turning vertex, and according to the road width of the road to be drawn, a target turning vertex corresponding to the initial turning vertex and a target buffer vertex corresponding to the initial buffer vertex are obtained. According to the target turning vertex and the target buffer vertex, a drawing position of a target object in the road to be drawn is determined, and according to the drawing position, the target object is drawn in the road to be drawn. In this way, according to the target turning vertex and the target buffer vertex, the drawing position of the target object in the road to be drawn is determined, the target object is drawn, and a buffer area is formed at the corner. This can ensure that the deformation of the target object only occurs at the corner, and the deformation will not accumulate, thereby ensuring the rendering effect of the target object on the straight road section and improving the drawing accuracy.

[0031] The defects in the above solutions are the results obtained by the inventors after practice and careful research. Therefore, the process of discovering the above problems and the solutions proposed by this disclosure for the above problems below should be the contributions made by the inventors to this disclosure during the disclosure process.

[0032] It should be noted that similar reference numerals and letters denote similar items in the following drawings, and therefore, once an item is defined in one drawing, it does not need to be further defined or explained in subsequent drawings.

[0033] To facilitate understanding of this embodiment, a rendering method disclosed in an embodiment of the present disclosure is first described in detail. The rendering method provided in this embodiment of the present disclosure is generally executed by an electronic device with certain computing capabilities, such as a terminal device, a server, or other processing device. The terminal device may be a user equipment (UE), a mobile device, a cellular phone, a cordless phone, a personal digital assistant (PDA), a handheld device, a computing device, an in-vehicle device, a wearable device, etc. A personal digital assistant is a handheld electronic device that has some of the functions of a computer and can be used to manage personal information, browse the Internet, send and receive emails, etc. It is generally not equipped with a keyboard and can also be called a handheld computer. In some possible implementations, the rendering method can be implemented by a processor calling computer-readable instructions stored in a memory.

[0034] The drawing method provided by the embodiment of the present disclosure is described below by taking the execution subject as a terminal device as an example.

[0035] 1 is a flowchart of a drawing method provided by an embodiment of the present disclosure, the method comprising:

[0036] S101: Acquire initial road data of a road to be drawn, wherein the initial road data includes at least one initial turning vertex, and the initial turning vertex represents a vertex located at a corner of the road to be drawn.

[0037] In the embodiments of the present disclosure, it can be applied to map navigation scenarios. For example, when a user enters a travel destination in the map software, a navigation path can be generated based on the departure place and destination, and then the road corresponding to the navigation path can be drawn. When drawing, multiple arrows indicating directions can be drawn and rendered on the road to show them to the user.

[0038] S102: Generate at least one initial buffer vertex on both sides of the initial turning vertex, and obtain a target turning vertex corresponding to the initial turning vertex and a target buffer vertex corresponding to the initial buffer vertex according to the width of the road to be drawn.

[0039] In the embodiment of the present disclosure, the road width of the road to be drawn may be a preset value, or may be determined according to the display size requirement of the final display device, etc., which is not limited in the embodiment of the present disclosure.

[0040] Regarding step S102 above, the present disclosure provides possible implementations, specifically including:

[0041] 1) Generate at least one initial buffer vertex on both sides of the initial turning vertex.

[0042] For generating at least one initial buffer vertex on each side of the initial turning vertex, the present disclosure provides a possible implementation method, including: obtaining a preset buffer distance, generating at least one initial buffer vertex on each side of the initial turning vertex, wherein the distance between the initial turning vertex and the initial buffer vertex is a positive integer multiple of the buffer distance.

[0043] The buffer distance can be set based on actual conditions and needs. Furthermore, in the disclosed embodiment, a final rendering image can be predetermined and the buffer distance can be set based on this rendering image. This is not a limitation in the disclosed embodiment, and one or more initial buffer vertices can be generated on either side of the initial turning vertex. Preferably, considering rendering time and performance issues, one possible implementation is to generate an initial buffer vertex on either side of the initial turning vertex on the road to be drawn.

[0044] In the embodiment of the present disclosure, the initial road data also includes an initial starting vertex and an initial ending vertex. For example, refer to Figure 2, which is a schematic diagram of a specific application scenario of the drawing method in the embodiment of the present disclosure. As shown in a in Figure 2, A is the initial starting vertex, B is the initial turning vertex, and C is the initial ending vertex. Then, an initial buffer vertex is generated at a position far away from the buffer on both sides of the initial turning vertex B on the road ABC to be drawn. In this way, two initial buffer vertices D and E are obtained. In this way, the road ABC to be drawn can be divided into three different sections: AD, DBE, and EC.

[0045] In this way, in the embodiment of the present disclosure, the road to be drawn can be divided into different sections to facilitate classification processing and improve flexibility.

[0046] Furthermore, in order to further improve efficiency and ensure drawing effects, the present disclosure also provides a possible implementation method, which includes, after obtaining the initial road data of the road to be drawn, and before generating at least one initial buffer vertex on each side of the initial turning vertex, determining that the corner angle at the corner corresponding to the initial turning vertex is less than a preset angle threshold.

[0047] For example, the corner angle of the corner corresponding to the first initial turning vertex is 30 degrees, the corner angle of the corner corresponding to the second initial turning vertex is 150 degrees, and the preset angle threshold is 135 degrees. Then, the corner angle of the corner corresponding to the first initial turning vertex is less than the preset angle threshold, and the corner angle of the corner corresponding to the second initial turning vertex is greater than the preset angle threshold.

[0048] This allows you to categorize corners at different angles. For example, corners less than 45 degrees are considered sharp bends, allowing you to handle them differently. For example, corners greater than 170 degrees can be ignored and treated as straight sections. By treating corners at different angles differently, you can reduce the amount of computation and increase rendering speed while ensuring quality.

[0049] In the embodiment of the present disclosure, a final rendering effect image may be predetermined, and the angle threshold may be set according to the rendering effect image.

[0050] 2) According to the width of the road to be drawn, a target turning vertex corresponding to the initial turning vertex and a target buffer vertex corresponding to the initial buffer vertex are obtained.

[0051] The present disclosure provides a possible implementation method, which obtains a target turning vertex corresponding to the initial turning vertex and a target buffer vertex corresponding to the initial buffer vertex according to the road width of the road to be drawn, including: determining a normal vector corresponding to the initial buffer vertex and an angle bisector vector corresponding to the initial turning vertex on the road to be drawn, and translating the road to be drawn to both sides to expand the road width according to the road width of the road to be drawn, the normal vector corresponding to the initial buffer vertex, and the angle bisector vector corresponding to the initial turning vertex, forming corresponding target turning vertices on both sides of the initial turning vertex after the translation, and forming corresponding target buffer vertices on both sides of the initial buffer vertex.

[0052] The road width can be set according to actual conditions and needs, and is not limited in the embodiments of the present disclosure.

[0053] In this way, the road to be drawn can be expanded into a road with a certain road width. For example, for a road with n vertices including an initial starting vertex, an initial turning vertex and an initial end vertex, after expansion, a road with a width divided into 6n-8 vertices can be obtained.

[0054] For example, as shown in c and d in Figure 2, on the road ABC to be drawn, each normal vector and angle bisector vector is determined, and then according to the road width L, normal vector and angle bisector vector of the road ABC to be drawn, the road ABC to be drawn is translated to both sides to expand the road width, and B0 and B1 corresponding to the initial turning vertex B, the target buffer vertices D0 and D1 corresponding to the initial buffer vertex D, and the target buffer vertices E0 and E1 corresponding to the initial buffer vertex E are obtained.

[0055] S103: Determine a drawing position of the target object in the road to be drawn according to the target turning vertex and the target buffer vertex, and draw the target object in the road to be drawn according to the drawing position.

[0056] In an embodiment of the present disclosure, if the road to be drawn includes an initial turning vertex, the road to be drawn can be divided into straight sections and corner sections based on this. Specifically, the road to be drawn includes straight sections and corner sections, wherein the corner section represents a section formed by the initial turning vertex and an adjacent initial buffer vertex, and the straight section represents a section that does not include the initial turning vertex. Therefore, in an embodiment of the present disclosure, different drawing processes are performed on the straight sections and the corner sections.

[0057] For example, as shown in FIG2f, each of the divided sub-segments A0-A1-D2-D3 does not include the initial turning vertex, that is, it is a single straight segment.

[0058] In this way, by classifying the road sections to be drawn into different types, different types of road sections can be processed differently, thereby improving flexibility.

[0059] Regarding step S103 above, the present disclosure provides possible implementation methods, specifically including:

[0060] 1) Determine the drawing position of the target object in the road to be drawn according to the target turning vertex and the target buffer vertex.

[0061] The target object may be an arrow indicating the direction of a road, or other road signs, which is not limited in the embodiments of the present disclosure.

[0062] A possible implementation method is that the road to be drawn includes straight sections and corner sections, wherein the corner section represents a section formed by an initial turning vertex and an adjacent initial buffer vertex, and the straight section represents a section that does not contain an initial turning vertex. The drawing position of the target object in the road to be drawn is determined based on the target turning vertex and the target buffer vertex, including: dividing the straight section according to a preset division length to obtain each sub-straight section after division, and determining the drawing position of the target object on each sub-straight section according to the coordinate position of the section area formed after the road width is expanded corresponding to each sub-straight section.

[0063] In the embodiment of the present disclosure, when determining the drawing position of the target object on each sub-straight line segment, the rectangular area in the middle of each sub-straight line segment can be selected as the drawing position of the target object, and there is no limitation on this.

[0064] Furthermore, in an embodiment of the present disclosure, when determining the drawing position of the target object, the road direction can also be combined. For example, the target object is a road arrow, and the road arrow is used to indicate the road direction of the road to be drawn. A possible implementation method is specifically provided. For example, the road direction of the road to be drawn can be determined based on the start and end positions indicated in the navigation information, and the drawing position of the target object in the road to be drawn is determined based on the road direction, the target turning vertex and the target buffer vertex, so that the road arrow faces the road direction.

[0065] For example, as shown in FIG2f, the target object is a rectangular map containing a road arrow. The rectangular map is black in the shape of the road arrow and the rest of the area is transparent. The rectangular area abcd in the middle of the sub-straight line segment A0-A1-D2-D3 can be selected as the drawing position of the target object.

[0066] In addition, when drawing, it is also necessary to align the four vertices a, b, c, and d of the rectangular area with the four vertices of the above-mentioned rectangular map containing the road arrow. When the vertices are aligned, the rectangular map can be adjusted, such as enlarging, shrinking, or stretching, and the rectangular map can be flipped in combination with the road direction so that the road arrow can face the direction of the road and be consistent with the road direction. Then, the four coordinate positions corresponding to the rectangular map in the road to be drawn can be determined, and the road arrow can be drawn in the road to be drawn based on the four coordinate positions.

[0067] In the embodiment of the present disclosure, a final rendering effect diagram may be predetermined, and the segmentation length and the drawing position of the target object on each sub-straight line segment may be determined based on the rendering effect diagram.

[0068] A possible implementation method is to determine the drawing position of a target object in a road to be drawn based on a target turning vertex and a target buffer vertex, including: for a corner section of the road to be drawn, determining a first length and a second length between a target turning vertex and a target buffer vertex located on the same side after the width of the road corresponding to the corner section is expanded, adjusting the first length and the second length so that the difference between the adjusted first length and the second length is less than a preset difference threshold, and obtaining an adjusted section area corresponding to the corner section; and determining the drawing position of the target object on the corner section based on the coordinate position of the adjusted section area corresponding to the corner section.

[0069] In the embodiment of the present disclosure, since the lengths of the outer side and the inner side of the road to be drawn after the road width is expanded are different, when passing a corner, the inner and outer sides cannot correspond when drawing the target object, resulting in an offset. Therefore, in the embodiment of the present disclosure, processing is performed on the corner section, and the distance between the target turning vertex and the target buffer vertex can form a buffer area to draw the target object, thereby avoiding the impact of the corner on the drawing of the target object on the straight section.

[0070] Preferably, considering the rendering result of the target object at the corner, a possible implementation method is to adjust the first length and the second length to a third length, wherein the third length is any value between the first length and the second length, including the first length and the second length.

[0071] For example, as shown in Figure 2(f), the preset difference threshold is 1 unit length. For the corner segment D0-B0-E0-E1-B1-D1 of the road to be drawn, the length of the line segment between D0 and B0 is obviously longer than the length of the line segment between D1 and B1. The length of the line segment between D0 and B0 can be reduced, while the length of the line segment between D1 and B1 can be increased. After adjustment, the difference between the two line segments is less than 1 unit length, and the adjusted line segment length is smaller than D0B0 and larger than D1B1.

[0072] In this way, by adjusting the first length and the second length between the target turning vertex and the target buffer vertex on the same side so that the difference between the two is less than the preset difference threshold, the deformation of the arrow at the corner can be reduced, the drawing accuracy can be improved, and the visual effect of the map can be improved.

[0073] 2) Draw the target object on the road to be drawn according to the drawing position.

[0074] Furthermore, in an embodiment of the present disclosure, a rendering triangle used to render and draw the road to be drawn can also be reconstructed based on the target turning vertex and the target buffer vertex. Specifically, a possible implementation method is provided. After obtaining the target turning vertex corresponding to the initial turning vertex and the target buffer vertex corresponding to the initial buffer vertex, it also includes: connecting every three adjacent target turning vertices and / or target buffer vertices to construct at least one rendering triangle, wherein the rendering triangle is used to draw the road to be drawn after the road width is expanded.

[0075] For example, as shown in Figure 2e, connect D0, D1, and B0, connect D1, B0, and B1, connect B0, B1, and E0, and connect B0, E0, and E1, so that 4 rendering triangles are obtained.

[0076] In this way, a rendering triangle is constructed by the target turning vertex and / or the target buffer vertex, and the road to be drawn with the road width is drawn based on the rendering triangle. When drawing the road to be drawn, the target object can be drawn synchronously based on the determined drawing position of the target object, and the deformation of the target object can be limited to the corner of the road to be drawn, thereby ensuring the rendering effect and indication function of the straight road section arrow.

[0077] Those skilled in the art will understand that in the above-mentioned method of the specific implementation method, the writing order of each step does not mean a strict execution order and does not constitute any limitation on the implementation process. The specific execution order of each step should be determined by its function and possible internal logic.

[0078] The drawing method in the embodiment of the present disclosure is described below using a specific application scenario.

[0079] For example, taking a road with a turn as an example, refer to Figure 3, which is a schematic diagram of the effect of a possible drawing method in an embodiment of the present disclosure. The embodiment of the present disclosure obtains the initial road data of the road to be drawn, generates an initial buffer vertex corresponding to the initial turning vertex in the initial road data, and expands the road to be drawn into a road with width according to the road width, thereby obtaining the target turning vertex corresponding to the initial turning vertex and the target buffer vertex corresponding to the initial buffer vertex.

[0080] Therefore, the rendering triangle is reconstructed through the target turning vertex and the target buffer vertex, and the drawing position of the target object is determined for the straight section and the corner section of the road to be drawn respectively. Based on the rendering triangle, the road to be drawn with the road width can be drawn, and the target object can be drawn on the road to be drawn. In this way, as shown in Figure 3, for the corner section, the deformation of the target object can be limited to the corner of the road to be drawn through the design of the target turning vertex and the target buffer vertex, thereby ensuring the rendering effect of the arrow of the straight section.

[0081] The drawing method in the embodiment of the present disclosure mainly generates target turning vertices and target buffer vertices at the corners of the road to be drawn, so as to reconstruct the rendering triangle and determine the drawing position of the target object on the corner road segment. However, a road to be drawn may generally include multiple corners, that is, multiple initial turning vertices. For scenarios with multiple initial turning vertices, the present disclosure also provides several possible implementation methods:

[0082] 1) Refer to Figure 4, which is a schematic diagram of the drawing principle in a possible multi-corner scenario in an embodiment of the present disclosure. As shown in Figure 4, the road to be drawn is a road from a starting point A to an end point E, which includes three initial turning vertices B, C and D. Each initial turning vertex can be processed separately, that is, at least one initial buffer vertex is generated on both sides of each initial turning vertex. After the road width is expanded, as shown in Figure 4, each initial turning vertex and the initial buffer vertices on both sides correspond to target turning vertices and target buffer vertices. For example, the initial turning vertex B corresponds to the target turning vertices B0 and B1 and the target buffer vertices F0, F1, G0 and G1, and then the rendering triangle is reconstructed, and the drawing position of the target object is determined on the corner section and the straight section for drawing.

[0083] 2) Referring to FIG. 5 , there is shown another schematic diagram of the drawing principle for a possible multi-corner scenario in an embodiment of the present disclosure. As shown in FIG. 5 , the road to be drawn is a road from a starting point A to an end point E, including three initial turning vertices B, C, and D. Since the distance deviation between the upper and lower sides of the road is also smaller when the corner angle is larger, the deviation of the drawing position of the target position is also less obvious. Therefore, in order to improve processing efficiency and reduce the amount of computation, in an embodiment of the present disclosure, only the initial turning vertices with smaller corner angles may be processed. For example, as shown in FIG. 5 , after determining that the corner angles corresponding to initial turning vertices B and D are greater than an angle threshold, and the corner angle corresponding to initial turning vertex C is less than the angle threshold, only the initial turning vertex C may be processed. That is, at least one initial buffer vertex is generated on each side of the initial turning vertex C. After expanding the road width, as shown in FIG. 5 , the initial turning vertex C and the initial buffer vertices on both sides thereof are used to obtain the target turning vertices C0 and C1 and the target buffer vertices F0, F1, G0, and G1. The rendering triangle is then reconstructed, and the drawing position of the target object is determined on the corner section and the straight section for drawing.

[0084] In this way, different processing is performed on corners in different angle ranges, which can not only reduce the amount of calculation, but also improve the rendering speed while ensuring the rendering effect.

[0085] Based on the same inventive concept, the embodiment of the present disclosure further provides a drawing device corresponding to the drawing method. Since the principle of solving the problem by the device in the embodiment of the present disclosure is similar to that of the above-mentioned drawing method in the embodiment of the present disclosure, the implementation of the device can refer to the implementation of the method, and the repeated parts will not be repeated.

[0086] 6 , which is a schematic diagram of a drawing device provided in an embodiment of the present disclosure, includes:

[0087] An acquisition module 61 is configured to acquire initial road data of a road to be drawn, wherein the initial road data includes at least one initial turning vertex, and the initial turning vertex represents a vertex located at a corner of the road to be drawn;

[0088] A generating module 62 is configured to generate at least one initial buffer vertex on both sides of the initial turning vertex;

[0089] The expansion module 63 is configured to obtain a target turning vertex corresponding to the initial turning vertex and a target buffer vertex corresponding to the initial buffer vertex according to the width of the road to be drawn;

[0090] The drawing module 64 is configured to determine a drawing position of a target object in the road to be drawn according to the target turning vertex and the target buffer vertex, and draw the target object in the road to be drawn according to the drawing position.

[0091] In an optional embodiment, the generation module 62 is further configured to, after obtaining the initial road data of the road to be drawn, and before generating at least one initial buffer vertex on each side of the initial turning vertex, perform the following steps: determine that the corner angle at the corner corresponding to the initial turning vertex is less than a preset angle threshold.

[0092] In an optional implementation, when generating at least one initial buffer vertex on each side of the initial turning vertex, the generating module 62 is configured to:

[0093] According to a preset buffer distance, at least one initial buffer vertex is generated on both sides of the initial turning vertex, wherein the distance between the initial turning vertex and the initial buffer vertex is a positive integer multiple of the buffer distance.

[0094] In an optional embodiment, when obtaining the target turning vertex corresponding to the initial turning vertex and the target buffer vertex corresponding to the initial buffer vertex according to the road width to be drawn, the expansion module 63 is configured as follows:

[0095] Determine a normal vector corresponding to the initial buffer vertex on the road to be drawn, and an angle bisector vector corresponding to the initial turning vertex;

[0096] According to the road width of the road to be drawn, the normal vector corresponding to the initial buffer vertex, and the angle bisector vector corresponding to the initial turning vertex, the road to be drawn is translated to both sides to expand the road width. After the translation, corresponding target turning vertices are formed on both sides of the initial turning vertex, and corresponding target buffer vertices are formed on both sides of the initial buffer vertex.

[0097] In an optional embodiment, the road to be drawn includes a straight segment and a corner segment, wherein the corner segment represents a segment formed by the initial turning vertex and an adjacent initial buffer vertex, and the straight segment represents a segment that does not include the initial turning vertex;

[0098] When determining the drawing position of the target object in the road to be drawn according to the target turning vertex and the target buffer vertex, the drawing module 64 is configured as follows:

[0099] Segmenting the straight road segment according to a preset segmentation length to obtain segmented sub-straight road segments;

[0100] The drawing position of the target object on each sub-straight line segment is determined according to the coordinate position of the road segment area formed after the road width is expanded corresponding to each sub-straight line segment.

[0101] In an optional embodiment, the drawing position of the target object in the road to be drawn is determined according to the target turning vertex and the target buffer vertex, and the drawing module 64 is configured to:

[0102] For the corner section of the road to be drawn, determining a first length and a second length between the target turning vertex and the target buffer vertex respectively located on the same side after the road width is expanded corresponding to the corner section;

[0103] Adjusting the first length and the second length so that a difference between the adjusted first length and the adjusted second length is less than a preset difference threshold, and obtaining an adjusted section area corresponding to the corner section;

[0104] The drawing position of the target object on the corner road segment is determined according to the coordinate position of the adjusted road segment area corresponding to the corner road segment.

[0105] In an optional implementation, after obtaining the target turning vertex corresponding to the initial turning vertex and the target buffer vertex corresponding to the initial buffer vertex, the drawing module 64 is further configured to:

[0106] Every three adjacent target turning vertices and / or target buffer vertices are connected to construct at least one rendering triangle, wherein the rendering triangle is used to draw the road to be drawn after the road width is expanded.

[0107] For descriptions of the processing flow of each module in the device and the interaction flow between each module, reference can be made to the relevant descriptions in the above method embodiment, which will not be described in detail here.

[0108] The present disclosure also provides an electronic device, as shown in FIG7 , which is a schematic diagram of the structure of the electronic device provided by the present disclosure, including:

[0109] A processor 71 and a memory 72; the memory 72 stores machine-readable instructions executable by the processor 71, and the processor 71 is configured to execute the machine-readable instructions stored in the memory 72. When the machine-readable instructions are executed by the processor 71, the processor 71 is configured to perform the following steps:

[0110] Acquire initial road data of a road to be drawn, wherein the initial road data includes at least one initial turning vertex, and the initial turning vertex represents a vertex located at a corner of the road to be drawn;

[0111] generating at least one initial buffer vertex on both sides of the initial turning vertex, and obtaining a target turning vertex corresponding to the initial turning vertex and a target buffer vertex corresponding to the initial buffer vertex according to the road width of the road to be drawn;

[0112] A drawing position of a target object in the road to be drawn is determined according to the target turning vertex and the target buffer vertex, and the target object is drawn in the road to be drawn according to the drawing position.

[0113] In an optional implementation, after obtaining the initial road data of the road to be drawn and before generating at least one initial buffer vertex on both sides of the initial turning vertex, the processor 71 is further configured to:

[0114] It is determined that the corner angle at the corner corresponding to the initial turning vertex is less than a preset angle threshold.

[0115] In an optional implementation, when generating at least one initial buffer vertex on both sides of the initial turning vertex, the processor 71 is configured to:

[0116] According to a preset buffer distance, at least one initial buffer vertex is generated on both sides of the initial turning vertex, wherein the distance between the initial turning vertex and the initial buffer vertex is a positive integer multiple of the buffer distance.

[0117] In an optional embodiment, when obtaining the target turning vertex corresponding to the initial turning vertex and the target buffer vertex corresponding to the initial buffer vertex according to the road width of the road to be drawn, the processor 71 is configured to:

[0118] Determine a normal vector corresponding to the initial buffer vertex on the road to be drawn, and an angle bisector vector corresponding to the initial turning vertex;

[0119] According to the road width of the road to be drawn, the normal vector corresponding to the initial buffer vertex, and the angle bisector vector corresponding to the initial turning vertex, the road to be drawn is translated to both sides to expand the road width. After the translation, corresponding target turning vertices are formed on both sides of the initial turning vertex, and corresponding target buffer vertices are formed on both sides of the initial buffer vertex.

[0120] In an optional embodiment, the road to be drawn includes a straight segment and a corner segment, wherein the corner segment represents a segment formed by the initial turning vertex and an adjacent initial buffer vertex, and the straight segment represents a segment that does not include the initial turning vertex;

[0121] When determining the drawing position of the target object in the road to be drawn according to the target turning vertex and the target buffer vertex, the processor 71 is configured to:

[0122] Segmenting the straight road segment according to a preset segmentation length to obtain segmented sub-straight road segments;

[0123] The drawing position of the target object on each sub-straight line segment is determined according to the coordinate position of the road segment area formed after the road width is expanded corresponding to each sub-straight line segment.

[0124] In an optional implementation, the processor 71 is configured to determine the drawing position of the target object in the road to be drawn according to the target turning vertex and the target buffer vertex:

[0125] For the corner section of the road to be drawn, determining a first length and a second length between the target turning vertex and the target buffer vertex respectively located on the same side after the road width is expanded corresponding to the corner section;

[0126] Adjusting the first length and the second length so that a difference between the adjusted first length and the adjusted second length is less than a preset difference threshold, and obtaining an adjusted section area corresponding to the corner section;

[0127] The drawing position of the target object on the corner road segment is determined according to the coordinate position of the adjusted road segment area corresponding to the corner road segment.

[0128] In an optional implementation, after obtaining the target turning vertex corresponding to the initial turning vertex and the target buffer vertex corresponding to the initial buffer vertex, the processor 71 is further configured to:

[0129] Every three adjacent target turning vertices and / or target buffer vertices are connected to construct at least one rendering triangle, wherein the rendering triangle is used to draw the road to be drawn after the road width is expanded.

[0130] The above-mentioned memory 72 includes internal memory 721 and external memory 722; the memory 721 here is also called internal memory, which is used to temporarily store the calculation data in the processor 71 and the data exchanged with the external memory 722 such as the hard disk. The processor 71 exchanges data with the external memory 722 through the internal memory 721.

[0131] The specific execution process of the above instructions can refer to the steps of the drawing method described in the embodiment of the present disclosure, and will not be repeated here.

[0132] The present disclosure also provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the computer program executes the steps of the drawing method described in the above method embodiment. The storage medium can be a volatile or non-volatile computer-readable storage medium.

[0133] The present disclosure also provides a computer program product that carries program code. The program code includes instructions that can be used to execute the steps of the drawing method described in the above method embodiment. For details, please refer to the above method embodiment and will not be repeated here.

[0134] The computer program product may be implemented in hardware, software, or a combination thereof. In one embodiment, the computer program product is implemented as a computer storage medium. In another embodiment, the computer program product is implemented as a software product, such as a software development kit (SDK).

[0135] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems and devices described above can refer to the corresponding processes in the aforementioned method embodiments, and will not be repeated here. In the several embodiments provided in the present disclosure, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. The device embodiments described above are merely schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some communication interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.

[0136] The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of these units may be selected to achieve the purpose of this embodiment according to actual needs.

[0137] In addition, each functional unit in each embodiment of the present disclosure may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.

[0138] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a non-volatile computer-readable storage medium that is executable by a processor. Based on this understanding, the technical solution of the present disclosure, or the part that contributes to the prior art, or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes several instructions for enabling an electronic device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present disclosure. The aforementioned storage medium includes various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.

[0139] Finally, it should be noted that the above-described embodiments are only specific implementation methods of the present disclosure, which are used to illustrate the technical solutions of the present disclosure, rather than to limit them. The scope of protection of the present disclosure is not limited thereto. Although the present disclosure has been described in detail with reference to the above-described embodiments, those skilled in the art should understand that any person skilled in the art can modify or easily conceive of changes to the technical solutions described in the above-described embodiments within the technical scope disclosed in the present disclosure, or replace some of the technical features therein with equivalents. Such modifications, changes, or replacements do not deviate from the spirit and scope of the technical solutions of the embodiments of the present disclosure, and should be included in the scope of protection of the present disclosure. Therefore, the scope of protection of the present disclosure shall be subject to the scope of protection of the claims.

Claims

1. A drawing method, comprising: Acquire initial road data of a road to be drawn, wherein the initial road data includes at least one initial turning vertex, and the initial turning vertex represents a vertex located at a corner of the road to be drawn; Generate at least one initial buffer vertex on both sides of the initial turning vertex, and obtain a target turning vertex corresponding to the initial turning vertex and a target buffer vertex corresponding to the initial buffer vertex according to the road width of the road to be drawn; A drawing position of a target object in the road to be drawn is determined according to the target turning vertex and the target buffer vertex, and the target object is drawn in the road to be drawn according to the drawing position.

2. The method according to claim 1, wherein: Generating at least one initial buffer vertex on both sides of the initial turning vertex comprises: According to a preset buffer distance, at least one initial buffer vertex is generated on both sides of the initial turning vertex, wherein the distance between the initial turning vertex and the initial buffer vertex is a positive integer multiple of the buffer distance.

3. The method according to claim 1, wherein: The step of obtaining the target turning vertex corresponding to the initial turning vertex and the target buffer vertex corresponding to the initial buffer vertex according to the road width of the road to be drawn includes: Determine a normal vector corresponding to the initial buffer vertex on the road to be drawn, and an angle bisector vector corresponding to the initial turning vertex; According to the road width of the road to be drawn, the normal vector corresponding to the initial buffer vertex, and the angle bisector vector corresponding to the initial turning vertex, the road to be drawn is translated to both sides to expand the road width, and after the translation, corresponding target turning vertices are formed on both sides of the initial turning vertex, and corresponding target buffer vertices are formed on both sides of the initial buffer vertex.

4. The method according to any one of claims 1 to 3, wherein: The road to be drawn includes a straight road segment and a corner road segment, wherein the corner road segment represents a road segment formed by the initial turning vertex and an adjacent initial buffer vertex, and the straight road segment represents a road segment that does not include the initial turning vertex; Then, determining the drawing position of the target object in the road to be drawn according to the target turning vertex and the target buffer vertex includes: According to a preset segmentation length, the straight line segment is segmented to obtain segmented sub-straight line segments; The drawing position of the target object on each of the sub-straight line segments is determined according to the coordinate position of the road segment area formed after the road width is expanded corresponding to each of the sub-straight line segments.

5. The method according to claim 4, wherein: The step of determining a drawing position of a target object in the road to be drawn according to the target turning vertex and the target buffer vertex includes: For the corner section of the road to be drawn, determining a first length and a second length between the target turning vertex and the target buffer vertex respectively located on the same side after the road width is expanded corresponding to the corner section; Adjusting the first length and the second length so that the difference between the adjusted first length and the adjusted second length is less than a preset difference threshold, and obtaining an adjusted section area corresponding to the corner section; The drawing position of the target object on the corner road segment is determined according to the coordinate position of the adjusted road segment area corresponding to the corner road segment.

6. The method according to claim 1, wherein: After obtaining the target turning vertex corresponding to the initial turning vertex and the target buffer vertex corresponding to the initial buffer vertex, the method further includes: Every three adjacent target turning vertices and / or target buffer vertices are connected to construct at least one rendering triangle, wherein the rendering triangle is used to draw the road to be drawn after the road width is expanded.

7. The method according to claim 1, wherein: After acquiring the initial road data of the road to be drawn and before generating at least one initial buffer vertex on both sides of the initial turning vertex, the method further includes: It is determined that the corner angle at the corner corresponding to the initial turning vertex is less than a preset angle threshold.

8. A drawing device, comprising: An acquisition module, configured to acquire initial road data of a road to be drawn, wherein the initial road data includes at least one initial turning vertex, and the initial turning vertex represents a vertex located at a corner of the road to be drawn; A generating module, configured to generate at least one initial buffer vertex on both sides of the initial turning vertex; An expansion module, configured to obtain a target turning vertex corresponding to the initial turning vertex and a target buffer vertex corresponding to the initial buffer vertex according to a road width of the road to be drawn; The drawing module is configured to determine a drawing position of a target object in the road to be drawn according to the target turning vertex and the target buffer vertex, and draw the target object in the road to be drawn according to the drawing position.

9. An electronic device, comprising: At least one processor and at least one memory, wherein the at least one memory stores machine-readable instructions executable by the at least one processor, and the at least one processor is used to execute the machine-readable instructions stored in the at least one memory, and when the machine-readable instructions are executed by the at least one processor, the at least one processor performs the steps of the method as described in any one of claims 1 to 7.

10. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.

Citation Information

Patent Citations

  • Road marking display method and device, electronic device and storage medium

    CN110069580A

  • Data processing method, terminal, server and storage medium

    CN111431953A

  • Induced steering determination method and device, electronic equipment and storage medium

    CN112697163A

  • Map road drawing method and device and related product

    CN113393580A

  • Drawing method and device, electronic equipment and storage medium

    CN117218237A