[go: up one dir, main page]
More Web Proxy on the site http://driver.im/

CN112215937B - Hose state simulation method and device, electronic equipment and storage medium - Google Patents

Hose state simulation method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN112215937B
CN112215937B CN202011135342.6A CN202011135342A CN112215937B CN 112215937 B CN112215937 B CN 112215937B CN 202011135342 A CN202011135342 A CN 202011135342A CN 112215937 B CN112215937 B CN 112215937B
Authority
CN
China
Prior art keywords
point
bending
preset
distance
preset point
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202011135342.6A
Other languages
Chinese (zh)
Other versions
CN112215937A (en
Inventor
张雪
雷志兴
程钧沅
熊抗天
林一凡
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Gaotu Yunji Education Technology Co Ltd
Original Assignee
Beijing Gaotu Yunji Education Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Gaotu Yunji Education Technology Co Ltd filed Critical Beijing Gaotu Yunji Education Technology Co Ltd
Priority to CN202011135342.6A priority Critical patent/CN112215937B/en
Publication of CN112215937A publication Critical patent/CN112215937A/en
Application granted granted Critical
Publication of CN112215937B publication Critical patent/CN112215937B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T15/003D [Three Dimensional] image rendering
    • G06T15/10Geometric effects
    • G06T15/20Perspective computation
    • G06T15/205Image-based rendering
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F30/00Computer-aided design [CAD]
    • G06F30/20Design optimisation, verification or simulation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T11/002D [Two Dimensional] image generation
    • G06T11/20Drawing from basic elements, e.g. lines or circles
    • G06T11/203Drawing of straight lines or curves
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T15/003D [Three Dimensional] image rendering
    • G06T15/005General purpose rendering architectures
    • GPHYSICS
    • G09EDUCATION; CRYPTOGRAPHY; DISPLAY; ADVERTISING; SEALS
    • G09BEDUCATIONAL OR DEMONSTRATION APPLIANCES; APPLIANCES FOR TEACHING, OR COMMUNICATING WITH, THE BLIND, DEAF OR MUTE; MODELS; PLANETARIA; GLOBES; MAPS; DIAGRAMS
    • G09B5/00Electrically-operated educational appliances
    • G09B5/08Electrically-operated educational appliances providing for individual presentation of information to a plurality of student stations

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Graphics (AREA)
  • Geometry (AREA)
  • Evolutionary Computation (AREA)
  • General Engineering & Computer Science (AREA)
  • Business, Economics & Management (AREA)
  • Educational Administration (AREA)
  • Educational Technology (AREA)
  • Computer Hardware Design (AREA)
  • Computing Systems (AREA)
  • Image Generation (AREA)
  • Processing Or Creating Images (AREA)

Abstract

The embodiment of the application provides a hose state simulation method, a hose state simulation device, electronic equipment and a storage medium, and relates to the technical field of simulation. The method comprises the following steps: acquiring a key point array of the Bezier curve based on coordinates of a first preset point of the first hard tube and a second preset point of the second hard tube; drawing a Bezier curve based on the key point array; acquiring a graph path based on the Bezier curve, a plurality of second preset points on the first hard tube and the second hard tube; rendering the graph path to simulate the bending state of the hose between the first hard pipe and the second hard pipe, simulating the natural smooth state of the bending part of the rubber pipe, and solving the problems that the bending part of the rubber pipe simulated by the existing simulation method has sharp corners and the bending state of the real rubber pipe has huge difference.

Description

Hose state simulation method and device, electronic equipment and storage medium
Technical Field
The present application relates to the field of analog simulation technologies, and in particular, to a hose state simulation method, apparatus, electronic device, and storage medium.
Background
In the online live course of the junior high school chemistry, a teacher needs to demonstrate the effect of simulating a real experiment for students in the course of the junior high school chemistry, and the students can also do the experiment online to simulate the real scene of a laboratory.
The simulation of the rubber conduit between the existing glass tubes is to draw line segments through connection points so as to simulate the state of the rubber conduit, when the rubber conduit in a bending state is simulated, a hard inflection point appears on a path drawn by the existing method, so that sharp corners appear at the bending position of the simulated rubber conduit and the bending state of the real rubber conduit is greatly different.
Disclosure of Invention
The embodiment of the application aims to provide a hose state simulation method, a hose state simulation device, electronic equipment and a storage medium, which simulate the natural smooth state of the bending part of a rubber catheter and solve the problems that the bending part of the rubber catheter simulated by the traditional simulation method has sharp corners and the actual bending state of the rubber catheter has huge difference.
The embodiment of the application provides a hose state simulation method, which comprises the following steps:
Acquiring a key point array of the Bezier curve based on the first preset point of the first hard tube and the second preset point coordinate of the second hard tube;
drawing a Bezier curve based on the key point array;
Acquiring a graph path based on the Bezier curve, a plurality of pipeline sampling points on the first hard pipe and the second hard pipe;
The graphics path is rendered to simulate a bending state of a hose between the first rigid tube and the second rigid tube.
In the implementation process, the Bezier curve is drawn by determining the key point groups, and the graph path is rendered, so that the bent position is in a natural smooth state and is closer to the state of a real hose, and the problems that sharp corners appear at the bent position of the rubber catheter simulated by the existing simulation method and the bending state of the real rubber catheter is huge in difference are solved.
Further, the first preset point is set on an extension line of the center line of the first hard tube, the second preset point is set on an extension line of the center line of the second hard tube, and the obtaining the key point array of the Bezier curve based on the first preset point of the first hard tube and the second preset point of the second hard tube includes:
selecting a first bending starting point between an intersection point of the end part of the first rigid pipe and an extension line of the central line of the first rigid pipe and the first preset point;
selecting a second bending starting point between an intersection point of the end part of the second rigid pipe and an extension line of the central line of the second rigid pipe and the second preset point;
acquiring a first bending distance between the first preset point and the first bending starting point;
acquiring a second bending distance between the second preset point and the second bending starting point;
acquiring 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 positioned on a direction vector formed by the first preset point and the second preset point;
determining a first key point array according to the first preset point, the first bending starting point and the first bending end point;
and determining a second key point array according to the second preset point, the second bending starting point and the second bending ending point.
In the implementation process, a first preset point, a first bending starting point and a first bending end point are determined to determine a first key point array, so that a section of Bezier curve is drawn according to the first key point array, and similarly, a second key point array is determined to draw another section of Bezier curve, so that the bending radian of the hose is simulated.
Further, the obtaining coordinates of the first bending end point and the second bending end point according to the first preset point, the first bending start point, the first bending distance, the second preset point, the second bending start point and the second bending distance includes:
Determining a third bending distance from the first preset point to the first bending end point according to the first bending distance;
determining a fourth bending distance from the second preset point to the second bending end point according to the second bending distance;
acquiring a linear distance between a first preset point and a second preset point based on the first preset point and the second preset point;
Calculating a direction vector formed by the first preset point and the second preset point based on the coordinates of the first preset point and the second preset point;
and acquiring 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.
In the implementation process, according to the third bending distance from the first preset point to the first bending end point, the linear distance between the first preset point and the second preset point and the direction vector, the first bending end point on the direction vector can be calculated, the second bending end point is obtained in the same way, and the Bezier curve can be drawn through the first preset point, the first bending starting point and the first bending end point so as to simulate the arc radian of the bending of the hose.
Further, the pipeline sampling point includes at least two first sampling points and at least two second sampling points, two the first sampling points are set on the central line of the first hard pipe, two the second sampling points are set on the central line of the second hard pipe, the graph path is obtained based on the Bezier curve, the first hard pipe and a plurality of second preset points on the second hard pipe, and the method comprises the following steps:
and drawing a class by using the graph and acquiring a graph path according to the Bezier curve, the first sampling point and the second sampling point.
In the implementation process, the Bezier curve and line segments formed by the first sampling points and the second sampling points are connected by using a graph drawing class to form a graph path.
Further, the rendering the graphics path to simulate a bending state of a hose between the first hard tube and the second hard tube includes:
acquiring coordinates of a preset number of third sampling points on the graph path by utilizing a path point acquisition attribute;
and rendering the hose by utilizing the third sampling point and calling an instantiation drawing rope so as to simulate the bending state of the hose.
In the implementation process, the sampling points on the graph path are acquired and rendered, so that the curved part is naturally smooth, and the texture extends along the direction of the graph path to simulate the real state of the hose.
The embodiment of the application also provides a hose state simulation device, which comprises:
the key point array acquisition module is used for acquiring a key point array of the Bezier curve by using first preset point coordinates of the first hard tube and second preset point coordinates of the second hard tube;
The curve drawing module is used for drawing a Bezier curve based on the key point array;
The graph path acquisition module is used for acquiring a graph path based on the Bezier curve and a plurality of pipeline sampling points on the first hard pipe and the second hard pipe;
And the rendering module is used for rendering the graph path so as to simulate the bending state of the hose between the first hard pipe and the second hard pipe.
In the implementation process, the figure path is drawn by drawing the Bezier curve and is rendered, so that the bending position of the hose obtained by simulation is smooth, a hard inflection point is avoided, and the problems that the bending position of the rubber catheter simulated by the existing simulation method has sharp corners and the bending state of the real rubber catheter is huge in difference are solved.
Further, the first preset point is set on an extension line of the center line of the first hard tube, the second preset point is set on an extension line of the center line of the second hard tube, and the key point group acquisition module includes:
the first bending starting point acquisition module is used for selecting a first bending starting point between the intersection point of the end part of the first rigid pipe and the extension line of the central line of the first rigid pipe and the first preset point;
The second bending starting point acquisition module is used for selecting a second bending starting point between the intersection point of the end part of the second rigid pipe and the extension line of the central line of the second rigid pipe and the second preset point;
The first bending distance acquisition module is used for acquiring a first bending distance from the first preset point to the first bending starting point;
A second bending distance obtaining module, configured to obtain a second bending distance between the second preset point and the second bending start point;
the bending end point acquisition module is used for acquiring 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 positioned on a direction vector formed by the first preset point and the second preset point;
The first key point array acquisition module is used for determining a first key point array according to the first preset point, the first bending starting point and the first bending end point;
and the second key point array acquisition module is used for determining a second key point array according to the second preset point, the second bending starting point and the second bending end point.
In the implementation process, the first bending end point is obtained through the known first preset point, the first bending start point and the direction vector, so that a first key point array required for drawing the Bezier curve is obtained, and a second key point array is obtained in the same way, and therefore the obtained Bezier curve is utilized to simulate the bending radian of the hose, and the occurrence of a hard inflection point is avoided.
Further, the bending end point acquisition module includes:
A third bending distance obtaining module, configured 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 obtaining 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;
the linear distance acquisition module is used for acquiring the linear distance between the first preset point and the second preset point based on the first preset point and the second preset point;
The direction vector acquisition module is used for calculating a direction vector formed by the first preset point and the second preset point based on the coordinates of the first preset point and the second preset point;
And the bending end point acquisition module is used for acquiring 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 linear distance.
In the 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 linear distance between the first preset point and the second preset point and the coordinates of the first preset point and the second preset point, and the second bending end point can be obtained in the same way.
The embodiment of the application also provides electronic equipment, which comprises a memory and a processor, wherein the memory is used for storing a computer program, and the processor runs the computer program to enable the computer equipment to execute the hose state simulation method.
The embodiment of the application also provides a readable storage medium, wherein the readable storage medium stores computer program instructions, and when the computer program instructions are read and run by a processor, the hose state simulation method of any one of the above is executed.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings that are needed in the embodiments of the present application will be briefly described below, it should be understood that the following drawings only illustrate some embodiments of the present application and should not be considered as limiting the scope, and other related drawings can be obtained according to these drawings without inventive effort for a person skilled in the art.
FIG. 1 is a flow chart of a hose state simulation method provided by an embodiment of the application;
FIG. 2 is a schematic diagram of a first preset point and a second preset point according to an embodiment of the present application;
FIG. 3 is a flowchart of acquiring a key point array according to an embodiment of the present application;
FIG. 4 is a schematic diagram of coordinates of a calculation point 4 according to an embodiment of the present application;
FIG. 5 is a flow chart of a rendering rubber catheter provided by an embodiment of the present application;
FIG. 6 is a schematic diagram of a rubber catheter obtained by performing simulation by using the conventional method according to an embodiment of the present application;
FIG. 7 is a schematic diagram of a rubber catheter obtained by simulation using the method according to an embodiment of the present application;
FIG. 8 is a block diagram of a hose state simulation device according to an embodiment of the present application;
fig. 9 is a block diagram of the overall structure of a hose state simulation device according to an embodiment of the present application.
Icon:
100-a key point group acquisition module; 110-a first bend start acquisition module; 120-a second bend start acquisition module; 130-a first bending distance acquisition module; 140-a second bending distance acquisition module; 150-a bending end point acquisition module; 151-a third bending distance acquisition module; 152-a fourth bending distance acquisition module; 153-a straight line distance acquisition module; 154-a direction vector acquisition module; 155-an end point coordinate acquisition module; 160-a first key point array acquisition module; 170-a second key point array acquisition module; 200-a curve drawing module; 300-a graph path acquisition module; 400-a rendering module; 401-a third sampling point acquisition module; 402-a hose rendering module; 500-a first rigid tube; 600-second rigid tube.
Detailed Description
The technical solutions in the embodiments of the present application will be described below with reference to the accompanying drawings in the embodiments of the present application.
It should be noted that: like reference numerals and letters denote like items in the following figures, and thus once an item is defined in one figure, no further definition or explanation thereof is necessary in the following figures. Meanwhile, in the description of the present application, the terms "first", "second", and the like are used only to distinguish the description, and are not to be construed as indicating or implying relative importance.
Example 1
Referring to fig. 1, fig. 1 is a flowchart of a hose state simulation method according to an embodiment of the present application. For example, the method is used for simulating the bending state of a hose such as a rubber catheter between two hard tubes such as glass tubes, and the effect of simulating the bending and smoothing of a real catheter can be realized in online simulation and emulation experiments. The method specifically comprises the following steps:
step S100: acquiring a key point array of the Bezier curve based on the first preset point of the first hard tube 500 and the second preset point coordinates of the second hard tube 600;
wherein, the first preset point is disposed on the extension line of the center line of the first rigid pipe 500, the second preset point is disposed on the extension line of the center line of the second rigid pipe 600, as shown in fig. 2, which is a schematic diagram of the first preset point and the second preset point, the point c represents the first preset point, and the point d represents the second preset point.
For example, as shown in fig. 3, to obtain a flowchart of the key point array, the steps may specifically include:
step S110: selecting a first bending starting point between an intersection point of the end part of the first rigid pipe 500 and an extension line of the central line of the first rigid pipe and a first preset point;
point 3 as in fig. 2 represents the first bending start point, point 3 being between point c and the edge point of the first rigid tube 500, point b.
Step S120: selecting a second bending starting point between an intersection point of the end of the second rigid tube 600 and an extension line of the center line thereof and a second preset point;
Point 6 in fig. 2 represents the first bending start point, point 6 being between point d and the edge point of the first rigid tube 500, point e.
Step S130: acquiring a first bending distance from a first preset point to a first bending starting point;
step S140: acquiring a second bending distance from a second preset point to the second bending starting point;
Illustratively, the first curved distance is the distance between point c and point 3, denoted as c3, and the second curved distance is the distance between point d and point 6, denoted as d6.
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 positioned on a direction vector formed by the first preset point and the second preset point;
The main purpose of this step is to obtain the coordinates of a first bending end point, point 4, and a second bending end point, point 5, which may specifically comprise:
Step S151: determining a third bending distance from a first preset point to the first bending end point according to the first bending distance;
step S152: determining a fourth bending distance from the second preset point to the second bending end point according to the second bending distance;
In the present embodiment, the third bending distance c4 is equal to the first bending distance c3, the fourth bending distance d5 is equal to the second bending distance d6, and the third bending distance c4 and the fourth bending distance d5 may be obtained according to the need of the simulated bending, and the manner of obtaining the third bending distance c4 and the fourth bending distance d5 is not limited herein.
Step S153: acquiring a linear distance between a first preset point and a second preset point based on the first preset point and the second preset point;
Step S154: calculating a direction vector formed by the first preset point and the second preset point based on the coordinates of the first preset point and the second preset point;
For example, the direction vector may be expressed as a vector cd, and the calculation of the straight line distance cd may be calculated using the pythagorean theorem or a distance calculation formula between two points.
Step S155: and acquiring 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 linear distance.
Since the point 4 is on the vector cd, the coordinates of the point 4 can be calculated from the vector cd, the third curved distance c4, and the straight-line distance cd, and the coordinates of the point 5 can be obtained in the same manner.
For example, as shown in fig. 4, for calculating the coordinate diagram of the point 4, the definition vector cd is the coordinate with respect to the origin, the point c (x 1, y 1), the point d (x 2, y 2) and the third curved distance c4 (denoted as r) are known, the coordinate of the definition vector addition such as c+d is (x1+x2, y1+y2), the vector subtraction is the same, and the definition vector multiplication such as multiplication by 0.5 is (x1×0.5, y1×0.5); the length of the line segment cd can be calculated from the coordinates of the point c and the point d, expressed as h, the percentage of the line segment d4 to the line segment cd can be calculated according to the formula (1-r)/h, expressed as s, the coordinates (x 1-x2, y1-y 2) of the point c1 can be obtained by vector subtraction (the point c coordinates are subtracted from the point d coordinates), the coordinates ((x 1-x 2) ×s) (y 1-y 2) ×s) of 41 can be obtained by vector multiplication, and the coordinates of the point 4 can be calculated by vector addition with c1+d.
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;
step S170: and determining a second key point array according to the second preset point, the second bending starting point and the second bending ending point.
The first key array may be denoted as [3, c,4], and the second key array may be denoted as [5, d,6].
Step S200: drawing a Bezier curve based on the key point number group;
Step S300: acquiring a graph path based on the bezier curve, the first hard tube 500, and the plurality of pipeline sampling points on the second hard tube 600;
The pipeline sampling points include at least two first sampling points and at least two second sampling points, the two first sampling points are disposed on the central line of the first rigid pipe 500, the two second sampling points are disposed on the central line of the second rigid pipe 600, as points a and b are the first sampling points and points e and f are the second sampling points in fig. 2.
And drawing the class by using the graph and acquiring a graph path according to the Bezier curve, the first sampling point and the second sampling point.
For example, a bezier curve and a straight line segment are drawn by using an API (application program interface) of a pixi. Graphics, which is a graphic class PIXI, and has the functions of drawing a straight line, a curve, a circle, and the like.
Step S400: the graphic path is rendered to simulate the bending state of the hose between the first and second rigid pipes 500 and 600.
The method specifically comprises the following steps:
Step S401: acquiring coordinates of a preset number of third sampling points on the graph path by utilizing the path point acquisition attribute;
step S402: rendering the hose by using the third sampling point and calling the instantiated drawing rope to simulate the bending state of the hose.
As shown in fig. 5, in order to render a rubber catheter, a graphics/quad-processing method (represented by adding a bezier curve to the current path) is used to respectively draw a secondary bezier curve based on the first key array [3, c,4] and the second key array [5, d,6], and a graphics path is drawn according to the first sampling point, the second sampling point and the bezier curve on the glass tube, then a third sampling point on the current path is obtained through the currentpath.
As shown in fig. 6, a schematic diagram of a rubber catheter obtained by performing simulation by using a conventional method is shown in fig. 7, and the conventional method has a large visual state difference from a real rubber catheter due to hard inflection points, but in the conventional method, the bending position of the rubber catheter obtained by performing simulation is in a natural smooth state and is more similar to the real rubber catheter state by drawing a bezier curve and a graph path and rendering, so that the rubber catheter is more similar to the real experimental state when performing simulation of the rubber catheter in an experimental class, has a better visual effect, and solves the problems of sharp corners and large bending state difference of the real rubber catheter at the bending position of the rubber catheter simulated by the conventional simulation method.
Example 2
An embodiment of the present application provides a hose state simulation device, which is applied to a hose state simulation method in embodiment 1, as shown in fig. 8, and is a structural block diagram of the hose state simulation device, where the device includes:
The key point number group acquisition module 100 is configured to acquire a key point number group of the bezier curve based on the first preset point of the first hard tube 500 and the second preset point coordinate of the second hard tube 600;
a curve drawing module 200, configured to draw a bezier curve based on the key point array;
A graph path acquisition module 300, configured to acquire a graph path based on the bezier curve, the first hard pipe 500, and a plurality of pipeline sampling points on the second hard pipe 600;
A rendering module 400 for rendering the graphic path to simulate a bending state of the hose between the first and second rigid pipes 500 and 600.
The first preset point is disposed on the extension line of the center line of the first hard tube 500, and the second preset point is disposed on the extension line of the center line of the second hard tube 600, as shown in fig. 9, which is an overall structural block diagram of the hose state simulation device, wherein the key point array acquisition module 100 includes:
a first bending start point obtaining module 110, configured to select a first bending start point between an intersection point of an end portion of the first rigid pipe 500 and an extension line of a center line thereof and the first preset point;
a second bending start point obtaining module 120, configured to select a second bending start point between an intersection point of an end portion of the second rigid pipe 600 and an extension line of a center line thereof and the second preset point;
a first bending distance obtaining module 130, configured to obtain a first bending distance between the first preset point and the first bending start point;
a second bending distance obtaining module 140, configured to obtain a second bending distance between the second preset point and the second bending start point;
a bending end point obtaining module 150, configured to obtain coordinates of a first bending end point and a second bending end point according to the first preset point, the first bending start point, a first bending distance, a second preset point, a second bending start point, and a second bending distance, where 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 group obtaining module 160, configured to determine a first key point group according to the first preset point, the first bending start point, and the first bending end point;
the second keypoint array acquisition module 170 is configured to determine a second keypoint array according to the second preset point, the second bending start point and the second bending end point.
The bending end point acquisition module 150 includes:
a third bending distance obtaining module 151, configured 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 obtaining 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;
A linear distance obtaining module 153, configured to obtain a linear distance between a first preset point and a second preset point based on the first preset point and the second preset point;
A direction vector obtaining module 154, configured to calculate a direction vector formed by the first preset point and the second preset point based on the coordinates of the first preset point and the second preset point;
And an end point coordinate obtaining module 155, configured to obtain 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.
Wherein the rendering module 400 includes:
a third sampling point obtaining module 401, configured to obtain coordinates of a preset number of third sampling points on the graphics path by using a path point obtaining attribute;
The hose rendering module 402 is configured to render the hose using the third sampling point and invoking the instantiated drawing rope to simulate a bending state of the hose.
The embodiment of the application also provides an electronic device, which comprises a memory and a processor, wherein the memory is used for storing a computer program, and the processor runs the computer program to enable the computer device to execute the hose state simulation method in any one of the embodiment 1.
The embodiment of the present application further provides a readable storage medium having stored therein computer program instructions which, when read and executed by a processor, perform the hose state simulation method of any one of embodiment 1.
In the several embodiments provided in the present application, it should be understood that the disclosed apparatus and method may be implemented in other manners. The apparatus embodiments described above are merely illustrative, for example, of the flowcharts and block diagrams in the figures that illustrate the architecture, functionality, and operation of possible implementations of apparatus, methods and computer program products according to various embodiments of the present application. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
In addition, functional modules in the embodiments of the present application may be integrated together to form a single part, or each module may exist alone, or two or more modules may be integrated to form a single part.
The functions, if implemented in the form of software functional modules and sold or used as a stand-alone product, may be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application may be embodied essentially or in a part contributing to the prior art or in a part of the technical solution, in the form of a software product stored in a storage medium, comprising several instructions for causing a computer device (which may be a personal computer, a server, a network device, etc.) to perform all or part of the steps of the method according to the embodiments of the present application. And the aforementioned storage medium includes: a usb disk, a removable hard disk, a Read-Only Memory (ROM), a random access Memory (RAM, random Access Memory), a magnetic disk, or an optical disk, or other various media capable of storing program codes.
The above description is only an example of the present application and is not intended to limit the scope of the present application, and various modifications and variations will be apparent to those skilled in the art. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included in the protection scope of the present application. It should be noted that: like reference numerals and letters denote like items in the following figures, and thus once an item is defined in one figure, no further definition or explanation thereof is necessary in the following figures.
The foregoing is merely illustrative of the present application, and the present application is not limited thereto, and any person skilled in the art will readily recognize that variations or substitutions are within the scope of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.
It is noted that relational terms such as first and second, and the like are used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Moreover, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.

