Flow path curve generation method and apparatus, terminal device, and storage medium

CN116485938BActive Publication Date: 2026-08-11NETEASE (HANGZHOU) NETWORK CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-03-07
Publication Date
2026-08-11

AI Technical Summary

Technical Problem

但是,相关技术中,需要人工参与导致模拟河流的效率低下,还浪费了人力资源

Benefits of technology

[0018]本发明的有益效果是:本发明实施例提供一种流径曲线生成方法,包括:获取基础曲线,基础曲线上包括:多个顶点;计算各顶点的位移向量的位移向量;根据各顶点的位移向量,对基础曲线上的各顶点进行位移,得到各顶点位移后的位置,根据各顶点位移后的位置,生成虚拟河流的流径曲线。根据计算得到的各顶点的位移向量,对基础曲线上进行基础曲线上的各顶点进行位移,继而基于各顶点位移后的位置,可以自动生成虚拟河流的流径曲线,该虚拟河流的流径曲线可以用于自动生成虚拟河流,无需人工参与绘制,提升了虚拟河流的生成效率,节省了人力资源,而且,根据各顶点位移后的位置生成虚拟河流的流径曲线,使得基于该流径曲线所生成的虚拟河流的形态更加接近真实河流形态,提升了虚拟河流形态的真实性。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116485938B_ABST
    Figure CN116485938B_ABST
Patent Text Reader

Abstract

This invention provides a method, apparatus, terminal device, and storage medium for generating flow path curves, relating to the field of computer technology. It includes: acquiring a base curve, which includes multiple vertices; calculating the displacement vector of each vertex; displacing each vertex on the base curve according to its displacement vector to obtain the position of each vertex after displacement; and generating a flow path curve of a virtual river based on the positions of the displaced vertices. By displacing each vertex on the base curve according to the calculated displacement vectors, and then automatically generating the flow path curve of a virtual river based on the positions of the displaced vertices, this virtual river flow path curve can be used to automatically generate virtual rivers without manual drawing, improving the efficiency of virtual river generation and saving human resources; moreover, the generated virtual river's shape is closer to that of a real river, enhancing the realism of the virtual river's shape.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of computer technology, and more specifically, to a method, apparatus, terminal device, and storage medium for generating flow path curves. Background Technology

[0002] With advancements in hardware performance and technology, achieving near-realistic rendering effects in games has become a hot research topic in the gaming industry in recent years. Realistic games, in particular, are characterized by their pursuit of recreating real-world natural landscapes in their art style, with river simulation being a crucial element.

[0003] In related technologies, river simulations are achieved through the manual involvement of artists. However, this reliance on human intervention leads to inefficiency in river simulation and wastes human resources. Summary of the Invention

[0004] The purpose of this invention is to address the shortcomings of the prior art by providing a virtual river simulation method, apparatus, processing device, and storage medium, so as to solve the aforementioned technical problems in the related art.

[0005] To achieve the above objectives, the technical solutions adopted in the embodiments of the present invention are as follows:

[0006] In a first aspect, embodiments of the present invention provide a method for generating a flow path curve, comprising:

[0007] Obtain a base curve, which includes multiple vertices;

[0008] Calculate the displacement vector of each vertex on the base curve;

[0009] Based on the displacement vector of each vertex, the vertices on the base curve are displaced to obtain the positions of each vertex after displacement;

[0010] Based on the positions of each vertex after displacement, a flow path curve of the virtual river is generated.

[0011] Secondly, embodiments of the present invention also provide a flow path curve generation device, comprising:

[0012] Obtain a base curve, which includes multiple vertices;

[0013] Calculate the displacement vector of each vertex on the base curve;

[0014] Based on the displacement vector of each vertex, the vertices on the base curve are displaced to obtain the positions of each vertex after displacement;

[0015] Based on the positions of each vertex after displacement, a flow path curve of the virtual river is generated.

[0016] Thirdly, embodiments of the present invention also provide a terminal device, including: a memory and a processor, wherein the memory stores a computer program executable by the processor, and the processor executes the computer program to implement the flow path curve generation method described in any of the first aspects above.

[0017] Fourthly, embodiments of the present invention also provide a computer-readable storage medium storing a computer program, which, when read and executed, implements the flow path curve generation method described in any of the first aspects above.

[0018] The beneficial effects of this invention are as follows: This invention provides a method for generating a flow path curve, comprising: obtaining a base curve, the base curve including multiple vertices; calculating the displacement vector of each vertex; displacing each vertex on the base curve according to the displacement vector of each vertex to obtain the position of each vertex after displacement; and generating a flow path curve of a virtual river based on the positions of each vertex after displacement. By displacing each vertex on the base curve according to the calculated displacement vector, and then automatically generating a flow path curve of a virtual river based on the positions of each vertex after displacement, this virtual river flow path curve can be used to automatically generate virtual rivers without manual drawing, improving the efficiency of virtual river generation and saving human resources. Moreover, generating the flow path curve of a virtual river based on the positions of each vertex after displacement makes the shape of the virtual river generated based on this flow path curve closer to the shape of a real river, improving the realism of the virtual river shape. Attached Figure Description

