A hose state simulation method, device, electronic device and storage medium

By calculating the key point array of the Bezier curve and rendering the graphics path, the problem of sharp corners in the bend of the simulated rubber conduit is solved, and a more natural bending state simulation is achieved, which is close to the bending effect of the real rubber conduit.

CN112215937BActive Publication Date: 2024-09-24BEIJING GAOTU YUNJI EDUCATION TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202011135342.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-10-21
Publication Date
2024-09-24
Estimated Expiration
2040-10-21

AI Technical Summary

Technical Problem

When simulating the bending of rubber conduits, existing simulation methods lead to sharp corners at the bends and cannot effectively simulate the bending state of real rubber conduits, resulting in a huge difference from the real state.

Method used

By obtaining the preset point coordinates of the rigid pipe, calculate the key point array of the Bezier curve, and draw the Bezier curve and graphic path based on these key points, and render to simulate the bending state of the hose to ensure that the bend is naturally smooth. .

Benefits of technology

The natural smooth state of the bend of the simulated rubber conduit is realized, making it closer to the bending state of the real rubber conduit, and solving the problem of sharp corners at the bend in the existing method.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112215937B
    Figure CN112215937B
Patent Text Reader

Abstract

The embodiment of the present application provides a hose state simulation method, device, electronic device and storage medium, which relates to the field of simulation technology. The method includes: obtaining a key point array of a Bezier curve based on the coordinates of a first preset point of a first hard tube and a second preset point of a second hard tube; drawing a Bezier curve based on the key point array; obtaining a graphic path based on the Bezier curve, a plurality of second preset points on the first hard tube and the second hard tube; rendering the graphic path to simulate the bending state of the hose between the first hard tube and the second hard tube, simulating the natural smooth state of the rubber tube bending, and solving the problem that the sharp corners at the bending of the rubber tube simulated by the existing simulation method are very different from the bending state of the real rubber tube.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of simulation technology, and in particular to a hose state simulation method, device, electronic device and storage medium. Background Art

[0002] In the live online chemistry courses for junior and senior high schools, the main teacher needs to demonstrate to students the effects of simulating real experiments through experiments during class, and students can also do experiments online to simulate the real scenes in the laboratory.

[0003] The existing simulation of the rubber conduit between glass tubes is to draw line segments by connecting points to simulate the state of the rubber conduit. When simulating the rubber conduit in a bent state, the path drawn by the existing method has a hard turning point, resulting in sharp corners at the bending of the simulated rubber conduit, which is very different from the bending state of the real rubber conduit. Summary of the invention

[0004] The purpose of the embodiments of the present application is to provide a hose state simulation method, device, electronic device and storage medium, which simulate the natural smooth state of the bending part of the rubber tube, and solve the problem that the sharp corners at the bending part of the rubber tube simulated by the existing simulation method are very different from the actual bending state of the rubber tube.

[0005] The present application provides a hose state simulation method, the method comprising:

[0006] Acquire a key point array of the Bezier curve based on the coordinates of a first preset point of the first rigid tube and a second preset point of the second rigid tube;

[0007] Draw a Bezier curve based on the key point array;

[0008] Acquire a graphic path based on the Bezier curve, a plurality of pipeline sampling points on the first rigid tube and the second rigid tube;

[0009] The graphic path is rendered to simulate a bending state of the hose between the first rigid tube and the second rigid tube.

[0010] In the above implementation process, the Bezier curve is drawn by determining the key point array, and the graphic path is rendered to make the bend in a natural and smooth state, which is closer to the state of a real hose. This solves the problem that the sharp corners at the bends of the rubber tube simulated by the existing simulation method are very different from the bending state of the real rubber tube.

[0011] Further, the first preset point is set on the extension line of the center line of the first rigid tube, the second preset point is set on the extension line of the center line of the second rigid tube, and the key point array of the Bezier curve is obtained based on the first preset point of the first rigid tube and the second preset point of the second rigid tube, including:

[0012] Selecting a first bending starting point between the intersection of the end of the first hard tube and the extension of its center line and the first preset point;

[0013] Selecting a second bending starting point between the intersection of the end of the second hard tube and the extension line of its center line and the second preset point;

[0014] Acquire a first bending distance between the first preset point and the first bending starting point;

[0015] Acquire a second bending distance between the second preset point and the second bending starting point;

[0016] Acquire coordinates of a first bending end point and a second bending end point according to the first preset point, the first bending starting point, the first bending distance, the second preset point, the second bending starting point, and the second bending distance, wherein the first bending end point and the second bending end point are on a direction vector formed by the first preset point and the second preset point;

[0017] Determine a first key point array according to the first preset point, the first bending starting point and the first bending end point;

[0018] A second key point array is determined according to the second preset point, the second bending starting point and the second bending end point.

[0019] In the above implementation process, the first key point array is determined by determining the first preset point, the first bending starting point and the first bending end point to draw a Bezier curve according to the first key point array. Similarly, the second key point array is determined to draw another Bezier curve to simulate the bending curvature of the hose.

[0020] Further, the acquiring the coordinates of the first bending end point and the second bending end point according to the first preset point, the first bending starting point, the first bending distance, the second preset point, the second bending starting point and the second bending distance includes:

[0021] Determine a third bending distance from the first preset point to the first bending end point according to the first bending distance;

[0022] Determine a fourth bending distance from the second preset point to the second bending end point according to the second bending distance;

[0023] Based on the first preset point and the second preset point, obtain a straight-line distance between the first preset point and the second preset point;

[0024] Calculate a direction vector formed by the coordinates of the first preset point and the second preset point based on the coordinates thereof;

[0025] The coordinates of the first bending end point and the second bending end point are acquired according to the direction vector, the third bending distance, the fourth bending distance and the straight-line distance.

[0026] In the above implementation process, the first bending end point on the direction vector can be calculated based on the third bending distance from the first preset point to the first bending end point, the straight-line distance between the first preset point and the second preset point, and the direction vector. The second bending end point is obtained similarly. A Bezier curve can be drawn through the first preset point, the first bending starting point, and the first bending end point to simulate the arc curvature of the hose bending.

[0027] Further, the pipeline sampling points include at least two first sampling points and at least two second sampling points, the two first sampling points are set on the center line of the first hard pipe, and the two second sampling points are set on the center line of the second hard pipe, and the acquiring of the graphic path based on the Bezier curve, the first hard pipe and the second hard pipe includes:

[0028] A graphic path is obtained by using a graphic drawing class according to the Bezier curve, the first sampling point and the second sampling point.

[0029] In the above implementation process, the Bezier curve and the line segments formed by the first sampling points and the second sampling points are connected by using the graphic drawing class to form a graphic path.

[0030] Further, the rendering of the graphic path to simulate a bending state of the hose between the first rigid tube and the second rigid tube includes:

[0031] Acquire the coordinates of a preset number of third sampling points on the graphic path by using the path point acquisition attribute;

[0032] The hose is rendered by using the third sampling point and calling an instantiated rope drawing class to simulate the bending state of the hose.

[0033] In the above implementation process, by acquiring sampling points on the graphic path and rendering, a rendering effect is achieved in which the bends are naturally smooth and the texture extends along the direction of the graphic path, so as to simulate the real state of the hose.

[0034] The embodiment of the present application also provides a hose state simulation device, the device comprising:

[0035] A key point array acquisition module, used for acquiring a key point array of a Bezier curve from the coordinates of a first preset point of the first rigid tube and a second preset point of the second rigid tube;

[0036] A curve drawing module, used for drawing a Bezier curve based on the key point array;

[0037] A graphic path acquisition module, used for acquiring a graphic path based on the Bezier curve and a plurality of pipeline sampling points on the first rigid tube and the second rigid tube;

[0038] A rendering module is used to render the graphic path to simulate a bending state of the hose between the first rigid tube and the second rigid tube.