Claims (6)

1. A method of simulating a hose condition, the method comprising:
Acquiring a key point array of a Bezier curve based on coordinates of a first preset point of a first hard tube and a second preset point of a second hard tube, wherein the first preset point is arranged on an extension line of a central line of the first hard tube, and the second preset point is arranged on an extension line of the central line of the second hard tube, specifically:
selecting a first bending starting point between an intersection point of the end part of the first rigid pipe and an extension line of the central line of the first rigid pipe and the first preset point;
selecting a second bending starting point between an intersection point of the end part of the second rigid pipe and an extension line of the central line of the second rigid pipe and the second preset point;
acquiring a first bending distance between the first preset point and the first bending starting point;
acquiring a second bending distance between the second preset point and the second bending starting point;
acquiring 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 positioned on a direction vector formed by the first preset point and the second preset point;
determining a first key point array according to the first preset point, the first bending starting point and the first bending end point;
determining a second key point array according to the second preset point, the second bending starting point and the second bending ending point;
the obtaining coordinates of a first bending end point and a second bending end point according to the first preset point, the first bending start point, the first bending distance, the second preset point, the second bending start point and the second bending distance includes:
Determining a third bending distance from the first preset point to the first bending end point according to the first bending distance;
determining a fourth bending distance from the second preset point to the second bending end point according to the second bending distance;
acquiring a linear distance between a first preset point and a second preset point based on the first preset point and the second preset point;
Calculating a direction vector formed by the first preset point and the second preset point based on the coordinates of the first preset point and the second preset point;
acquiring 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 linear distance;
drawing a Bezier curve based on the key point array;
Acquiring a graph path based on the Bezier curve, a plurality of pipeline sampling points on the first hard pipe and the second hard pipe;
The graphics path is rendered to simulate a bending state of a hose between the first rigid tube and the second rigid tube.
2. The hose state simulation method according to claim 1, wherein the pipe sampling points include at least two first sampling points and at least two second sampling points, the two first sampling points are disposed on a central line of the first hard pipe, the two second sampling points are disposed on a central line of the second hard pipe, the obtaining a graphic path based on the bezier curve, the first hard pipe, and a plurality of second preset points on the second hard pipe includes:
and drawing a class by using the graph and acquiring a graph path according to the Bezier curve, the first sampling point and the second sampling point.
3. The hose state simulation method of claim 2, wherein the rendering the graphical path to simulate a bending state of a hose between the first hard pipe and the second hard pipe comprises:
acquiring coordinates of a preset number of third sampling points on the graph path by utilizing a path point acquisition attribute;
and rendering the hose by utilizing the third sampling point and calling an instantiation drawing rope so as to simulate the bending state of the hose.
4. A hose condition simulation apparatus, the apparatus comprising:
The key point array acquisition module is used for acquiring a key point array of a Bezier curve based on first preset points of a first hard tube and second preset points of a second hard tube, wherein the first preset points are arranged on an extension line of a central line of the first hard tube, the second preset points are arranged on an extension line of the central line of the second hard tube, and the key point array acquisition module comprises:
the first bending starting point acquisition module is used for selecting a first bending starting point between the intersection point of the end part of the first rigid pipe and the extension line of the central line of the first rigid pipe and the first preset point;
The second bending starting point acquisition module is used for selecting a second bending starting point between the intersection point of the end part of the second rigid pipe and the extension line of the central line of the second rigid pipe and the second preset point;
The first bending distance acquisition module is used for acquiring a first bending distance from the first preset point to the first bending starting point;
A second bending distance obtaining module, configured to obtain a second bending distance between the second preset point and the second bending start point;
the bending end point acquisition module is used for acquiring 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 positioned on a direction vector formed by the first preset point and the second preset point;
The first key point array acquisition module is used for determining a first key point array according to the first preset point, the first bending starting point and the first bending end point;
The second key point array acquisition module is used for determining a second key point array according to the second preset point, the second bending starting point and the second bending end point;
Wherein, the bending end point acquisition module includes:
A third bending distance obtaining module, configured 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 obtaining 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;
the linear distance acquisition module is used for acquiring the linear distance between the first preset point and the second preset point based on the first preset point and the second preset point;
The direction vector acquisition module is used for calculating a direction vector formed by the first preset point and the second preset point based on the coordinates of the first preset point and the second preset point;
the bending end point acquisition module is used for acquiring 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 linear distance;
The curve drawing module is used for drawing a Bezier curve based on the key point array;
The graph path acquisition module is used for acquiring a graph path based on the Bezier curve and a plurality of pipeline sampling points on the first hard pipe and the second hard pipe;
And the rendering module is used for rendering the graph path so as to simulate the bending state of the hose between the first hard pipe and the second hard pipe.
5. An electronic device comprising a memory for storing a computer program and a processor that runs the computer program to cause the computer device to perform the hose state simulation method of any one of claims 1 to 3.
6. A readable storage medium, characterized in that it has stored therein computer program instructions which, when read and executed by a processor, perform the hose state simulation method of any one of claims 1 to 3.
CN202011135342.6A 2020-10-21 2020-10-21 Hose state simulation method and device, electronic equipment and storage medium Active CN112215937B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011135342.6A CN112215937B (en) 2020-10-21 2020-10-21 Hose state simulation method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011135342.6A CN112215937B (en) 2020-10-21 2020-10-21 Hose state simulation method and device, electronic equipment and storage medium