[0019] To more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings used in the embodiments will be briefly introduced below. It should be understood that the following drawings only show some embodiments of the present invention and should not be regarded as a limitation on the scope. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.

[0020] Figure 1 A schematic flowchart illustrating a flow path curve generation method provided in an embodiment of the present invention;

[0021] Figure 2 A schematic flowchart illustrating a flow path curve generation method provided in an embodiment of the present invention;

[0022] Figure 3 A flowchart illustrating a flow path curve generation method provided in an embodiment of the present invention;

[0023] Figure 4 A schematic diagram of a first vector on a basic curve provided for an embodiment of this application;

[0024] Figure 5 A schematic diagram of a second vector on a basic curve provided for an embodiment of this application;

[0025] Figure 6 A schematic diagram of the displacement vectors of each vertex provided in an embodiment of this application;

[0026] Figure 7 This is a schematic diagram of a virtual river generated in a related technology according to an embodiment of the present invention;

[0027] Figure 8 A schematic diagram of a virtual river provided for an embodiment of the present invention;

[0028] Figure 9 A flowchart illustrating a flow path curve generation method provided in an embodiment of the present invention;

[0029] Figure 10 This is a schematic diagram of an annular curve generation method provided in an embodiment of the present invention;

[0030] Figure 11 A flowchart illustrating a flow path curve generation method provided in an embodiment of the present invention;

[0031] Figure 12 A schematic diagram illustrating the generation of a virtual river according to an embodiment of the present invention;

[0032] Figure 13 A schematic diagram of a shortened annular curve provided in an embodiment of the present invention;

[0033] Figure 14 A schematic diagram of a shortened virtual circular river provided in an embodiment of the present invention;

[0034] Figure 15 This is a schematic diagram of a flow path curve generation device provided in an embodiment of the present invention;

[0035] Figure 16 This is a schematic diagram of the structure of a terminal device provided in an embodiment of the present invention. Detailed Implementation

[0036] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are some embodiments of the present invention, but not all embodiments.

[0037] Therefore, the following detailed description of the embodiments of this application provided in the accompanying drawings is not intended to limit the scope of the claimed application, but merely to illustrate selected embodiments of the application. All other embodiments obtained by those skilled in the art based on the embodiments of this application without inventive effort are within the scope of protection of this application.

[0038] In the description of this application, it should be noted that if the terms "upper", "lower", etc. appear to indicate the orientation or positional relationship based on the orientation or positional relationship shown in the accompanying drawings, or the orientation or positional relationship that the product of this application is usually placed in, it is only for the convenience of describing this application and simplifying the description, and does not indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation, and therefore should not be construed as a limitation of this application.

[0039] Furthermore, the terms "first," "second," etc., used in the specification, claims, and accompanying drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that embodiments of the invention described herein can be implemented in orders other than those illustrated or described herein. Additionally, the terms "comprising" and "having," and any variations thereof, are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.

[0040] It should be noted that, where there is no conflict, the features in the embodiments of this application can be combined with each other.

[0041] Figure 1 This is a flowchart illustrating a method for generating a flow path curve according to an embodiment of the present invention, as shown below. Figure 1 As shown, the method may include:

[0042] S101. Obtain the basic curve, which includes multiple vertices.

[0043] The system can obtain a pre-stored base curve, or it can obtain curve configuration parameters in response to an input parameter configuration operation. These curve configuration parameters are used to form the base curve. Other methods can also be used to obtain the base curve, but this application embodiment does not impose specific limitations on this.

[0044] S102. Calculate the displacement vector of each vertex on the basic curve.

[0045] In some implementations, the displacement vector of each vertex on the base curve can be calculated based on the position of each vertex on the base curve and the direction of force corresponding to the simulated river.

[0046] S103. Based on the displacement vector of each vertex, displace each vertex on the base curve to obtain the position of each vertex after displacement.

[0047] The displacement vectors corresponding to each vertex can be different. The displacement vectors corresponding to each vertex can be used to represent the distance and direction of the displacement of each vertex.

[0048] In the embodiments of this application, based on the displacement vector of each vertex, each vertex on the base curve can be displaced sequentially, or each vertex on the base curve can be displaced simultaneously, or other methods can be used to displace each vertex on the base curve. The embodiments of this application do not impose any restrictions on these methods.

[0049] S104. Generate the flow path curve of the virtual river based on the position of each vertex after displacement.

[0050] The process involves drawing the flow path curve of a virtual river sequentially based on the positions of each vertex after displacement. This flow path curve can then be used to simulate a virtual river.

[0051] Optionally, a virtual river can be simulated based on the flow path curve of the virtual river and a preset river width. For example, using the flow path curve as the central axis, multiple first target vertices can be obtained at preset distances from each vertex in the flow path curve on one side of the flow path curve. A virtual riverbank can be obtained based on these multiple first target vertices. On the other side of the flow path curve, multiple second target vertices can be obtained at preset distances from each vertex in the flow path curve. Another virtual riverbank can be obtained based on these multiple second target vertices. Twice the preset distance is the preset river width.

[0052] It should be noted that the virtual river simulated based on the flow path curve of the virtual river can be applied in animation, games, and other scenarios. This application embodiment does not impose specific limitations on this.

