A knitted fabric simulation method based on position dynamics

Through the method based on position dynamics, the problems of low accuracy and slow speed of knitted fabric simulation in the existing technology are solved, and high-precision and fast knitted fabric simulation is achieved. By simplifying the coil initial model and distributed calculation, it improves improve simulation efficiency.

CN118194663BActive Publication Date: 2024-09-13CHENGDU ZHIXIAN TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410387202.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-04-01
Publication Date
2024-09-13
Estimated Expiration
2044-04-01

AI Technical Summary

Technical Problem

The existing knitted fabric simulation simulation accuracy is not high and the simulation speed is slow.

Method used

Using a method based on position dynamics, knitting yarn can be realized by generating an initial model of the coil, copying translation, discretization, establishing a deformation simulation model, using spatial meshing and gradient descent methods for collision processing, and constructing stretching and bending constraints. High-precision simulation of lines.

Benefits of technology

It improves the accuracy and speed of knitted fabric simulation, can quickly establish a geometric initial model that conforms to complex coil nesting relationships, realizes distributed computing, and greatly improves the efficiency of physical simulation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118194663B
    Figure CN118194663B
Patent Text Reader

Abstract

The present invention relates to the technical field of knitted fabric simulation, and in particular to a knitted fabric simulation method based on position dynamics, including generating coil initial models of various coil forms according to coil parameters of knitted tissue; copying and translating the coil initial model to simulate multiple coil nesting structures; establishing a deformation simulation model based on a position dynamics algorithm; using a spatial grid division method and a gradient descent method to perform collision processing on the deformation simulation model; constructing stretching and bending constraints to simulate and calculate the stretching and bending deformation of knitted yarns; repeating S4-S5, when the position change value of a discrete point in the deformation simulation model is less than a threshold value, the deformation simulation model reaches a stable state; according to the discrete points of the stable state deformation simulation model, a yarn centerline trajectory is established, and the centerline is swept in a circular cross-section shape to form a yarn appearance. The present invention can quickly establish a geometric initial model that conforms to the nesting relationship of complex knitted fabric coils by simplifying the coil initial model.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of knitted fabric simulation, and in particular to a knitted fabric simulation method based on position dynamics Background Art

[0002] Knitted fabric simulation is a computational method that simulates the behavior and appearance of knitted materials under different conditions, including the simulation of knitted structure, deformation, stretching, bending, collision, and other physical properties. Knitted fabric simulation enables designers and engineers to create and visualize different types of knitted fabrics on computers to predict their appearance and performance in the real world. Through simulation, virtual experiments can be conducted to study the behavior of knitted fabrics under different stress, temperature and humidity conditions, thereby providing guidance for actual production. In addition, knitted fabric simulation helps to optimize production processes, reduce waste and improve product quality. However, the existing knitted fabric simulation accuracy is not high and the simulation speed is slow. Summary of the invention

[0003] In order to solve the problems of low precision and slow simulation speed of knitted fabric simulation in the prior art, the present invention proposes a knitted fabric simulation method based on position dynamics, which utilizes the characteristics of position dynamics equations that facilitate distributed computing to quickly simulate the fabric morphology with high precision.

[0004] The present invention is achieved through the following technical solutions:

[0005] A knitted fabric simulation method based on position dynamics comprises the following steps:

[0006] S1, generating an initial coil model of each coil shape according to the coil parameters of the knitting structure;

[0007] S2, copy and translate the initial model of the coil to simulate the nested structure of multiple coils;

[0008] S3, discretizing the initial model to obtain discrete points, and establishing a deformation simulation model based on a position dynamics algorithm through the discrete points;

[0009] S4, using the space grid division method and gradient descent method to perform collision processing on the deformation simulation model;

[0010] S5. Establishing a spring model between adjacent discrete points, constructing stretching and bending constraints, and performing simulation calculations on the stretching and bending deformations of the knitting yarn;

[0011] S6, repeating S4-S5, when the position change value of the discrete point in the deformation simulation model is less than the threshold value, the deformation simulation model reaches a stable state;

[0012] S7. According to the discrete points of the stable state deformation simulation model, a yarn centerline trajectory is established, and the centerline is swept in a circular cross-sectional shape to form a yarn appearance.