Publications (2)

Publication Number Publication Date
CN112215937A CN112215937A (en) 2021-01-12
CN112215937B true CN112215937B (en) 2024-09-24

Family

ID=74056360

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011135342.6A Active CN112215937B (en) 2020-10-21 2020-10-21 Hose state simulation method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN112215937B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN118585150B (en) * 2024-08-05 2024-11-01 中科方德软件有限公司 Printing processing method, device, electronic equipment and storage medium

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111127590A (en) * 2019-12-26 2020-05-08 新奥数能科技有限公司 Second-order Bezier curve drawing method and device

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20050102063A1 (en) * 2003-11-12 2005-05-12 Pierre Bierre 3D point locator system
CN102768764B (en) * 2012-03-26 2017-12-29 新奥特(北京)视频技术有限公司 It is a kind of that the smooth method of figure is made based on Bezier
CN106202671B (en) * 2016-07-01 2019-11-29 长江勘测规划设计研究有限责任公司 A kind of method that Full Parameterized establishes prestressed strand model
CN107767429B (en) * 2016-08-18 2021-11-16 阿里巴巴集团控股有限公司 Curve generation method and equipment
CN107704801B (en) * 2017-08-18 2021-08-06 电子科技大学 Curve lane line detection method based on segmented straight line and segmented Bezier curve
CN109313819B (en) * 2017-12-29 2023-05-26 深圳力维智联技术有限公司 Line model implementation method, device and computer readable storage medium

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111127590A (en) * 2019-12-26 2020-05-08 新奥数能科技有限公司 Second-order Bezier curve drawing method and device