[0053] In summary, this invention provides a method for generating a flow path curve, comprising: acquiring a base curve, the base curve including multiple vertices; calculating the displacement vector of each vertex; displacing each vertex on the base curve according to the displacement vector of each vertex to obtain the position of each vertex after displacement; and generating a flow path curve of a virtual river based on the position of each vertex after displacement. By displacing each vertex on the base curve according to the calculated displacement vector of each vertex, and then automatically generating a flow path curve of a virtual river based on the position of each vertex after displacement, this virtual river flow path curve can be used to automatically generate virtual rivers without manual drawing, improving the generation efficiency of virtual rivers and saving human resources. Moreover, generating the flow path curve of a virtual river based on the position of each vertex after displacement makes the shape of the virtual river generated based on the flow path curve closer to the shape of a real river, improving the realism of the virtual river shape.

[0054] Optional, Figure 2 This is a flowchart illustrating a method for generating a flow path curve according to an embodiment of the present invention, as shown below. Figure 2 As shown, the process of calculating the displacement vector of each vertex on the base curve in S102 above includes:

[0055] S201. Calculate the first vector and the second vector of each vertex, where the directions of the first vector and the second vector are perpendicular to each other.

[0056] The directions of the first vector and the second vector can be used to simulate the direction of force applied to the river, that is, the directions of the first vector and the second vector can be used to characterize the direction of motion of the simulated river.

[0057] It should be noted that the first vector of each vertex can be calculated first, and then the second vector of each vertex can be calculated; or the second vector of each vertex can be calculated first, and then the first vector of each vertex can be calculated; or the first vector and the second vector can be calculated simultaneously. This application does not impose specific restrictions on this.

[0058] S202. Calculate the displacement vector of each vertex based on the first vector and the second vector.

[0059] The first vector and the second vector each have a corresponding magnitude and direction.

[0060] In some implementations, a preset calculation formula is used to calculate the displacement vector of each vertex based on the first vector and the second vector, wherein the displacement vector of each vertex is used to characterize the displacement direction and displacement distance of each vertex.

[0061] Optional, Figure 3 This is a flowchart illustrating a method for generating a flow path curve according to an embodiment of the present invention, as shown below. Figure 3As shown, the process of calculating the first and second vectors of each vertex in S201 above may include:

[0062] S301. Calculate the first vector of each vertex based on the curvature of the base curve and the first preset parameter.

[0063] The direction of the first vector can be used to characterize the direction of expansion to both sides of the riverbank.

[0064] Optionally, the first vector can be a bitangent. Figure 4 A schematic diagram of a first vector on a basic curve provided in an embodiment of this application, such as... Figure 4 As shown, each vertex on the basic curve has two tangents.

[0065] In this embodiment of the application, an initial first vector of each vertex can be calculated based on the curvature of the base curve; then, a first preset parameter is added to the value of the initial first vector of each vertex to obtain the first vector of each vertex.

[0066] S302. Calculate the second vector of each vertex based on the position information of adjacent vertices among multiple vertices.

[0067] The direction of the second vector is used to characterize the direction of the river's movement.

[0068] In some implementations, the difference in position information between adjacent vertices among multiple vertices is calculated, the difference is normalized, and then a second vector is determined based on the normalized difference and the direction of river flow.

[0069] Additionally, the second vector can be the tangent to the base curve. Figure 5 A schematic diagram of a second vector on a basic curve provided in an embodiment of this application, such as... Figure 5 As shown, each vertex on the basic curve has a tangent.

[0070] Optionally, a preset application can be used to execute processes S301 to S302, wherein different nodes are used to execute S301 and S302. Optionally, the Measure node can be used to execute process S301, and the Polyframe node can be used to execute process S302. The preset application can be Houdini (a 3D computer graphics software).

[0071] It should be noted that rivers usually originate from high-altitude mountainous areas. When they enter the plains and are about to flow into the sea, the terrain is relatively flat, and the river water has enough time and space to erode the river channel, resulting in a more pronounced meandering shape. During this process, the river flow velocity on the outer bank (the protruding side of the riverbank) is greater than that on the inner bank, causing the outer bank to protrude more due to erosion, and thus its depth is greater than that of the inner bank. The inner bank also forms shoals due to the shift of the river channel.

[0072] In this embodiment, the displacement vector of each vertex is calculated based on a first vector that represents the direction of expansion to both sides of the riverbank and a second vector that represents the direction of river flow. Subsequently, the position of each vertex is displaced based on the displacement vector of each vertex, and the resulting virtual river flow curve is closer to the real river morphology.

[0073] Optionally, the process of calculating the displacement vector of each vertex based on the first vector and the second vector in S202 above may include:

[0074] Calculate the displacement vector of each vertex based on the first vector, the second vector, the first weight corresponding to the first vector, and the second weight corresponding to the second vector.

[0075] The first weight can be greater than the second weight. This makes the meandering effect of the target curve (especially the beginning and end) more uniform. The first and second weights can be set according to actual needs, and this application embodiment does not impose specific limitations on them.

[0076] In some implementations, a preset formula can be used to calculate the displacement vector of each vertex based on the first vector, the second vector, the first weight corresponding to the first vector, and the second weight corresponding to the second vector.

[0077] Optionally, the direction of each vertex is calculated using the following formula:

[0078] direction=2×bitangent+tangent

[0079] Where bitangent is the first vector, tangent is the second vector, 2 is the first weight, and the second weight can be 1.

[0080] Figure 6 This application provides a schematic diagram of the displacement vectors of each vertex, as shown in the embodiment. Figure 6 As shown, the displacement vector of each vertex on the basic curve can represent the displacement direction and unit displacement length of each vertex.

[0081] In this embodiment of the application, the process of displacing each vertex on the base curve according to the displacement vector of each vertex in S103 above, and obtaining the position of each vertex after displacement, may include:

[0082] Based on the displacement vectors of each vertex and the preset displacement parameters, the vertices on the base curve are displaced to obtain the positions of each vertex after displacement.

[0083] In some implementations, the product of the displacement vector of each vertex and a preset displacement parameter can be calculated to displace each point on the curve and obtain the position of each vertex after displacement.

[0084] Position + = Direction × Offset

[0085] Where Position represents the position of each vertex after displacement, and Direction represents the displacement of each vertex.

[0086] The vector, where offset represents the preset displacement parameter.

[0087] Optionally, the process of generating the flow path curve of the virtual river based on the displacement position of each vertex in S104 above may include:

[0088] Calculate the position of the vertex after displacement until the number of calculations is greater than or equal to the preset number of loops, and generate the flow path curve of the virtual river.

[0089] It should be noted that the preset number of iterations can be used to adjust the simulation duration; a larger preset number of iterations results in a longer simulation time, while a smaller preset number of iterations results in a shorter simulation time. Different numbers of iterations result in different flow paths and thus different virtual river shapes, with the flow path curve being a meandering curve.

[0090] In some implementations, after a preset number of iterations, the position of the last calculated vertex displacement can be obtained. Based on the position of the last calculated vertex displacement, a flow path curve of a virtual river is generated; based on the flow path curve of this virtual river, a virtual river is generated. Specifically, based on the displacement vector of each vertex in the later calculation, each vertex on the corresponding flow path curve of the previous calculation is displaced to obtain the position of each vertex after the displacement in the later calculation.

[0091] In other implementations, after a preset number of iterations, the position of the vertex after each calculation can be obtained. Based on the position of the vertex after each calculation, the flow path curves of multiple virtual rivers are dynamically generated. Based on the flow path curves of the multiple virtual rivers, a virtual river with changing shape is dynamically generated.

[0092] Optionally, after generating the flow path curve of the virtual river based on the displacement position of each vertex in S104 above, the method further includes:

[0093] A virtual river is generated based on the flow path curve, the preset foundation width, the curvature of the flow path curve, and the preset curvature width.

[0094] In some implementations, the river width is calculated based on a preset base width, the curvature of the flow path curve, and a preset curvature width, and a virtual river is generated based on the river width and the flow path curve.

[0095] Wherein, river width = preset foundation width + curvature of flow path curve * curvature width.

[0096] Figure 7 This is a schematic diagram of a virtual river generated in a related technology according to an embodiment of the present invention. Figure 8 This is a schematic diagram of a virtual river provided as an embodiment of the present invention. Figure 7 and 8 As shown, compared to related technologies Figure 7 , Figure 8 The virtual river generated by this method has a better meandering shape and is closer to the shape of a real river.

[0097] It should be noted that the river flow velocity on the outer bank (the convex side) is greater than that on the inner bank, causing the outer bank to bulge more due to erosion and thus be deeper than the inner bank. Meanwhile, the inner bank forms shallows due to the shift in the river channel. When erosion reaches a certain point, the convex channel breaks off from the main river, forming an oxbow lake, while the main channel rejoins at the break and continues the next round of erosion.

[0098] The simulation process of the oxbow lake is explained below.

[0099] Optional, Figure 9 This is a flowchart illustrating a method for generating a flow path curve according to an embodiment of the present invention, as shown below. Figure 9 As shown, the process of generating the flow path curve of the virtual river based on the positions of each vertex after displacement in S104 above may include:

[0100] S601. Based on the positions of each vertex after displacement, determine the first and second vertices among the vertices.

[0101] Among them, the distance between the first vertex and the second vertex is less than a preset threshold, and the first vertex and the second vertex are not adjacent vertices.

[0102] In some implementations, the distance between each vertex is calculated based on the position of each vertex after displacement, and the first vertex and the second vertex among each vertex are determined based on the distance between each vertex. The distance between the first vertex and the second vertex is less than a preset threshold, and the first vertex and the second vertex are not adjacent vertices.

[0103] S602. Based on the first vertex and the second vertex, the flow path curve is divided to obtain the convex annular curve and the main channel curve.

[0104] S603. Generate a virtual river based on the circular curve and the main road curve.

[0105] In this embodiment, the first vertex and the second vertex can be merged to obtain a merge point. This merge point serves as the dividing point, segmenting the flow path curve to obtain a convex loop curve and a main channel curve. Optionally, a Fuse node can be used to merge the first vertex and the second vertex to obtain the merge point.

[0106] Figure 10 This is a schematic diagram of an annular curve generation provided in an embodiment of the present invention, such as... Figure 10 (a) in the figure represents a flow path curve. Figure 10 Divide (a) in the text, such as Figure 10 (b) in the figure represents the segmented circular curve and main road curve.

[0107] Optional, Figure 11 This is a flowchart illustrating a method for generating a flow path curve according to an embodiment of the present invention, as shown below. Figure 11 As shown, the process of generating a virtual river based on the loop curve and the main channel curve in S603 above may include:

[0108] S801. Generate a virtual circular river based on the circular curve.

[0109] S802. Generate a virtual main channel river based on the main channel curve. The virtual ring river and the virtual main channel river are not connected to each other.

[0110] Among them, the virtual circular river can be a virtual oxbow lake.

[0111] It should be noted that the process of S801 can be executed first and then the process of S802, or the process of S802 can be executed first and then the process of S801, or the processes of S802 and S801 can be executed simultaneously. This application embodiment does not impose specific restrictions on this.

[0112] Figure 12 A schematic diagram of virtual river generation provided in an embodiment of the present invention, such as... Figure 12 (a) in the text represents a virtual river, such as... Figure 12(b) in the text represents the separated ring river and main river.

[0113] Optionally, after the process in S602 above, which involves dividing the flow path curve based on the first vertex and the second vertex to obtain the convex annular curve and the main channel curve, the method may further include:

[0114] Control the first vertex to move along the circular curve towards the second vertex, and control the second vertex to move along the circular curve towards the first vertex, thus generating a dynamically shortened circular curve.

[0115] By moving the positions of the first and second vertices, the loop curve can be dynamically shortened until it disappears.

[0116] Figure 13 A schematic diagram of a shortened annular curve provided in an embodiment of the present invention, as shown below. Figure 13 As shown, compared to Figure 10 (b) in the figure represents the segmented circular curve, which shows a shortening phenomenon.

[0117] The process of generating a virtual circular river based on the circular curve in S801 above may include:

[0118] A dynamically shortened virtual circular river is generated based on the dynamically shortened circular curve.

[0119] This involves generating a dynamically shortened virtual circular river based on a dynamically shortened circular curve, until the virtual circular river disappears.

[0120] Figure 14 A schematic diagram of a shortened virtual circular river provided as an embodiment of the present invention, as shown below. Figure 14 As shown in (a) and (b) in the figure, compared to Figure 14 In (a), the virtual circular river appears to have shortened.

[0121] In summary, the embodiments of this application can model the process of the formation and disappearance of a virtual circular river, that is, realize the dynamic simulation of the formation and disappearance of an oxbow lake. This process can be realized by multiple calculations based on a preset number of cycles.

[0122] In this embodiment, a preset tool can be used to implement the flow path curve generation method provided in this embodiment. Because resampling is used in the processing, the length of the input curve has a significant impact on stability. There are two resampling modes: segmentation based on a fixed length or specifying the number of segment points. Since subsequent processing involves many calculations of specific distances, using fixed-length segmentation is more appropriate to avoid the need to manually adjust the segment length each time it is used.

[0123] Since the length of the input curve is uncertain, this variable factor needs to be eliminated. Therefore, a function is designed to control the model size based on the bounding box. Regardless of the size of the input base curve, it will be converted to a standard unit bounding box, and the scaling dimension will be calculated. After the flow path curve is generated within the standard bounding box, the flow path curve is restored to its original length based on the scaling dimension.

[0124] In this embodiment of the application, after using the meandering curve generation tool, multiple complex meandering curves can be quickly generated within one minute, thereby improving production efficiency.

[0125] It is worth noting that in this embodiment of the application, the user can use the preset configuration panel to configure the parameters of the basic curve, such as the curvature of the basic curve, the calculation method of the curvature, the calculation configuration parameters (e.g., the calculated vector with direction, without taking the absolute value, the format of the output vector), etc.

[0126] The tool also allows you to adjust the size parameters of the base curve. By adjusting the "resize scale" parameter, you can define the step size of the meandering curve. The larger the resize scale, the smaller the step size, and the more twisted the curve becomes. The smaller the resize scale, the larger the step size, and the lower the curve's meandering density.

[0127] In summary, by calculating the displacement vectors of each vertex, the vertices on the base curve are displaced. Based on these displaced positions, the flow path curve of a virtual river can be automatically generated. This flow path curve can be used to automatically generate virtual rivers without manual drawing, improving the efficiency of virtual river generation and saving manpower. Furthermore, by calculating the displacement vectors of each vertex using a first vector representing the direction of expansion to both sides of the riverbank and a second vector representing the direction of river flow, and then displacing the positions of each vertex based on these displacement vectors, the resulting virtual river flow path curve more closely resembles the morphology of a real river.

[0128] The following describes the flow path curve generation apparatus, terminal equipment, and storage medium used to execute the flow path curve generation method provided in this application. For the specific implementation process and technical effects, please refer to the relevant content of the flow path curve generation method above, which will not be repeated below.

[0129] Figure 15 This is a schematic diagram of a flow path curve generation device provided in an embodiment of the present invention, as shown below. Figure 15 As shown, the device may include:

[0130] Acquisition module 1001 is used to acquire a basic curve, wherein the basic curve includes multiple vertices;

[0131] The calculation module 1002 is used to calculate the displacement vector of each vertex on the basic curve;

[0132] The displacement module 1003 is used to displace each vertex on the base curve according to the displacement vector of each vertex, so as to obtain the position of each vertex after displacement;

[0133] The generation module 1004 is used to generate the flow path curve of the virtual river based on the position of each vertex after displacement.

[0134] Optionally, the calculation module 1002 is specifically used to calculate the first vector and the second vector of each vertex, wherein the direction of the first vector and the direction of the second vector are perpendicular to each other; and to calculate the displacement vector of each vertex based on the first vector and the second vector.

[0135] Optionally, the calculation module 1002 is specifically used to calculate the first vector of each vertex based on the curvature of the base curve and the first preset parameter, wherein the direction of the first vector is used to represent the direction of expansion to both sides of the riverbank; and to calculate the second vector of each vertex based on the position information of adjacent vertices among the plurality of vertices, wherein the direction of the second vector is used to represent the direction of river flow.

[0136] Optionally, the calculation module 1002 is specifically used to calculate the displacement vector of each vertex based on the first vector, the second vector, the first weight corresponding to the first vector, and the second weight corresponding to the second vector.

[0137] Optionally, the device further includes:

[0138] The determining module is used to determine the first vertex and the second vertex among the vertices based on the positions of the vertices after displacement, wherein the distance between the first vertex and the second vertex is less than a preset threshold, and the first vertex and the second vertex are not adjacent vertices;

[0139] The segmentation module is used to segment the flow path curve based on the first vertex and the second vertex to obtain a convex annular curve and the main channel curve;

[0140] The first generation module is used to generate a virtual river based on the circular curve and the main road curve.

[0141] Optionally, the first generation module is specifically used to generate a virtual circular river based on the circular curve; and to generate a virtual main channel river based on the main channel curve, wherein the virtual circular river and the virtual main channel river are not connected to each other.

[0142] Optionally, the device further includes:

[0143] The control module is used to control the first vertex to move along the circular curve towards the direction where the second vertex is located, and to control the second vertex to move along the circular curve towards the direction where the first vertex is located, thereby generating a dynamically shortened circular curve.

[0144] The first generation module is specifically used to generate a dynamically shortened virtual circular river based on the dynamically shortened circular curve.

[0145] Optionally, the generation module 1004 is specifically used to calculate the position of the vertex after displacement until the number of calculations is greater than or equal to the preset number of loops, thereby generating the flow path curve of the virtual river.

[0146] Optionally, the device further includes:

[0147] The second generation module is used to generate the virtual river based on the flow path curve, the preset base width, the curvature of the flow path curve, and the preset curvature width.

[0148] The above-described device is used to execute the method provided in the foregoing embodiments, and its implementation principle and technical effect are similar, so they will not be described again here.

[0149] These modules can be one or more integrated circuits configured to implement the above methods, such as one or more Application Specific Integrated Circuits (ASICs), one or more digital signal processors (DSPs), or one or more Field Programmable Gate Arrays (FPGAs). Alternatively, when a module is implemented using processing element scheduler code, the processing element can be a general-purpose processor, such as a Central Processing Unit (CPU) or other processor capable of calling program code. Furthermore, these modules can be integrated together as a system-on-a-chip (SOC).

[0150] Figure 16 This is a schematic diagram of the structure of a terminal device provided in an embodiment of the present invention, such as... Figure 16 As shown, the terminal device includes: processor 1101 and memory 1102.

[0151] The memory 1102 is used to store programs, and the processor 1101 calls the programs stored in the memory 1102 to execute the above method embodiments. The specific implementation and technical effects are similar, and will not be described in detail here.

[0152] For example, the method may include:

[0153] Obtain a base curve, which includes multiple vertices;

[0154] Calculate the displacement vector of each vertex on the base curve;

[0155] Based on the displacement vector of each vertex, the vertices on the base curve are displaced to obtain the positions of each vertex after displacement;

[0156] Based on the positions of each vertex after displacement, a flow path curve of the virtual river is generated.

[0157] Optionally, calculating the displacement vector of each vertex on the base curve includes:

[0158] Calculate the first vector and the second vector for each vertex, where the directions of the first vector and the second vector are perpendicular to each other;

[0159] Calculate the displacement vector of each vertex based on the first vector and the second vector.

[0160] Optionally, calculating the first vector and the second vector of each vertex includes:

[0161] Based on the curvature of the basic curve and the first preset parameter, the first vector of each vertex is calculated, and the direction of the first vector is used to characterize the direction of expansion to both sides of the riverbank.

[0162] Based on the position information of adjacent vertices among the plurality of vertices, a second vector is calculated for each vertex, and the direction of the second vector is used to characterize the direction of river flow.

[0163] Optionally, calculating the displacement vector of each vertex based on the first vector and the second vector includes:

[0164] The displacement vector of each vertex is calculated based on the first vector, the second vector, the first weight corresponding to the first vector, and the second weight corresponding to the second vector.

[0165] Optionally, after generating the flow path curve of the virtual river based on the positions of the displaced vertices, the method further includes:

[0166] Based on the positions of each vertex after displacement, determine the first vertex and the second vertex among the vertices, wherein the distance between the first vertex and the second vertex is less than a preset threshold, and the first vertex and the second vertex are not adjacent vertices;

[0167] Based on the first vertex and the second vertex, the flow path curve is divided to obtain a convex annular curve and the main road curve;

[0168] A virtual river is generated based on the circular curve and the main channel curve.

[0169] Optionally, generating a virtual river based on the circular curve and the main channel curve includes:

[0170] A virtual circular river is generated based on the circular curve;

[0171] A virtual main channel river is generated based on the main channel curve, and the virtual circular river and the virtual main channel river are not connected to each other.

[0172] Optionally, after dividing the flow path curve according to the first vertex and the second vertex to obtain the convex annular curve and the main channel curve, the method further includes:

[0173] Control the first vertex to move along the circular curve towards the direction of the second vertex, and control the second vertex to move along the circular curve towards the direction of the first vertex, thereby generating a dynamically shortened circular curve;

[0174] The step of generating a virtual circular river based on the circular curve includes:

[0175] A dynamically shortened virtual ring river is generated based on the dynamically shortened ring curve.

[0176] Optionally, generating the flow path curve of the virtual river based on the displacement positions of each vertex includes:

[0177] The position of the vertex after displacement is calculated until the number of calculations is greater than or equal to the preset number of iterations, and the flow path curve of the virtual river is generated.

[0178] Optionally, after generating the flow path curve of the virtual river based on the displacement positions of each vertex, the method further includes:

[0179] The virtual river is generated based on the flow path curve, the preset base width, the curvature of the flow path curve, and the preset curvature width.

[0180] In summary, based on the calculated displacement vectors of each vertex, the vertices on the base curve are displaced. Then, based on the positions of each vertex after displacement, the flow path curve of the virtual river can be automatically generated. This flow path curve of the virtual river can be used to automatically generate virtual rivers without manual drawing, thus improving the generation efficiency of virtual rivers and saving human resources.

[0181] Optionally, the present invention also provides a program product, such as a computer-readable storage medium, including a program that, when executed by a processor, is used to perform the above-described method embodiments.

[0182] For example, the method may include:

[0183] Obtain a base curve, which includes multiple vertices;

[0184] Calculate the displacement vector of each vertex on the base curve;

[0185] Based on the displacement vector of each vertex, the vertices on the base curve are displaced to obtain the positions of each vertex after displacement;

[0186] Based on the positions of each vertex after displacement, a flow path curve of the virtual river is generated.

[0187] Optionally, calculating the displacement vector of each vertex on the base curve includes:

[0188] Calculate the first vector and the second vector for each vertex, where the directions of the first vector and the second vector are perpendicular to each other;

[0189] Calculate the displacement vector of each vertex based on the first vector and the second vector.

[0190] Optionally, calculating the first vector and the second vector of each vertex includes:

[0191] Based on the curvature of the basic curve and the first preset parameter, the first vector of each vertex is calculated, and the direction of the first vector is used to characterize the direction of expansion to both sides of the riverbank.

[0192] Based on the position information of adjacent vertices among the plurality of vertices, a second vector is calculated for each vertex, and the direction of the second vector is used to characterize the direction of river flow.

[0193] Optionally, calculating the displacement vector of each vertex based on the first vector and the second vector includes:

[0194] The displacement vector of each vertex is calculated based on the first vector, the second vector, the first weight corresponding to the first vector, and the second weight corresponding to the second vector.

[0195] Optionally, after generating the flow path curve of the virtual river based on the positions of the displaced vertices, the method further includes:

[0196] Based on the positions of each vertex after displacement, determine the first vertex and the second vertex among the vertices, wherein the distance between the first vertex and the second vertex is less than a preset threshold, and the first vertex and the second vertex are not adjacent vertices;

[0197] Based on the first vertex and the second vertex, the flow path curve is divided to obtain a convex annular curve and the main road curve;

[0198] A virtual river is generated based on the circular curve and the main channel curve.

[0199] Optionally, generating a virtual river based on the circular curve and the main channel curve includes:

[0200] A virtual circular river is generated based on the circular curve;

[0201] A virtual main channel river is generated based on the main channel curve, and the virtual circular river and the virtual main channel river are not connected to each other.

[0202] Optionally, after dividing the flow path curve according to the first vertex and the second vertex to obtain the convex annular curve and the main channel curve, the method further includes:

[0203] Control the first vertex to move along the circular curve towards the direction of the second vertex, and control the second vertex to move along the circular curve towards the direction of the first vertex, thereby generating a dynamically shortened circular curve;

[0204] The step of generating a virtual circular river based on the circular curve includes:

[0205] A dynamically shortened virtual ring river is generated based on the dynamically shortened ring curve.

[0206] Optionally, generating the flow path curve of the virtual river based on the displacement positions of each vertex includes:

[0207] The position of the vertex after displacement is calculated until the number of calculations is greater than or equal to the preset number of iterations, and the flow path curve of the virtual river is generated.

[0208] Optionally, after generating the flow path curve of the virtual river based on the displacement positions of each vertex, the method further includes:

[0209] The virtual river is generated based on the flow path curve, the preset base width, the curvature of the flow path curve, and the preset curvature width.