[0013] Furthermore, the coil morphology in S1 includes a flat needle coil, a shifted needle coil, and a tucked eye coil. The coil morphology is simplified and simulated by using a multi-segment broken line to obtain an initial model. The simplified simulation is specifically as follows: the width, height and enclosing rectangle of a single coil are determined according to the coil density; the coil morphology is converted into a multi-segment broken line path composed of different type value points to realize the initial simulation; the multi-segment broken line path composed of different type value points is equivalent to the cross-sectional center line of the yarn, and the type value point simulates the plane morphology of the coil and the convex morphology of the coil; the coordinates of the type value point are generated by the four vertices of the enclosing rectangle according to the proportional relationship, and the coordinate formula of the type value point is:

[0014]

[0015] Among them, p is the coordinate of the type value point, R k is the vertex coordinate of the enclosing rectangle, k is the vertex index, C y It is the contribution coefficient of each vertex of the enclosing rectangle to a certain type value point.

[0016] Furthermore, S2 copies and translates each type value point of the initial model according to the coil height and longitudinal density to form a coil nested structure, specifically: the coils in the same row are copied and translated, and the coordinates of the first and last type value points of the original coil and the copied coil are the same; the coils in the same column are copied and translated, and the original coil and the copied coil are superimposed; the nested structure is formed by stretching the type value points of the original coil in the same column to overlap with the copied coil, and then the copied coil is copied and displaced once, and multiple groups of original coils and copied coils are connected end to end to obtain a type value point set O.

[0017] Furthermore, S3 is specifically as follows: a discrete length res is obtained according to the radius of the knitted yarn, and a discrete point set S is obtained by discretizing between two adjacent type value points in sequence according to the order of the type value point set Q, and a deformation simulation model is established for the discrete point set S based on a position dynamics algorithm.

[0018] Furthermore, the spatial grid division method used in S4 for collision processing is specifically as follows: the space where the discrete points are located is divided into multiple grids according to the collision distance, and the discrete points in the deformation simulation model fall into the corresponding grids. When the grids where two discrete points are located are not adjacent, the two discrete points will not collide. For a discrete point S in a grid i , only detect discrete points S in the same grid j and the discrete points S in the adjacent grid k With S i The collision distance.

[0019] Furthermore, the collision processing using the gradient descent method in S4 is specifically as follows: define two adjacent discrete points in the deformation simulation model as S n and S n+1 , and S n and S n+1 Non-adjacent discrete points S k , the radius of the yarn cross section is r, when point S k The yarn and S n and S n+1 The yarns collide, and the collision point is S k When the boundary point of the cross section is k and S n or S n+1 The collision distance is the maximum value Where l represents S n and S n+1 The fixed distance between them, that is, when the distance between the cross-section center points of all non-adjacent yarns is greater than h, the yarns will not collide;

[0020] When the maximum distance between all discrete points in the discrete point set S in the deformation simulation model is l m When the maximum collision distance is h m When all discrete points satisfy the constraint condition C1=|S i -S j |≤l m Where i, j are adjacent points, C2=|S i -S j |≥h m When i and j are not adjacent points, the yarns will not collide;

[0021] After a collision occurs, the discrete points of the collision are processed as follows:

[0022] When there are two discrete points S in the deformation simulation model i and S j When the constraint condition C1 is not satisfied, find S for the discrete point under the constraint condition C1 n or S n+1 Derived, we get the gradient of the discrete point under the constraint C1:

[0023]

[0024] Use a fixed step size λ to discrete points S i and S j Correct the position in the negative gradient direction:

[0025] S i =S i +ΔS i ;

[0026] S j =S j +ΔS j , the calculation of the modified position is repeated until all discrete points satisfy constraint C1. The calculation method to satisfy constraint C2 is the same.

[0027] Furthermore, the stretching constraint constructed in S5 is specifically as follows: define two adjacent discrete points in the deformation simulation model as S n and S n+1 , then the stretch constraint C s C(S n ,S n+1 )=|S n -S n+1 |-d, where d is the free length of the two discrete points, and the discrete point S n The stretch constraint gradient is Discrete point S n+1 The stretch constraint gradient is The gradient descent update formula Substitute S n The stretch constraint gradient and S n+1 The stretched constraint gradient is obtained by S n Displacement S n+1 Displacement Where w represents the inverse of the mass, s represents the calculation scalar, which is used to limit the projection of the displacement in the direction of the constraint gradient. Represents C relative to the i-th discrete point p i The gradient of C(p1,...,p n ) represents a constraint.

[0028] Furthermore, the construction of the bending constraint in S5 is specifically as follows: three adjacent discrete points in the deformation simulation model form a bending constraint C B =(s1-s2)(s3-s2)+|s1-s2||s3-s2|=0 where s i As the discrete point position, C B Taking the derivative of s1 and s3, we can get the gradient of the bending constraint with respect to the discrete points:

[0029]

[0030]

[0031]

[0032] Introducing the inverse of mass w into the above formula i Obtain the position corrections Δs1, Δs2 and Δs3 of discrete points s1, s2 and s3:

[0033]

[0034]

[0035]

[0036] where k B is the bending correction factor, which is determined according to the bending properties of the yarn.

[0037] Furthermore, the deformation state of the knitted coil at the current moment is obtained in S5, specifically, the free length d is calculated between each discrete point in the deformation simulation model under the initial state. i , where s i represents the distance between adjacent discrete points in the deformation simulation model under the initial state, L represents the total length of the multi-segment broken line, q represents the real coil length, and the deformation simulation model under the initial state is the free length d i Perform cyclic calculation to obtain the deformation state of the coil at the current moment.

[0038] Beneficial effects of the present invention:

[0039] (1) The knitted fabric simulation method based on position dynamics proposed in the present invention can quickly establish a geometric initial model that conforms to the nesting relationship of the complex knitted fabric coils by simplifying the initial coil model;

[0040] (2) A knitted fabric simulation method based on position dynamics proposed by the present invention is a physical simulation method based on position dynamics, which can freely set the distance between the mass points in the simulation model to achieve the effect of simulating the appearance of fabrics with different loop densities;

[0041] (3) The knitted fabric simulation method based on position dynamics proposed in the present invention realizes distributed computing through the calculation method of position dynamics, greatly improving the efficiency of physical simulation, and accelerating the subsequent collision processing and processing speed based on gradient descent by appropriately setting the spacing of discrete points in the geometric initial model;

[0042] (4) The knitted fabric simulation method based on position dynamics proposed in the present invention realizes distributed computing through a grid division method, thereby ensuring the rapid implementation of the entire simulation process. BRIEF DESCRIPTION OF THE DRAWINGS

[0043] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.

[0044] Figure 1 A flowchart of a knitted fabric simulation method based on position dynamics proposed in an embodiment of the present invention;

[0045] Figure 2 A schematic diagram of an initial model of a flat needle loop of a knitted fabric simulation method based on position dynamics proposed in an embodiment of the present invention;

[0046] Figure 3 A schematic diagram of an initial model of a needle moving coil of a knitted fabric simulation method based on position dynamics proposed in an embodiment of the present invention;

[0047] Figure 4 A schematic diagram of coil translation of a knitted fabric simulation method based on position dynamics proposed in an embodiment of the present invention;

[0048] Figure 5 A schematic diagram of a coil nesting structure of a knitted fabric simulation method based on position dynamics proposed in an embodiment of the present invention;

[0049] Figure 6 A schematic diagram of a discrete initial model of a flat needle loop of a knitted fabric simulation method based on position dynamics proposed in an embodiment of the present invention;

[0050] Figure 7 A schematic diagram of a spatial grid division method for a knitted fabric simulation method based on position dynamics proposed in an embodiment of the present invention;

[0051] Figure 8 A schematic diagram of a gradient descent method for a knitted fabric simulation method based on position dynamics proposed in an embodiment of the present invention;

[0052] Fig. 9 A simulation diagram of a knitted fabric simulation method based on position dynamics proposed in an embodiment of the present invention;

[0053] Fig.10 A schematic diagram of a terminal device of a resource management system based on cloud resource monitoring proposed in an embodiment of the present invention;

[0054] Fig.11 A schematic diagram of a readable storage medium of a resource management system based on cloud resource monitoring proposed in an embodiment of the present invention;

[0055] In the figure, 200-terminal device, 210-memory, 211-RAM, 212-cache memory, 213-ROM, 214-program / utility, 215-program module, 220-processor, 230-bus, 240-external device, 250-I / O interface, 260-network adapter, 300-program product. DETAILED DESCRIPTION

[0056] In order to make the objectives, technical solutions and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with embodiments and drawings. The exemplary embodiments of the present invention and their description are only used to explain the present invention and are not intended to limit the present invention.

[0057] Example 1

[0058] This embodiment provides a specific implementation of a knitted fabric simulation method based on position dynamics.

[0059] refer to Figure 1 , a knitted fabric simulation method based on position dynamics, comprising the following steps:

[0060] Step 1, generating an initial coil model of each coil shape according to the coil parameters of the knitted structure;

[0061] refer to Figure 2-Figure 3 The coil forms in step 1 include flat stitch coils, shifted stitch coils, tuck stitch coils, etc. In this embodiment, for the complex forms of these coils, a multi-segment broken line is used to directly simplify the coil forms to simulate and obtain an initial model. The simplified simulation process is specifically as follows:

[0062] (1) Determine the width W1, height H1 and enclosing rectangle of a single coil according to the coil density;

[0063] (2) Convert the coil shape into a multi-segment broken line path composed of different shape value points to achieve initial simulation;

[0064] like Figure 2 a is a front view, where a, b, c, d, e, f, g, and h are points of different shape values ​​that constitute the plain needle loop. The multi-segment broken line path formed by these shape value points is the initial simulation of a plain needle loop shape, and is equivalent to the cross-sectional center line of the yarn, such as Figure 2 b is a side view, where points c and f protrude from the coil plane to simulate the convex shape of the real coil; the coordinates of all the above-mentioned shape value points are generated by the four vertices R1-R4 of the enclosing rectangle according to the proportional relationship, and the shape value point coordinate formula is:

[0065]

[0066] Among them, p is the coordinate of the type value point, R kis the vertex coordinate of the enclosing rectangle, k is the vertex index, C y It is the contribution coefficient of each vertex of the enclosing rectangle to a certain type value point.

[0067] like Figure 3 a is a front view, where points a, b, c, d, e, f, g, and h are points of different types that constitute the needle moving coil, such as Figure 3 b is a side view, in which points b and f also protrude from the coil plane to simulate the convex shape of the real coil.

[0068] In this embodiment, other coil shapes can be analogized in this way to establish initial models of different coil shapes respectively.

[0069] Step 2, copy and translate the initial model of the coil to simulate the nested structure of multiple coils;

[0070] refer to Figure 4-Figure 5 , according to the coil height and longitudinal density, the various type value points of the initial model are copied and translated to form a coil nesting structure, specifically:

[0071] (1) After the coils in the same row are copied and translated, the coordinates of the first and last points of the original coil and the copied coil are the same;

[0072] (2) The coils in the same column are copied and then translated, and the original coils and the copied coils are superimposed;

[0073] (3) The nested structure is formed by stretching the value points of the original coil in the same column and overlapping with the copy coil, and then the copy coil is copied and displaced once. Multiple rows of original coils and copy coils are connected end to end to obtain the value point set Q.

[0074] like Figure 4 a is a front view. After horizontal translation, in two adjacent plain stitch coils in the same row, the type value point h of the previous plain stitch coil (i.e. the original plain stitch coil) is connected with the type value point a of the next coil (i.e. the copied plain stitch coil), thus realizing the connection between the ends of the coils.

[0075] like Figure 4 b is a side view. After vertical translation, the two adjacent red flat stitch coils in the same column have an overlap between the beginning and the end of the previous flat stitch coil (i.e. the original flat stitch coil) and the next coil (i.e. the copied flat stitch coil).

[0076] like Figure 5 a is a front view, and the nested structure is achieved by raising the four type value points c, d, e, and f of the first flat needle coil (i.e., the original flat needle coil); Figure 5b is a side view, in which the first flat stitch loop is overlapped with the second flat stitch loop, and the second flat stitch loop (i.e., the copied flat stitch loop) and the third flat stitch loop (i.e., the copied translation loop of the copied loop) are overlapped end to end to form a nested structure of the tuck structure, and this nested structure is consistent with the nested structure of the real loop.

[0077] Step 2 of this embodiment reduces the complexity of modeling a single coil by simplifying the complex coil shape with multiple broken lines. At the same time, the complex structure composed of multiple coils can be simulated by simply modifying the initial model of a single coil and copying and translating it, which greatly reduces the simulation complexity of the coil structure. At this stage, the type value point set Q of the first connected positions of multiple groups of coils is obtained.

[0078] Step 3, discretizing the initial model to obtain discrete points, and establishing a deformation simulation model based on a position dynamics algorithm through the discrete points;

[0079] refer to Figure 6 , a discrete length res is calculated according to the radius of the knitted yarn, where res = Scale*rad, Scale is the scaling factor, and the value range is [1, Smax]. The upper limit Smax is adjusted according to the actual simulation effect and the calculation effect. According to the order of the type value point set Q, the discrete point set S is discretized between two adjacent type value points in turn. The discrete point set S establishes a deformation simulation model based on the position dynamics algorithm.

[0080] Step 4, using gradient descent method and space grid division method to perform collision processing on the deformation simulation model;

[0081] refer to Figure 7 In step 4, the spatial grid division method is used for collision processing as follows:

[0082] The space where the particles are located is divided into multiple grids according to the collision distance. The particles in the deformation simulation model fall into the corresponding grids. When the grids where two particles are located are not adjacent, the two particles will definitely not collide. Therefore, it is only necessary to detect whether the particles in each grid and the adjacent grids collide. Specifically, for a particle S in a grid i , only detect the particle S in the same grid j and the particle S in the adjacent grid k With S i The collision distance of the particle S in the non-adjacent grid m There is no need for detection. This method can quickly eliminate particles that are far away and improve detection efficiency.

[0083] refer to Figure 8 In step 4, the gradient descent method is used for collision processing as follows:

[0084] Define two adjacent discrete points in the deformation simulation model as Sn and S n+1 , and S n and S n+1 Non-adjacent discrete points S k , the yarn cross-section radius is r, considering point S k The yarn is exactly at S n and S n+1 The yarns collide, and the collision point is S k In this case, we get S k and S n or S k and S n+1 The collision distance is the maximum value Where l represents S n and S n+1 The fixed distance between them shows that if two yarn segments collide, the maximum distance between the discrete points on their center lines is h. Therefore, when the distance between the center points of all non-adjacent yarn sections is greater than h, the yarns will not collide;

[0085] Considering the maximum distance between all discrete points in the discrete point set S in the deformation simulation model is l m When the maximum collision distance is h m During the subsequent collision processing, all particles are guaranteed to satisfy the constraint C1 = |S i -S j |≤l m Where i, j are adjacent points, C2=|S i -S j |≥h m When i and j are not adjacent points, the yarns will not collide;

[0086] After a collision occurs, the discrete points of the collision are processed as follows:

[0087] When there are two discrete points S in the deformation simulation model i and S j When the constraint condition C1 is not satisfied, find S for the discrete point under the constraint condition C1 n or S n+1 Derived, we get the gradient of the discrete point under the constraint C1:

[0088]

[0089] Use a fixed step size λ to discrete points S i and S j Correct the position in the negative gradient direction:

[0090] S i =S i +ΔS i;

[0091] S j =S j +ΔS j , the calculation of the modified position is repeated until all discrete points satisfy constraint C1. The calculation method to satisfy constraint C2 is the same.

[0092] It should be clarified that the particles mentioned in all embodiments refer to discrete points in the simulation model. The particles are discrete representations in the simulation model and are used to construct the shape of the entire coil. In the simulation model, a series of particles are obtained by discretizing the coil shape. These particles represent the shape of the coil in space and are used to simulate the interaction between coils and avoid collisions during collision processing and handling.

[0093] Step 5, establishing a spring model between adjacent discrete points, constructing stretching and bending constraints, and simulating and calculating the stretching and bending deformation of the knitting yarn;

[0094] The calculation constraint principle of step 5 is to construct constraint C for point P in the entire particle system. When point P is displaced by ΔP, the condition C(P+ΔP)=0 is satisfied. When the condition C(P+ΔP)=0, a first-order Taylor expansion is performed to obtain When the displacement direction is restricted to the direction of the constraint gradient, the system after displacement satisfies the conservation of momentum. Therefore, the displacement is used as a proportional variable of the constraint gradient. This process is called projection, which gives Where λ represents the calculation scalar, Substitution After obtaining λ, the expression of ΔP can be obtained For each particle p in the particle system i , project all the constraints on it, and get For the case where the masses of particles are different, in order to ensure the conservation of momentum, the inverse of the mass w is introduced, and we get

[0095] Step 5: Construct the stretch constraint as follows: define two adjacent discrete points in the deformation simulation model as S n and S n+1 , then the stretch constraint C s C(S n ,S n+1 )=|S n -S n+1 |-d, where d is the free length of the two discrete points, and the discrete point S n The stretch constraint gradient is Discrete point S n+1The stretch constraint gradient is The gradient descent update formula Substitute S n The stretch constraint gradient and S n+1 The stretched constraint gradient is obtained by S n Displacement S n+1 Displacement Where w represents the inverse of the mass, s represents the calculation scalar, which is used to limit the projection of the displacement in the direction of the constraint gradient. Represents C relative to the i-th discrete point p i The gradient of C(p1,...,p n ) represents a constraint.

[0096] Step 5: Construct the bending constraint as follows: Construct a bending constraint C using three adjacent discrete points in the deformation simulation model. B =(s1-s2)(s3-s2)+|s1-s2||s3-s2|=0 where s i As the discrete point position, C B Taking the derivative of s1 and s3, we can get the gradient of the bending constraint with respect to the discrete points:

[0097]

[0098]

[0099]

[0100] Introducing the inverse of mass w into the above formula i Obtain the position corrections Δs1, Δs2 and Δs3 of discrete points s1, s2 and s3:

[0101]

[0102]

[0103]

[0104] where k B is the bending correction factor, which is determined according to the bending properties of the yarn.

[0105] Calculate the free length d between each discrete point in the deformation simulation model in the initial state i , where s i represents the distance between adjacent discrete points in the deformation simulation model under the initial state, L represents the total length of the multi-segment broken line, q represents the real coil length, and the deformation simulation model under the initial state is the free length d i Perform cyclic calculation to obtain the deformation state of the coil at the current moment.

[0106] Step 6, iterating the simulation process through steps 4 and 5, when the position change value of the discrete point in the deformation simulation model is less than the threshold value, the deformation simulation model reaches a stable state and the iteration is terminated;

[0107] Step 7, establishing the yarn centerline trajectory according to the discrete points of the steady-state deformation simulation model, and sweeping the centerline in a circular cross-section shape to form the yarn appearance, and obtaining the simulation result.

[0108] In addition, in this embodiment, the following operation steps are further performed on the simulation results, specifically including:

[0109] (1) Post-processing of simulation results, such as calculating the surface normal and texture mapping of textiles based on the positions of the particles;

[0110] (2) Evaluate and optimize the performance of the simulation algorithm to ensure that the simulation can be completed in a reasonable time, especially when dealing with large-scale coil structures;

[0111] (3) Display the simulation process and results through visualization tools so that users or researchers can better understand and analyze the deformation and behavior of textiles;

[0112] (4) Export simulation results into data format for use in other applications or integration with other simulation modules.

[0113] refer to Fig. 9 Through the above knitted fabric simulation method, the simulation data obtained from top to bottom include:

[0114] Simulation diagram of the hole-picking organization - the number of coils is 176 - the simulation time is 3.5s;

[0115] Simulation diagram of twisted weave - number of coils 400 - simulation time 11.6s;

[0116] Pit bar organization simulation diagram - number of coils 600 - simulation time 6.2s;

[0117] Rib structure simulation diagram - number of coils 600 - simulation time 6.2s;

[0118] Bird's eye tissue simulation diagram - number of coils 600 - simulation time 6.3s.

[0119] Example 2

[0120] like Fig.10 Based on Example 1, this embodiment proposes a terminal device for a knitted fabric simulation method based on position dynamics. The terminal device 200 includes at least one memory 210, at least one processor 220, and a bus 230 connecting different platform systems.

[0121] The memory 210 may include a readable medium in the form of a volatile memory, such as a RAM 211 and / or a cache memory 212 , and may further include a ROM 213 .

[0122] The memory 210 also stores a computer program, which can be executed by the processor 220, so that the processor 220 executes any one of the knitted fabric simulation methods based on position dynamics in the embodiments of the present application, and its specific implementation is consistent with the implementation method and the technical effect achieved in the embodiments of the above application, and some of the contents are not repeated. The memory 210 may also include a program / utility 214 having a set (at least one) of program modules 215, such program modules include but are not limited to: an operating system, one or more application programs, other program modules, and program data, each of these examples or some combination may include the implementation of a network environment.

[0123] Accordingly, the processor 220 may execute the above-mentioned computer programs, and may execute the program / utility 214 .

[0124] The bus 230 may be a bus representing one or more of several types of bus structures, including a memory bus or memory controller, a peripheral bus, an accelerated graphics port, a processor, or a local bus using any of a variety of bus architectures.

[0125] The terminal device 200 may also communicate with one or more external devices 240 such as keyboards, pointing devices, Bluetooth devices, etc., and may also communicate with one or more devices that can interact with the terminal device 200, and / or communicate with any device (such as a router, a modem, etc.) that enables the terminal device 200 to communicate with one or more other computing devices. Such communication may be performed through an I / O interface 250. In addition, the terminal device 200 may also communicate with one or more networks (such as a local area network (LAN), a wide area network (WAN) and / or a public network, such as the Internet) through a network adapter 260. The network adapter 260 may communicate with other modules of the terminal device 200 through a bus 230. It should be understood that, although not shown in the figure, other hardware and / or software modules may be used in conjunction with the terminal device 200, including but not limited to: microcode, device drivers, redundant processors, external disk drive arrays, RAID systems, tape drives, and data backup storage platforms, etc.

[0126] Example 3

[0127] like Fig.11This embodiment proposes a computer-readable storage medium for a knitted fabric simulation method based on position dynamics. Instructions are stored on the computer-readable storage medium. When the instructions are executed by the processor, any of the above-mentioned knitted fabric simulation methods based on position dynamics is implemented. The specific implementation method is consistent with the implementation method and the technical effect achieved in the above-mentioned application embodiment, and some contents will not be repeated here.

[0128] Fig.11 The program product 300 provided in this embodiment for implementing the above-mentioned application is shown, which can adopt a portable compact disk read-only memory (CD-ROM) and include program code, and can be run on a terminal device, such as a personal computer. However, the program product 300 of the present invention is not limited to this. In this embodiment, the readable storage medium can be any tangible medium containing or storing a program, which can be used by an instruction execution system, device or device or used in combination with it. The program product 300 can adopt any combination of one or more readable media. The readable medium can be a readable signal medium or a readable storage medium. The readable storage medium can be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of readable storage media (non-exhaustive list) include: an electrical connection with one or more wires, a portable disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above.

[0129] Computer-readable storage media may include data signals propagated in baseband or as part of a carrier wave, wherein readable program codes are carried. Such propagated data signals may take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. The readable storage medium may also be any readable medium other than the readable storage medium, which may send, propagate, or transmit a program used by or in combination with an instruction execution system, an apparatus, or a device. The program code contained on the readable storage medium may be transmitted with any appropriate medium, including but not limited to wireless, wired, optical cable, RF, etc., or any suitable combination of the above. The program code for performing the operation of the present invention may be written in any combination of one or more programming languages, including object-oriented programming languages ​​such as Java, C++, etc., and also conventional procedural programming languages ​​such as "C" language or similar programming languages. The program code may be executed entirely on a user computing device, partially on a user device, as an independent software package, partially on a user computing device, partially on a remote computing device, or entirely on a remote computing device or server. Where a remote computing device is involved, the remote computing device may be connected to the user computing device through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computing device (e.g., through the Internet using an Internet service provider).

[0130] The above shows and describes the basic principles and main features of the present invention and the advantages of the present invention. It should be understood by those skilled in the art that the present invention is not limited to the above embodiments. The above embodiments and descriptions are only for explaining the principles of the present invention. Without departing from the spirit and scope of the present invention, the present invention may have various changes and improvements, which fall within the scope of the present invention to be protected. The scope of protection of the present invention is defined by the attached claims and their equivalents.

Claims

1. A knitted fabric simulation method based on position dynamics, characterized in that: The following steps are involved: S1, generating an initial coil model of each coil shape according to the coil parameters of the knitting structure; S2, copy and translate the initial model of the coil to simulate the nested structure of multiple coils; S3, discretizing the initial model to obtain discrete points, and establishing a deformation simulation model based on a position dynamics algorithm through the discrete points; S4, using the space grid division method and gradient descent method to perform collision processing on the deformation simulation model; S5. Establishing a spring model between adjacent discrete points, constructing stretching and bending constraints, and simulating and calculating the stretching and bending deformation of the knitting yarn; S6, repeating S4-S5, when the position change value of the discrete point in the deformation simulation model is less than the threshold value, the deformation simulation model reaches a stable state; S7, establishing a yarn centerline trajectory according to the discrete points of the steady-state deformation simulation model, and sweeping the centerline in a circular cross-sectional shape to form a yarn appearance; The specific method of using the gradient descent method for collision processing in S4 is as follows: define two adjacent discrete points in the deformation simulation model as S n and S n+1 , and S n and S n+1 Non-adjacent discrete points S k , the radius of the yarn cross section is r, when point S k The yarn and S n and S n+1 The yarns collide, and the collision point is S k When the boundary point of the cross section is k and S n or S n+1 The collision distance is the maximum value Where l represents S n and S n+1 The fixed distance between them, that is, when the distance between the cross-section center points of all non-adjacent yarns is greater than h, the yarns will not collide; When the maximum distance between all discrete points in the discrete point set S in the deformation simulation model is l m When the maximum collision distance is h m When all discrete points satisfy the constraint condition C1=|S i -S j |≤l m Where i, j are adjacent points, C2=|S i -S j |≥h m When i and j are not adjacent points, the yarns will not collide; After a collision occurs, the discrete points of the collision are processed as follows: When there are two discrete points S in the deformation simulation model i and S j When the constraint condition C1 is not satisfied, find S for the discrete points under the constraint condition C1. n or S n+1 Derived, we get the gradient of the discrete point under the constraint C1: Use a fixed step size λ to discrete points S i and S j Correct the position in the negative gradient direction: The calculation of the revised position is repeated until all discrete points satisfy constraint C1. The calculation method to satisfy constraint C2 is the same.

2. The method for simulating knitted fabrics based on position dynamics according to claim 1, characterized in that: The coil forms in S1 include flat stitch coils, shifted stitch coils, and tuck stitch coils. The coil forms are simplified and simulated using multi-segment broken lines to obtain an initial model. The simplified simulation is specifically as follows: the width, height, and enclosing rectangle of a single coil are determined according to the coil density; the coil form is converted into a multi-segment broken line path composed of different type value points to achieve initial simulation; the multi-segment broken line path composed of different type value points is equivalent to the cross-sectional center line of the yarn, and the type value points simulate the plane form of the coil and the convex form of the coil; the coordinates of the type value points are generated by the four vertices of the enclosing rectangle according to a proportional relationship, and the coordinate formula of the type value points is: Among them, p is the coordinate of the type value point, R k is the vertex coordinate of the enclosing rectangle, k is the vertex index, C y It is the contribution coefficient of each vertex of the enclosing rectangle to a certain type value point.

3. The knitted fabric simulation method based on position dynamics according to claim 1, characterized in that: The S2 copies and translates each type value point of the initial model according to the coil height and longitudinal density to form a coil nesting structure, specifically: the coils in the same row are copied and translated, and the coordinates of the first and last type value points of the original coil and the copied coil are the same; the coils in the same column are copied and translated, and the original coil and the copied coil are superimposed; The nested structure is formed by stretching the value points of the same column of original coils and overlapping with the copy coils, and then the copy coils are copied and displaced once. Multiple groups of original coils and copy coils are connected end to end to obtain the value point set Q.

4. The method for simulating knitted fabrics based on position dynamics according to claim 1, characterized in that: The S3 is specifically as follows: a discrete length res is obtained according to the radius of the knitted yarn, and a discrete point set S is obtained by discretizing between two adjacent shape value points in sequence according to the shape value point set Q, and a deformation simulation model is established for the discrete point set S based on a position dynamics algorithm.

5. The method for simulating knitted fabrics based on position dynamics according to claim 1, characterized in that: The spatial grid division method used in S4 for collision processing is specifically as follows: the space where the discrete points are located is divided into multiple grids according to the collision distance, and the discrete points in the deformation simulation model fall into the corresponding grids. When the grids where two discrete points are located are not adjacent, the two discrete points will not collide. For a discrete point S in a grid i , only detect discrete points S in the same grid j and the discrete points S in the adjacent grid k With S i The collision distance.

6. The method for simulating knitted fabrics based on position dynamics according to claim 1, characterized in that: The stretching constraint constructed in S5 is specifically as follows: define two adjacent discrete points in the deformation simulation model as S n and S n+1 , then the stretch constraint C s C(S n ,S n+1 )=|S n -S n+1 |-d, where d is the free length of the two discrete points, and the discrete point S n The stretch constraint gradient is Discrete point S n+1 The stretch constraint gradient is The gradient descent update formula Substitute S n The stretch constraint gradient and S n+1 The stretched constraint gradient is obtained by S n Displacement S n+1 Displacement Where w represents the inverse of the mass, s represents the calculation scalar, which is used to limit the projection of the displacement in the direction of the constraint gradient. Represents C relative to the i-th discrete point p i The gradient of C(p1,...,p n ) represents a constraint.

7. The method for simulating knitted fabrics based on position dynamics according to claim 6, characterized in that: The construction of the bending constraint in S5 is specifically as follows: three adjacent discrete points in the deformation simulation model form a bending constraint C B =(s1-s2)(s3-s2)+|s1-s2||s3-s2|=0 where s i As the discrete point position, C B Taking the derivative of s1 and s3, we can get the gradient of the bending constraint with respect to the discrete points: Introducing the inverse of mass w into the above formula i Obtain the position corrections Δs1, Δs2 and Δs3 of discrete points s1, s2 and s3: where k B is the bending correction factor, which is determined according to the bending properties of the yarn.

8. The method for simulating knitted fabrics based on position dynamics according to claim 6, characterized in that: The deformation state of the knitted coil at the current moment is obtained in S5, specifically: the free length d is calculated between each discrete point in the deformation simulation model under the initial state. i , where s i represents the distance between adjacent discrete points in the deformation simulation model under the initial state, L represents the total length of the multi-segment broken line, q represents the real coil length, and the deformation simulation model under the initial state is the free length d i Perform cyclic calculation to obtain the deformation state of the coil at the current moment.