[0039] In the above implementation process, a graphic path is drawn by drawing a Bezier curve and the graphic path is rendered, so that the bending of the simulated hose is smooth and abrupt turning points are avoided, thereby solving the problem that the sharp corners at the bending of the rubber tube simulated by the existing simulation method are very different from the bending state of the real rubber tube.

[0040] Further, the first preset point is set on the extension line of the center line of the first hard tube, the second preset point is set on the extension line of the center line of the second hard tube, and the key point array acquisition module includes:

[0041] A first bending starting point acquisition module, used to select a first bending starting point between the intersection of the end of the first hard tube and the extension line of its center line and the first preset point;

[0042] A second bending starting point acquisition module, used to select a second bending starting point between the intersection of the end of the second hard tube and the extension line of its center line and the second preset point;

[0043] A first bending distance acquisition module, used to acquire a first bending distance between the first preset point and the first bending starting point;

[0044] A second bending distance acquisition module, used to acquire a second bending distance between the second preset point and the second bending starting point;

[0045] a bending end point acquisition module, configured to acquire coordinates of a first bending end point and a second bending end point according to the first preset point, the first bending starting point, the first bending distance, the second preset point, the second bending starting point, and the second bending distance, wherein the first bending end point and the second bending end point are on a direction vector formed by the first preset point and the second preset point;

[0046] A first key point array acquisition module, used to determine a first key point array according to the first preset point, a first bending starting point and a first bending end point;

[0047] The second key point array acquisition module is used to determine the second key point array according to the second preset point, the second bending start point and the second bending end point.

[0048] In the above implementation process, the first bending end point is obtained through the known first preset point, the first bending starting point and the direction vector, so as to obtain the first key point array required for drawing the Bezier curve. The second key point array can be obtained similarly, so as to use the obtained Bezier curve to simulate the bending curvature of the hose to avoid abrupt turning points.

[0049] Furthermore, the bending end point acquisition module includes:

[0050] A third bending distance acquisition module, used to determine a third bending distance from the first preset point to the first bending end point according to the first bending distance;

[0051] a fourth bending distance acquisition module, configured to determine a fourth bending distance from the second preset point to the second bending end point according to the second bending distance;

[0052] A straight-line distance acquisition module, used for acquiring a straight-line distance between the first preset point and the second preset point based on the first preset point and the second preset point;

[0053] A direction vector acquisition module, used for calculating the direction vector formed by the first preset point and the second preset point based on their coordinates;

[0054] The bending end point acquisition module is used to acquire the coordinates of the first bending end point and the second bending end point according to the direction vector, the third bending distance, the fourth bending distance and the straight line distance.

[0055] In the above implementation process, the first bending end point on the direction vector can be obtained by obtaining the third bending distance from the first preset point to the first bending end point, the straight-line distance between the first preset point and the second preset point, and the coordinates of the first preset point and the second preset point to calculate the direction vector they constitute, and the second bending end point can be obtained similarly.

[0056] An embodiment of the present application further provides an electronic device, the electronic device comprising a memory and a processor, the memory being used to store a computer program, and the processor running the computer program to enable the computer device to execute any one of the above-mentioned hose state simulation methods.

[0057] The embodiment of the present application further provides a readable storage medium, wherein the readable storage medium stores computer program instructions, and when the computer program instructions are read and executed by a processor, any of the above-mentioned hose state simulation methods is executed. BRIEF DESCRIPTION OF THE DRAWINGS

[0058] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments of the present application will be briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present application and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.

[0059] Figure 1 A flowchart of a hose state simulation method provided in an embodiment of the present application;

[0060] Figure 2 A schematic diagram of a first preset point and a second preset point provided in an embodiment of the present application;

[0061] Figure 3 A flowchart of obtaining a key point array provided in an embodiment of the present application;

[0062] Figure 4 A schematic diagram of the coordinates of the calculation point 4 provided in the embodiment of the present application;

[0063] Figure 5 A flowchart of rendering a rubber catheter provided by an embodiment of the present application is provided by an embodiment of the present application;

[0064] Figure 6 A schematic diagram of a rubber conduit obtained by simulation using an existing method provided in an embodiment of the present application;

[0065] Figure 7 A schematic diagram of a rubber catheter obtained by simulation using the method provided in an embodiment of the present application;

[0066] Figure 8 A structural block diagram of a hose state simulation device provided in an embodiment of the present application;

[0067] Fig. 9 This is an overall structural block diagram of the hose state simulation device provided in an embodiment of the present application.

[0068] icon:

[0069] 100-key point array acquisition module; 110-first bend starting point acquisition module; 120-second bend starting point acquisition module; 130-first bend distance acquisition module; 140-second bend distance acquisition module; 150-bend end point acquisition module; 151-third bend distance acquisition module; 152-fourth bend distance acquisition module; 153-straight line distance acquisition module; 154-direction vector acquisition module; 155-end point coordinate acquisition module; 160-first key point array acquisition module; 170-second key point array acquisition module; 200-curve drawing module; 300-graphic path acquisition module; 400-rendering module; 401-third sampling point acquisition module; 402-hose rendering module; 500-first rigid tube; 600-second rigid tube. DETAILED DESCRIPTION

[0070] The technical solutions in the embodiments of the present application will be described below in conjunction with the drawings in the embodiments of the present application.

[0071] It should be noted that similar reference numerals and letters represent similar items in the following drawings, so once an item is defined in one drawing, it does not need to be further defined and explained in subsequent drawings. At the same time, in the description of this application, the terms "first", "second", etc. are only used to distinguish the description and cannot be understood as indicating or implying relative importance.

[0072] Example 1

[0073] Please see Figure 1 , Figure 1 A flowchart of a hose state simulation method provided in an embodiment of the present application. For example, the method is used to simulate the bending state of a hose such as a rubber conduit between two sections of hard tubes such as glass tubes, such as in online simulation and simulation experiments, to achieve the effect of simulating the bending and smoothness of a real conduit. The method may specifically include the following steps:

[0074] Step S100: acquiring a key point array of a Bezier curve based on the coordinates of a first preset point of the first rigid tube 500 and a second preset point of the second rigid tube 600;

[0075] The first preset point is set on the extension line of the center line of the first hard tube 500, and the second preset point is set on the extension line of the center line of the second hard tube 600. Figure 2 , which is a schematic diagram of the first preset point and the second preset point, point c represents the first preset point, and point d represents the second preset point.

[0076] For example, Figure 3 As shown in FIG. 1 , it is a flowchart for obtaining a key point array, and this step may specifically include:

[0077] Step S110: selecting a first bending starting point between the intersection of the end of the first hard tube 500 and the extension line of its center line and a first preset point;

[0078] like Figure 2 Point 3 in FIG. 5 represents the first bending starting point, and point 3 is between point c and the edge point of the first hard tube 500 , namely point b.

[0079] Step S120: selecting a second bending starting point between the intersection of the end of the second hard tube 600 and the extension line of its center line and the second preset point;

[0080] Figure 2 Point 6 in represents the first bending starting point, and point 6 is between point d and the edge point of the first hard tube 500, namely point e.

[0081] Step S130: obtaining a first bending distance between a first preset point and a first bending starting point;

[0082] Step S140: acquiring a second bending distance between a second preset point and a starting point of the second bending;

[0083] For example, the first bending distance is the distance between point c and point 3, which is denoted as c3, and the second bending distance is the distance between point d and point 6, which is denoted as d6.

[0084] Step S150: acquiring coordinates of a first bending end point and a second bending end point according to a first preset point, a first bending starting point, a first bending distance, a second preset point, a second bending starting point, and a second bending distance, wherein the first bending end point and the second bending end point are on a direction vector formed by the first preset point and the second preset point;

[0085] The main purpose of this step is to obtain the coordinates of the first bending end point, i.e., point 4, and the second bending end point, i.e., point 5, which may specifically include:

[0086] Step S151: determining a third bending distance from a first preset point to an end point of the first bending according to the first bending distance;

[0087] Step S152: determining a fourth bending distance from the second preset point to the second bending end point according to the second bending distance;

[0088] In this embodiment, the third bending distance c4 is equal to the first bending distance c3, and the fourth bending distance d5 is equal to the second bending distance d6. The acquisition of the third bending distance c4 and the fourth bending distance d5 can also be set according to the needs of the simulated curvature. The acquisition method of the third bending distance c4 and the fourth bending distance d5 is not limited here.

[0089] Step S153: acquiring a straight-line distance between the first preset point and the second preset point based on the first preset point and the second preset point;

[0090] Step S154: calculating a direction vector formed by the first preset point and the second preset point based on their coordinates;

[0091] For example, the direction vector may be represented as a vector cd, and the straight-line distance cd may be calculated using the Pythagorean theorem or a distance calculation formula between two points.

[0092] Step S155: acquiring the coordinates of the first bending end point and the second bending end point according to the direction vector, the third bending distance, the fourth bending distance and the straight-line distance.

[0093] Since point 4 is on vector cd, the coordinates of point 4 can be calculated based on vector cd, the third bending distance c4 and the straight-line distance cd. Similarly, the coordinates of point 5 can be obtained.

[0094] For example, Figure 4 As shown in the figure, it is a schematic diagram of calculating the coordinates of point 4. The vector cd is defined as the coordinate relative to the origin. Point c(x1, y1), point d(x2, y2) and the third bending distance c4 (expressed as r) are known. The coordinates of vector addition such as c+d are defined as (x1+x2, y1+y2). The vector subtraction is similar. The vector multiplication such as multiplying by 0.5 is defined as (x1*0.5, y1*0.5). According to the coordinates of point c and point d, the line The length of segment cd is expressed as h. According to the formula (1-r) / h, the percentage of line segment d4 in line segment cd can be calculated, expressed as s. Using vector subtraction (subtracting the coordinates of point c from the coordinates of point d), the coordinates of point c1 (x1-x2, y1-y2) can be obtained. Using vector multiplication, the coordinates of 41 can be obtained ((x1-x2)*s, (y1-y2)*s). Using vector addition, c1+d can be used to calculate the coordinates of point 4.

[0095] Step S160: determining a first key point array according to the first preset point, the first bending starting point and the first bending end point;

[0096] Step S170: Determine a second key point array according to the second preset point, the second bending start point and the second bending end point.

[0097] The first key array can be represented as [3,c,4], and the second key array can be represented as [5,d,6].

[0098] Step S200: drawing a Bezier curve based on the key point array;

[0099] Step S300: acquiring a graphic path based on the Bezier curve and a plurality of pipeline sampling points on the first hard tube 500 and the second hard tube 600;

[0100] The pipeline sampling points include at least two first sampling points and at least two second sampling points, the two first sampling points are arranged on the center line of the first hard pipe 500, and the two second sampling points are arranged on the center line of the second hard pipe 600. Figure 2 Point a and point b are the first sampling points, and point e and point f are the second sampling points.

[0101] The graphics drawing class is used to obtain the graphics path according to the Bezier curve, the first sampling point and the second sampling point.

[0102] For example, the API (application programming interface) of PIXI.Graphics is used to draw Bezier curves and straight line segments to form a graphic path. Graphics is a graphics class of PIXI, which has functions such as drawing straight lines, curves and circles.

[0103] Step S400 : rendering the graphic path to simulate the bending state of the hose between the first hard tube 500 and the second hard tube 600 .

[0104] This step may specifically include the following steps:

[0105] Step S401: using the path point acquisition attribute to acquire the coordinates of a preset number of third sampling points on the graphic path;

[0106] Step S402: using the third sampling point and calling the instantiated rope drawing class to render the hose, so as to simulate the bending state of the hose.

[0107] like Figure 5 As shown in the figure, for the flowchart of rendering the rubber tube, the Graphics.quadraticCurveTo method (indicates adding a Bezier curve to the current path) is used to draw quadratic Bezier curves based on the first key array [3,c,4] and the second key array [5,d,6] respectively, and the graphic path is drawn according to the first sampling point, the second sampling point and the Bezier curve on the glass tube. Then, the third sampling point on the current path is obtained through the currentPath.points attribute, and then the SimpleRope class is instantiated and the third sampling point is used to complete the rendering of the rubber tube, so that the bend of the rubber tube has a natural and smooth effect, and can be rendered in real time as the rubber tube moves and rotates, achieving a simulated visual effect.

[0108] like Figure 6 As shown, it is a schematic diagram of a rubber tube obtained by simulation using the existing method, such as Figure 7As shown, it is a schematic diagram of the rubber conduit obtained by the simulation of the present application. The existing method has a large difference in visual state from the real rubber conduit due to the appearance of abrupt turning points. In the present application, by drawing Bezier curves and graphic paths and rendering, the bending part of the rubber conduit obtained by the simulation is in a natural and smooth state, which is closer to the state of the real rubber conduit. When the rubber conduit is simulated in the experimental class, it is closer to the real experimental state and has a better visual effect, which solves the problem that the sharp corners at the bending part of the rubber conduit simulated by the existing simulation method are very different from the bending state of the real rubber conduit.

[0109] Example 2

[0110] The present application embodiment provides a hose state simulation device, which is applied to the hose state simulation method in embodiment 1, such as Figure 8 As shown, it is a structural block diagram of a hose state simulation device, which includes:

[0111] A key point array acquisition module 100 is used to acquire a key point array of a Bezier curve based on the coordinates of a first preset point of the first rigid tube 500 and a second preset point of the second rigid tube 600;

[0112] A curve drawing module 200, used for drawing a Bezier curve based on the key point array;

[0113] A graphic path acquisition module 300, configured to acquire a graphic path based on the Bezier curve and a plurality of pipeline sampling points on the first hard pipe 500 and the second hard pipe 600;

[0114] The rendering module 400 is used to render the graphic path to simulate the bending state of the hose between the first hard tube 500 and the second hard tube 600 .

[0115] The first preset point is set on the extension line of the center line of the first hard tube 500, and the second preset point is set on the extension line of the center line of the second hard tube 600. Fig. 9 As shown, it is an overall structural block diagram of the hose state simulation device, wherein the key point array acquisition module 100 includes:

[0116] A first bending starting point obtaining module 110 is used to select a first bending starting point between the intersection of the end of the first hard tube 500 and the extension line of its center line and the first preset point;

[0117] A second bending starting point obtaining module 120, for selecting a second bending starting point between the intersection of the end of the second hard tube 600 and the extension line of its center line and the second preset point;

[0118] A first bending distance acquisition module 130, configured to acquire a first bending distance between the first preset point and the first bending starting point;

[0119] A second bending distance acquisition module 140 is used to acquire a second bending distance between the second preset point and the second bending starting point;

[0120] a bending end point acquisition module 150, configured to acquire coordinates of a first bending end point and a second bending end point according to the first preset point, the first bending starting point, the first bending distance, the second preset point, the second bending starting point, and the second bending distance, wherein the first bending end point and the second bending end point are on a direction vector formed by the first preset point and the second preset point;

[0121] A first key point array acquisition module 160, configured to determine a first key point array according to the first preset point, a first bending start point and a first bending end point;

[0122] The second key point array acquisition module 170 is used to determine a second key point array according to the second preset point, the second bending start point and the second bending end point.

[0123] The bending end point acquisition module 150 includes:

[0124] A third bending distance acquisition module 151 is used to determine a third bending distance from the first preset point to the first bending end point according to the first bending distance;

[0125] a fourth bending distance acquiring module 152, configured to determine a fourth bending distance from the second preset point to the second bending end point according to the second bending distance;

[0126] A straight-line distance acquisition module 153, configured to acquire a straight-line distance between the first preset point and the second preset point based on the first preset point and the second preset point;

[0127] A direction vector acquisition module 154, configured to calculate a direction vector formed by the first preset point and the second preset point based on their coordinates;

[0128] The end point coordinate acquisition module 155 is used to acquire the coordinates of the first bending end point and the second bending end point according to the direction vector, the third bending distance, the fourth bending distance and the straight line distance.

[0129] The rendering module 400 includes:

[0130] A third sampling point acquisition module 401, configured to acquire coordinates of a preset number of third sampling points on the graphic path by using a path point acquisition attribute;

[0131] The hose rendering module 402 is used to render the hose by using the third sampling point and calling the instantiated rope drawing class to simulate the bending state of the hose.

[0132] An embodiment of the present application further provides an electronic device, which includes a memory and a processor, wherein the memory is used to store a computer program, and the processor runs the computer program to enable the computer device to execute the hose state simulation method described in any one of Embodiment 1.

[0133] The embodiment of the present application further provides a readable storage medium, wherein the readable storage medium stores computer program instructions. When the computer program instructions are read and executed by a processor, the hose state simulation method described in any one of the embodiments 1 is executed.

[0134] In several embodiments provided in the present application, it should be understood that the disclosed devices and methods can also be implemented in other ways. The device embodiments described above are merely schematic. For example, the flowcharts and block diagrams in the accompanying drawings show the possible architecture, functions and operations of the devices, methods and computer program products according to multiple embodiments of the present application. In this regard, each box in the flowchart or block diagram can represent a module, a program segment or a part of a code, and the module, a program segment or a part of a code contains one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two consecutive boxes can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or flowchart, and the combination of boxes in the block diagram and / or flowchart can be implemented with a dedicated hardware-based system that performs a specified function or action, or can be implemented with a combination of dedicated hardware and computer instructions.

[0135] In addition, the functional modules in the various embodiments of the present application may be integrated together to form an independent part, or each module may exist separately, or two or more modules may be integrated to form an independent part.

[0136] If the functions are implemented in the form of software function modules and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application can be essentially or partly embodied in the form of a software product that contributes to the prior art. The computer software product is stored in a storage medium, including several instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods described in each embodiment of the present application. 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.

[0137] The above description is only an embodiment of the present application and is not intended to limit the scope of protection of the present application. For those skilled in the art, the present application may have various changes and variations. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present application should be included in the scope of protection of the present application. It should be noted that similar reference numerals and letters represent similar items in the following drawings, so once an item is defined in one drawing, it does not need to be further defined and explained in the subsequent drawings.

[0138] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.

[0139] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.

Claims

1. A hose state simulation method, characterized in that: The method comprises: The key point array of the Bezier curve is obtained based on the coordinates of the first preset point of the first rigid tube and the second preset point of the second rigid tube, wherein the first preset point is set on the extension line of the center line of the first rigid tube, and the second preset point is set on the extension line of the center line of the second rigid tube, specifically: Selecting a first bending starting point between the intersection of the end of the first hard tube and the extension of its center line and the first preset point; Selecting a second bending starting point between the intersection of the end of the second hard tube and the extension line of its center line and the second preset point; Acquire a first bending distance between the first preset point and the first bending starting point; Acquire a second bending distance between the second preset point and the second bending starting point; Acquire coordinates of a first bending end point and a second bending end point according to the first preset point, the first bending starting point, the first bending distance, the second preset point, the second bending starting point, and the second bending distance, wherein the first bending end point and the second bending end point are on a direction vector formed by the first preset point and the second preset point; Determine a first key point array according to the first preset point, the first bending starting point and the first bending end point; Determine a second key point array according to the second preset point, the second bending starting point and the second bending end point; Wherein, acquiring the coordinates of the first bending end point and the second bending end point according to the first preset point, the first bending starting point, the first bending distance, the second preset point, the second bending starting point and the second bending distance comprises: Determine a third bending distance from the first preset point to the first bending end point according to the first bending distance; Determine a fourth bending distance from the second preset point to the second bending end point according to the second bending distance; Based on the first preset point and the second preset point, obtain a straight-line distance between the first preset point and the second preset point; Calculating a direction vector formed by the coordinates of the first preset point and the second preset point based on the coordinates thereof; Acquire coordinates of a first bending end point and a second bending end point according to the direction vector, the third bending distance, the fourth bending distance and the straight-line distance; Draw a Bezier curve based on the key point array; Acquire a graphic path based on the Bezier curve, a plurality of pipeline sampling points on the first rigid tube and the second rigid tube; The graphic path is rendered to simulate a bending state of the hose between the first rigid tube and the second rigid tube.

2. The hose state simulation method according to claim 1, characterized in that: The pipeline sampling points include at least two first sampling points and at least two second sampling points, the two first sampling points are arranged on the center line of the first hard pipe, and the two second sampling points are arranged on the center line of the second hard pipe, and the acquiring of the graphic path based on the Bezier curve, the first hard pipe and the second hard pipe, includes: A graphic path is obtained by using a graphic drawing class according to the Bezier curve, the first sampling point and the second sampling point.

3. The hose state simulation method according to claim 2, characterized in that: The rendering of the graphic path to simulate a bending state of the hose between the first rigid tube and the second rigid tube includes: Acquire the coordinates of a preset number of third sampling points on the graphic path by using the path point acquisition attribute; The hose is rendered by using the third sampling point and calling an instantiated rope drawing class to simulate the bending state of the hose.

4. A hose state simulation device, characterized in that: The device comprises: A key point array acquisition module, used to acquire a key point array of a Bezier curve based on the coordinates of a first preset point of a first rigid tube and a second preset point of a second rigid tube, wherein the first preset point is set on an extension line of a center line of the first rigid tube, and the second preset point is set on an extension line of a center line of the second rigid tube, and the key point array acquisition module includes: A first bending starting point acquisition module, used to select a first bending starting point between the intersection of the end of the first hard tube and the extension line of its center line and the first preset point; A second bending starting point acquisition module, used to select a second bending starting point between the intersection of the end of the second hard tube and the extension line of its center line and the second preset point; A first bending distance acquisition module, used to acquire a first bending distance between the first preset point and the first bending starting point; A second bending distance acquisition module, used to acquire a second bending distance between the second preset point and the second bending starting point; a bending end point acquisition module, configured to acquire coordinates of a first bending end point and a second bending end point according to the first preset point, the first bending starting point, the first bending distance, the second preset point, the second bending starting point, and the second bending distance, wherein the first bending end point and the second bending end point are on a direction vector formed by the first preset point and the second preset point; A first key point array acquisition module, used to determine a first key point array according to the first preset point, a first bending starting point and a first bending end point; A second key point array acquisition module, used to determine a second key point array according to the second preset point, a second bending start point and a second bending end point; Wherein, the bending end point acquisition module includes: A third bending distance acquisition module, used to determine a third bending distance from the first preset point to the first bending end point according to the first bending distance; a fourth bending distance acquisition module, configured to determine a fourth bending distance from the second preset point to the second bending end point according to the second bending distance; A straight-line distance acquisition module, used for acquiring a straight-line distance between the first preset point and the second preset point based on the first preset point and the second preset point; A direction vector acquisition module, used for calculating the direction vector formed by the first preset point and the second preset point based on their coordinates; A bending end point acquisition module, used for acquiring the coordinates of the first bending end point and the second bending end point according to the direction vector, the third bending distance, the fourth bending distance and the straight line distance; A curve drawing module, used for drawing a Bezier curve based on the key point array; A graphic path acquisition module, used for acquiring a graphic path based on the Bezier curve and a plurality of pipeline sampling points on the first rigid tube and the second rigid tube; A rendering module is used to render the graphic path to simulate a bending state of the hose between the first rigid tube and the second rigid tube.

5. An electronic device, characterized in that: The electronic device comprises a memory and a processor, wherein the memory is used to store a computer program, and the processor runs the computer program to enable the computer device to execute the hose state simulation method according to any one of claims 1 to 3.

6. A readable storage medium, characterized in that: The readable storage medium stores computer program instructions, and when the computer program instructions are read and executed by a processor, the hose state simulation method according to any one of claims 1 to 3 is executed.