[0210] In summary, based on the calculated displacement vectors of each vertex, the vertices on the base curve are displaced. Then, based on the positions of each vertex after displacement, the flow path curve of the virtual river can be automatically generated. This flow path curve of the virtual river can be used to automatically generate virtual rivers without manual drawing, thus improving the generation efficiency of virtual rivers and saving human resources.

[0211] In the several embodiments provided by this invention, it should be understood that the disclosed apparatus and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between apparatuses or units may be electrical, mechanical, or other forms.

[0212] The units described as separate components may or may not be physically separate. 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 the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0213] Furthermore, the functional units in the various embodiments of the present invention can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or in the form of hardware plus software functional units.

[0214] The integrated units implemented as software functional units described above can be stored in a computer-readable storage medium. These software functional units, stored in a storage medium, include several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) or processor to execute some steps of the methods described in the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0215] The above are merely preferred embodiments of the present invention and are not intended to limit the present invention. Various modifications and variations can be made to the present invention by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.

Claims

1. A flowpath curve generation method characterized by, include: Obtain a base curve, which includes multiple vertices; Calculate the displacement vector of each vertex on the base curve; Based on the displacement vector of each vertex, the vertices on the base curve are displaced to obtain the positions of each vertex after displacement; Based on the positions of each vertex after displacement, a virtual river flow path curve is generated; After generating the flow path curve of the virtual river based on the positions of the displaced vertices, the method further includes: Based on the positions of each vertex after displacement, determine the first vertex and the second vertex among the vertices, wherein the distance between the first vertex and the second vertex is less than a preset threshold, and the first vertex and the second vertex are not adjacent vertices; Based on the first vertex and the second vertex, the flow path curve is divided to obtain a convex loop curve and a main road curve; A virtual river is generated based on the circular curve and the main channel curve.

2. The method of claim 1, wherein, The calculation of the displacement vector of each vertex on the base curve includes: Calculate the first vector and the second vector for each vertex, where the directions of the first vector and the second vector are perpendicular to each other; Calculate the displacement vector of each vertex based on the first vector and the second vector.

3. The method of claim 2, wherein, The calculation of the first vector and the second vector of each vertex includes: Based on the curvature of the basic curve and the first preset parameter, the first vector of each vertex is calculated, and the direction of the first vector is used to characterize the direction of expansion to both sides of the riverbank. Based on the position information of adjacent vertices among the plurality of vertices, a second vector is calculated for each vertex, and the direction of the second vector is used to characterize the direction of river flow.

4. The method of claim 2, wherein, The step of calculating the displacement vector of each vertex based on the first vector and the second vector includes: The displacement vector of each vertex is calculated based on the first vector, the second vector, the first weight corresponding to the first vector, and the second weight corresponding to the second vector.

5. The method of claim 1, wherein, The step of generating a virtual river based on the circular curve and the main channel curve includes: A virtual circular river is generated based on the circular curve; A virtual main channel river is generated based on the main channel curve, and the virtual circular river and the virtual main channel river are not connected to each other.

6. The method of claim 5, wherein, After dividing the flow path curve according to the first vertex and the second vertex to obtain the convex annular curve and the main channel curve, the method further includes: Control the first vertex to move along the circular curve towards the direction of the second vertex, and control the second vertex to move along the circular curve towards the direction of the first vertex, thereby generating a dynamically shortened circular curve; The step of generating a virtual circular river based on the circular curve includes: A dynamically shortened virtual ring river is generated based on the dynamically shortened ring curve.

7. The method of claim 1, wherein, The step of generating the flow path curve of the virtual river based on the displacement positions of each vertex includes: The position of the vertex after displacement is calculated until the number of calculations is greater than or equal to the preset number of iterations, and the flow path curve of the virtual river is generated.

8. The method according to claim 1, characterized in that, After generating the flow path curve of the virtual river based on the displacement positions of each vertex, the method further includes: The virtual river is generated based on the flow path curve, the preset base width, the curvature of the flow path curve, and the preset curvature width.

9. A flow path curve generation device, characterized in that, include: The acquisition module is used to acquire a basic curve, which includes multiple vertices; The calculation module is used to calculate the displacement vector of each vertex on the basic curve; The displacement module is used to displace each vertex on the base curve according to the displacement vector of each vertex, so as to obtain the position of each vertex after displacement; The generation module is used to generate the flow path curve of the virtual river based on the positions of the vertices after displacement; The device further includes: The determining module is used to determine the first vertex and the second vertex among the vertices based on the positions of the vertices after displacement, wherein the distance between the first vertex and the second vertex is less than a preset threshold, and the first vertex and the second vertex are not adjacent vertices; The segmentation module is used to segment the flow path curve based on the first vertex and the second vertex to obtain a convex annular curve and a main channel curve. The first generation module is used to generate a virtual river based on the circular curve and the main road curve.

10. A terminal device, characterized in that, include: A memory and a processor, wherein the memory stores a computer program executable by the processor, and the processor executes the computer program to implement the flow path curve generation method according to any one of claims 1-8.

11. A computer-readable storage medium, characterized in that, The storage medium stores a computer program, which, when read and executed, implements the flow path curve generation method according to any one of claims 1-8.

Citation Information

Patent Citations

  • Method and system for simulating river

    CN101051390A

  • Three-dimensional virtual model rendering method, device and electronic equipment

    CN113450441A