Also Published As

Publication number Publication date
CN112215937A (en) 2021-01-12

Similar Documents

Publication Publication Date Title
CN109583509B (en) Data generation method and device and electronic equipment
KR101023996B1 (en) Method for constructing surface of fluid-body simulation based on particle method, and storage medium for storing program for the same
CN112215937B (en) Hose state simulation method and device, electronic equipment and storage medium
Dantchev et al. Efficient construction of the Čech complex
JP4761865B2 (en) Spatial simulation program and apparatus
Javed et al. Gravnav: Using a gravity model for multi-scale navigation
CN112102435A (en) Geometric figure drawing method, device, equipment and storage medium
CN113792464A (en) Coupling interface interaction method, system, simulation system, equipment and storage medium
CN111046516B (en) Three-dimensional layout method and device for complex network topology and storage equipment
JP4939486B2 (en) Graph visualization coordinate calculation apparatus, method, program, and recording medium recording the program
CN110689597A (en) Animation model display method and device
JPWO2009104218A1 (en) Map display device
CN112132980B (en) Mind map operation method for psychological consultation
Shi et al. A mixed-depth visual rendering method for bleeding simulation
Zhang et al. Knotpad: Visualizing and exploring knot theory with fluid reidemeister moves
CN112785698B (en) Model display method and device, computer equipment and storage medium
JP7409481B2 (en) Skill output device, skill output method, and skill output program
CN115496860A (en) Flexible rule model construction method and device, terminal equipment and storage medium
US20150294598A1 (en) Connect-the-nodes
CN115454432B (en) Examination development method and system based on BIM platform
JP7294484B2 (en) Program, information processing method and information terminal
CN115205265A (en) Method and device for detecting potential safety hazard of gas equipment
CN118094221A (en) Question processing method and device based on large model, electronic equipment and storage medium
CN107194878A (en) Image split-joint method and device
Shreiner et al. There and Back Again: Graphics Education with a View Towards the Future

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant