Differential equation-based geometric element dragging method and device, terminal equipment and storage medium
By constructing objective equations, using Jacobi matrix kernel space projection, and adaptive numerical integration, the problems of accuracy, smoothness, and real-time operation of dragging geometric elements in computer-aided design were solved, and smooth and continuous dragging trajectories of geometric elements were realized.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- SHENZHEN POISSON SOFTWARE TECH CO LTD
- Filing Date
- 2026-01-29
- Publication Date
- 2026-06-26
Smart Images

Figure CN122284892A_ABST
Abstract
Description
Technical Field
[0001] This application belongs to the field of computer-aided design technology, and in particular relates to a method, device, terminal equipment and storage medium for dragging geometric elements based on differential equations. Background Technology
[0002] In the field of Computer-Aided Design (CAD), drag-and-drop operation is the core interactive method for users to adjust the position of geometric elements. It needs to meet the requirements of accuracy, smoothness and real-time interactivity at the same time. That is, the drag point needs to match the cursor trajectory, the movement of geometric elements needs to conform to the motion logic, and the software needs to respond to calculations quickly.
[0003] In existing technologies, developers typically treat the constraint equations of geometric elements as nonlinear equations, optimization equations, or differential equations to solve for the dragging point. However, all three methods have significant shortcomings. For example, solving nonlinear equations based on the Newton-Raphson method is sensitive to initial values and can easily lead to iteration divergence due to undesirable initial value selection during dragging. Solving optimization equations is computationally expensive and prone to getting trapped in local optima, making it difficult to meet the requirements of real-time interaction. When solving differential equations using Runge-Kutta-like methods, it is difficult to balance accuracy and efficiency. Increasing accuracy significantly increases computational costs, while decreasing accuracy leads to unstable and uneven dragging trajectories. No single method can fully meet the core requirements of dragging operations. Summary of the Invention
[0004] This application provides a method, apparatus, terminal device, and storage medium for dragging geometric elements based on differential equations, ensuring constraint preservation, motion continuity, and real-time computation during the dragging process of geometric elements in computer-aided software.
[0005] In a first aspect, embodiments of this application provide a method for dragging geometric elements based on differential equations, including:
[0006] Obtain the starting point, target point, and first constraint conditions corresponding to the geometric elements of the user's drag operation; Construct the objective equation based on the starting point, the target point, and the first constraint condition; Construct a differential equation based on the objective equation; Solve the differential equation to obtain multiple intermediate drag points that satisfy the first constraint condition; Substitute multiple intermediate drag points into the target equation to obtain the drag trajectory of the user dragging the geometric element to the target point.
[0007] In this embodiment, core basic information related to the user's drag operation is accurately collected, namely the starting point when the geometric element starts dragging, the target point the user expects to drag to, and the first constraint condition that the geometric element must follow. Then, based on the collected starting point and target point, and combined with the first constraint condition, a target equation is constructed to describe the drag target and the constraint boundary. Then, based on the constructed target equation, it is further transformed into a differential equation describing the change law of geometric parameters over time. After that, the differential equation is solved to obtain multiple intermediate drag points that strictly satisfy the first constraint condition. Finally, these multiple intermediate drag points are substituted one by one into the previously constructed target equation, and through verification and calibration, the complete drag trajectory of the geometric element from the starting point to the target point is finally formed. This method explicitly obtains the "first constraint condition corresponding to the geometric element" and incorporates this constraint condition when constructing the target equation. The construction of the differential equation is also based on the target equation. After solving the differential equation, "multiple intermediate drag points that satisfy the first constraint condition" are clearly obtained. Finally, the intermediate drag points are substituted back into the target equation to generate the trajectory. The first constraint condition is the core constraint throughout the process, ensuring that each step does not deviate from the constraint requirements, thereby ensuring constraint preservation. Furthermore, the dragging process is described by constructing differential equations. The differential equations themselves characterize the law of continuous change of geometric parameters over time. Solving this system of equations yields "multiple intermediate drag points" rather than discrete isolated points. These continuously generated intermediate drag points are connected in series to naturally form a smooth and continuous dragging trajectory, avoiding motion jumps and ensuring motion continuity. Solving the differential equation can quickly generate intermediate drag points, and the trajectory can be obtained by substituting the intermediate points back into the target equation. The overall computational chain is clear, the amount of computation is controllable, and it can quickly respond to user dragging operations, ensuring real-time computation.
[0008] In one possible implementation of the first aspect, the objective equation is constructed based on the starting point, the target point, and the first constraint, including: Calculate the drag distance between the target point and the starting point; Establish a system of constraint equations based on the constraints; Based on the set of constraint equations, construct the objective equation with the goal of minimizing the drag distance.
[0009] In this embodiment, by calculating the dragging distance between the starting point and the target point, establishing a set of constraint equations based on the first constraint condition, and then constructing the target equation with the goal of minimizing the dragging distance, the core optimization direction of dragging is clarified, and the constraint requirements are solidified into mathematical boundaries. This ensures from the source that subsequent solutions always revolve around "compliant and efficient approximation of the target", laying a precise mathematical foundation for achieving a dragging trajectory that maintains constraints and ensures continuous motion.
[0010] In one possible implementation of the first aspect, a differential equation is constructed based on the objective equation, including: Calculate the drag direction vector of the user's drag operation based on the target point and the starting point; Calculate the Jacobian matrix corresponding to the objective equation; Construct a differential equation based on the drag direction vector and the Jacobian matrix.
[0011] In this embodiment, by calculating the drag direction vector between the target point and the starting point, solving the Jacobian matrix corresponding to the target equation, and then constructing a differential equation by projecting the drag direction vector onto the Jacobian matrix kernel space, the drag direction is mathematically ensured to naturally meet the constraint requirements and can characterize the continuous motion law, providing core dynamic model support for the subsequent generation of constraint-compliant, smooth and continuous drag trajectories.
[0012] In one possible implementation of the first aspect, a differential equation is constructed based on the drag direction vector and the Jacobian matrix, including: The kernel space is determined based on the Jacobian matrix; whereby the kernel space represents the set of safe directions that meet the constraints. Projecting the drag direction vector onto the kernel space yields a projection vector of the drag direction vector based on the kernel space. The projection vector is defined as the instantaneous rate of change of the position parameter over time, resulting in a differential equation.
[0013] In this embodiment, the kernel space representing the set of constraint compliance and safety directions is determined by the Jacobian matrix. The drag direction vector is projected onto the kernel space to obtain the compliance projection vector, which is defined as the instantaneous rate of change of the position parameter over time to construct a differential equation. This ensures from a mathematical perspective that the drag direction always meets the constraint requirements, and at the same time provides accurate dynamic evolution model support for the subsequent generation of continuous and smooth drag trajectory.
[0014] In one possible implementation of the first aspect, the differential equation is solved to obtain multiple intermediate drag points that satisfy the first constraint condition, including: Set the initial step size and error threshold; Numerical integration of the differential equation is performed based on the initial step size and error threshold to obtain multiple intermediate drag points that satisfy the first constraint condition.
[0015] In this embodiment, by setting an initial step size and an error threshold, an adaptive numerical integration method is used to solve the differential equation, which can dynamically balance computational accuracy and efficiency, and quickly generate multiple intermediate drag points that strictly satisfy the first constraint condition, providing accurate and efficient node support for the subsequent construction of a continuous and compliant drag trajectory.
[0016] In one possible implementation of the first aspect, the differential equation is numerically integrated based on the initial step size and the error threshold to obtain a plurality of intermediate drag points that satisfy the first constraint condition, including: Construct a first Lagrange function for the current initial position and the differential equation; Derive the second constraint condition corresponding to the first Lagrange function; Numerical integration of the differential equation is performed based on the first Lagrange function and its corresponding second constraint to obtain multiple intermediate drag points that satisfy the first constraint.
[0017] In this embodiment, by constructing a first Lagrangian function for the current initial position and the differential equation, deriving the corresponding second constraint condition, and then combining the two to perform numerical integration on the differential equation, the movement direction that meets the constraint can be accurately locked, and multiple intermediate drag points that satisfy the first constraint condition can be efficiently generated, laying a reliable node foundation for the subsequent construction of a continuous and compliant drag trajectory.
[0018] In one possible implementation of the first aspect, the differential equation is numerically integrated based on the first Lagrangian function and the second constraint condition to obtain multiple intermediate drag points that satisfy the first constraint condition, including: Solve the system of equations consisting of the first Lagrange function and the second constraint to obtain the projection direction corresponding to the current position; The next step size corresponding to the initial step size is determined based on the projection direction and the error threshold. Calculate the next drag point corresponding to the current initial position based on the current initial position and the next step length.
[0019] In this embodiment, the projection direction that complies with the current position is obtained by solving the first Lagrangian function based on the second constraint. The next step length that adapts to the accuracy and efficiency is determined by combining the error threshold. Then, the next dragging point is calculated based on the current initial position and the step length. This iterative process realizes the numerical integration of the differential equation and efficiently generates multiple intermediate dragging points that strictly satisfy the first constraint, providing accurate and efficient node support for constructing a constraint-compliant, smooth and continuous dragging trajectory.
[0020] Secondly, embodiments of this application provide a geometric element dragging device based on differential equations, comprising: The data acquisition module is used to acquire the starting point, target point, and first constraint conditions corresponding to the geometric elements of the user's drag operation. The objective equation construction module is used to construct the objective equation based on the starting point, the target point, and the first constraint condition. The differential equation construction module is used to construct differential equations based on the objective equation. The drag point solving module is used to solve differential equations and obtain multiple intermediate drag points that satisfy the first constraint condition. The drag trajectory generation module is used to substitute multiple intermediate drag points into the target equation to obtain the drag trajectory of the user dragging the geometric element to the target point.
[0021] Thirdly, embodiments of this application provide a terminal device, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it implements the geometric element dragging method based on differential equations as described in any of the first aspects above.
[0022] Fourthly, embodiments of this application provide a computer-readable storage medium storing a computer program that, when executed by a processor, implements the geometric element dragging method based on differential equations as described in any of the first aspects above.
[0023] Fifthly, embodiments of this application provide a computer program product that, when run on a terminal device, causes the terminal device to execute the geometric element dragging method based on differential equations as described in any of the first aspects above.
[0024] It is understood that the beneficial effects of the second to fifth aspects mentioned above can be found in the relevant descriptions in the first aspect mentioned above, and will not be repeated here. Attached Figure Description
[0025] To more clearly illustrate the technical solutions in the embodiments of this application, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0026] Figure 1 This is a flowchart illustrating the geometric element dragging method based on differential equations provided in an embodiment of this application. Figure 2 This is a schematic diagram of the process for constructing the target equation provided in an embodiment of this application; Figure 3 This is a schematic diagram of the process for constructing differential equations provided in the embodiments of this application. Figure 1 ; Figure 4 This is a schematic diagram of the process for constructing differential equations provided in the embodiments of this application. Figure 2 ; Figure 5 This is a schematic diagram of the process for solving differential equations provided in the embodiments of this application. Figure 1 ; Figure 6 This is a schematic diagram of the process for solving differential equations provided in the embodiments of this application. Figure 2 ; Figure 7 This is a schematic diagram of the process for solving differential equations provided in the embodiments of this application. Figure 3 ; Figure 8 This is a schematic diagram of the positioning structure in the geometric constraint engine for smooth dragging provided in the embodiments of this application; Figure 9 This is a schematic diagram of the overall process of the geometric element dragging method based on differential equations provided in the embodiments of this application; Figure 10 This is a structural block diagram of the geometric element dragging device based on differential equations provided in the embodiments of this application; Figure 11 This is a schematic diagram of the structure of the terminal device provided in the embodiments of this application. Detailed Implementation
[0027] In the following description, specific details such as particular system architectures and techniques are set forth for illustrative purposes and not for limitation, in order to provide a thorough understanding of the embodiments of this application. However, those skilled in the art will understand that this application may also be implemented in other embodiments without these specific details. In other instances, detailed descriptions of well-known systems, apparatuses, circuits, and methods have been omitted so as not to obscure the description of this application with unnecessary detail.
[0028] It should be understood that, when used in this application specification and the appended claims, the term "comprising" indicates the presence of the described features, integrals, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, integrals, steps, operations, elements, components and / or a collection thereof.
[0029] It should also be understood that the term “and / or” as used in this application specification and the appended claims means any combination of one or more of the associated listed items and all possible combinations, and includes such combinations.
[0030] As used in this application specification and the appended claims, the term "if" may be interpreted, depending on the context, as "when," "once," "in response to determination," or "in response to detection." Similarly, the phrase "if determined" or "if detected [the described condition or event]" may be interpreted, depending on the context, as meaning "once determined," "in response to determination," "once detected [the described condition or event]," or "in response to detection [the described condition or event]."
[0031] Furthermore, in the description of this application and the appended claims, the terms "first," "second," "third," etc., are used only to distinguish descriptions and should not be construed as indicating or implying relative importance.
[0032] References to "one embodiment" or "some embodiments" in this specification mean that one or more embodiments of this application include a specific feature, structure, or characteristic described in connection with that embodiment. Therefore, the phrases "in one embodiment," "in some embodiments," "in other embodiments," "in still other embodiments," etc., appearing in different parts of this specification do not necessarily refer to the same embodiment, but rather mean "one or more, but not all, embodiments," unless otherwise specifically emphasized.
[0033] In the CAD field, drag-and-drop operation is the core interaction method for users to adjust the position of geometric elements. It needs to meet the requirements of accuracy, smoothness and real-time interactivity at the same time. That is, the drag point needs to match the cursor trajectory, the movement of geometric elements needs to conform to the motion logic, and the software needs to respond to calculations quickly.
[0034] In existing technologies, developers typically treat the constraint equations of geometric elements as nonlinear equations, optimization equations, or differential equations to solve for the dragging point. However, all three methods have significant shortcomings. For example, solving nonlinear equations based on the Newton-Raphson method is sensitive to initial values and can easily lead to iteration divergence due to undesirable initial value selection during dragging. Solving optimization equations is computationally expensive and prone to getting trapped in local optima, making it difficult to meet the requirements of real-time interaction. When solving differential equations using Runge-Khutta methods (RKF), it is difficult to balance accuracy and efficiency. Increasing accuracy significantly increases computational costs, while decreasing accuracy leads to unstable and uneven dragging trajectories. No single method can fully meet the core requirements of dragging operations.
[0035] To address the aforementioned technical issues, this application provides a method for dragging geometric elements based on differential equations. This application integrates constraint optimization theory, geometric spatial projection, and adaptive differential equation numerical integration. Through a four-step core process—constructing a least-squares optimization problem, modeling differential equations based on Jacobian matrix kernel spatial projection, using the RKF method (4th-5th order truncation error) for numerical integration to generate intermediate dragging points, and back-substituting the optimization model to calibrate the final position—this method achieves four key advantages: constraint preservation, smooth continuity, good real-time performance, and strong versatility in the dragging process. It can be widely applied to various parametric CAD systems.
[0036] See Figure 1 This is a flowchart illustrating a method for dragging geometric elements based on differential equations provided in an embodiment of this application. It is intended as an example and not a limitation. The method may include the following steps: S101, obtain the starting point, target point, and first constraint conditions corresponding to the geometric elements of the user's drag operation.
[0037] In this embodiment, three core input parameters for smooth dragging of CAD geometric constraints are obtained, providing a foundation for subsequent mathematical modeling and solving. For example, the starting point of the user's dragging operation is the initial position of the geometric element before it is dragged (denoted as...). Such as the coordinates of the endpoints of a line segment, the coordinates of the center of a circle, etc.; the target point is the final position that the user expects to reach through the geometric element specified by the cursor (denoted as...). The first constraint condition corresponding to a geometric element is the core geometric constraint that the geometric element must comply with (denoted as...). Examples include "parallel to a fixed straight line", "the distance between two points is fixed", and "tangent to another circle".
[0038] First, the software monitors user interaction behavior in real time. When the user selects a target geometric element and triggers a drag operation, it automatically records the initial position parameters of the element before dragging (such as endpoint coordinates, size parameters, etc.) as the starting point. Simultaneously, by using cursor positioning technology, the desired endpoint coordinates or relevant positional references specified by the user during dragging are captured to determine the target point. Secondly, the software retrieves the constraint configurations associated with the geometric element (such as constraints preset by the user during drawing, system default constraints, or model-associated constraints), extracts the core first constraint condition, and transforms it into a standardized mathematical expression of equality constraints. (For example, "parallel to line L" is transformed into "the cross product of the line segment's direction vector and the direction vector of L is 0"), ultimately forming the "starting point". +Target point +First constraint condition The complete set of input parameters provides basic data support for the subsequent construction of least squares optimization problems and modeling of differential equations.
[0039] S102, construct the objective equation based on the starting point, the target point, and the first constraint condition.
[0040] In this embodiment of the application, after obtaining the above core parameters, the dragging requirements of geometric elements in CAD are transformed into a set of mathematical equations that can be calculated and solved, laying the foundation for generating smooth and compliant dragging trajectories through numerical methods. Specifically, this can be broken down into the core action of "clearly defining the target + binding constraints".
[0041] With the core objective of "minimizing the change in geometric parameters during the process of moving geometric elements from the starting point to the target point", the "first constraint condition" (such as parallel to a fixed line, fixed distance between two points, etc.) is transformed into a mathematical constraint that must be followed. Finally, the equations are combined to form a complete system of equations or objective equations of "objective function + constraint conditions" (i.e., least squares optimization problem).
[0042] In one embodiment, see Figure 2 This is a schematic diagram of the process for constructing the target equation provided in an embodiment of this application, such as... Figure 2 As shown, step S101 includes: S201, calculate the drag distance between the target point and the starting point.
[0043] In this embodiment of the application, by quantifying the "expected movement range" of the geometric element from the starting point to the target point, the calculated dragging distance will serve as the key basic data for subsequently building an optimization model and determining the movement direction. Essentially, it provides a quantitative basis for the optimization goal of "making the geometric element as close to the target point as possible", ensuring that subsequent calculations can revolve around "minimizing the gap between the actual movement and the expected movement".
[0044] For example, in practical applications, the square of the distance is calculated directly (i.e., This is used as the core term of the objective function of the least squares optimization problem in the scheme, providing a quantitative basis for the subsequent construction of the equation system of "objective function + constraints" and the solution of the compliant movement direction.
[0045] S202, Establish a system of constraint equations based on the constraint conditions.
[0046] In this embodiment, the geometric rules that geometric elements in CAD must follow (such as parallelism, fixed distance, tangency, etc.) are transformed into a standardized and computable set of mathematical equations (i.e., a set of constraint equations). Essentially, this defines "unbreakable rule boundaries" for subsequent calculations, ensuring that geometric elements always conform to preset constraints when dragged, while providing a mathematical basis for building optimization models and solving for compliant movement directions.
[0047] For example, first, clarify the parametric representation of geometric elements (e.g., points use coordinates (x, y, z), line segments use a combination of endpoint coordinates, circles use center coordinates + radius, etc.), and the geometric definitions of various constraints (e.g., "parallel constraint" means the direction vectors of two lines are proportional, "fixed distance constraint" means the Euclidean distance between two points is a constant); second, transform each constraint into an equation expression according to its geometric logic. For example, "line segment AB is parallel to a fixed line L" can be transformed into the equation "the cross product of the direction vectors of AB and L is 0," and "the distance from point C to line DE is fixed at d" can be transformed into the equation where the corresponding distance formula equals d; finally, integrate all the transformed equations to form a unified set of constraint equations. (i=1,..,m, where x is the set of parameters of the geometric elements and m is the number of constraints). This set of equations will serve as the core constraint basis for constructing the least squares optimization problem and solving the Jacobian matrix kernel space projection, ensuring that all calculations are performed within the compliance range.
[0048] S203, construct the objective equation based on the constraint equation set and with the goal of minimizing the drag distance.
[0049] In this embodiment, the user requirement of "bringing geometric elements closer to the target point" is combined with "unbreakable geometric constraints" and transformed into a standardized set of mathematical optimization equations. Essentially, this clarifies the "objective" (minimizing the dragging distance) and "rules" (constraint equations) for subsequent calculations, forming a complete mathematical framework of "objective function + constraint conditions". This provides a clear basis for subsequent numerical solutions (such as the RKF method and the Newton-Raphson method), ensuring that the dragging result both meets the user's intent and satisfies the geometric constraints.
[0050] Specifically, first, clarify the parametric representation of geometric elements (e.g., points using coordinates, line segments using a combination of endpoint coordinates, etc.), and define the starting point... With the target point Substituting the parameters into the Euclidean distance formula, a quadratic objective function is constructed with the core objective of "minimizing the actual movement distance of geometric elements," that is... (Using the squared distance simplifies subsequent calculations without affecting the optimization results); secondly, the established constraint equations are retrieved. (i=1,..,m, such as the equation expression for constraints like parallelism and fixed distance), which are taken as the constraints that must be satisfied; finally, the objective function is integrated with the constraint equation system to form the following objective equation:
[0051]
[0052] In the above method, by calculating the dragging distance between the starting point and the target point, establishing a set of constraint equations based on the first constraint condition, and then constructing the target equation with minimizing the dragging distance as the objective, the core optimization direction of dragging is clarified, and the constraint requirements are solidified into mathematical boundaries. This ensures from the source that subsequent solutions always revolve around "compliant and efficient approximation of the target", laying a precise mathematical foundation for achieving a dragging trajectory that maintains constraints and ensures continuous motion.
[0053] S103, construct the differential equation based on the objective equation.
[0054] In this embodiment of the application, after constructing the system of optimization equations, what we want to obtain is the geometric elements along the vector. The trajectory is the path that moves the furthest distance towards the target point. Due to the existence of constraint equations, this trajectory is not necessarily from the position... To the finish line The direction of the line connecting the geometric elements changes with the position of the geometric elements as the dragging progresses, a process that is well-suited for description using differential equations.
[0055] In other words, the static optimization objective equation of "minimizing drag distance + satisfying constraints" is transformed into a dynamic differential equation describing the continuous movement process of geometric elements. Essentially, it transforms the "final goal" into real-time guidance on "how to move at each step", allowing geometric elements to gradually approach the target point along a compliant and smooth trajectory, providing a dynamic calculation model for generating intermediate drag points using the RKF method.
[0056] In one embodiment, see Figure 3 This is a schematic diagram of the process for constructing differential equations provided in the embodiments of this application. Figure 1 ,like Figure 3 As shown, step S103 includes: S301, calculate the drag direction vector of the user's drag operation based on the target point and the starting point.
[0057] In this embodiment, by quantifying the "expected direction" of the user's dragging, that is, by calculating the parameters of the target point and the starting point, a vector is obtained from the starting position to the target position of the geometric element. Essentially, this provides the original reference for subsequent calculations of the "compliant movement direction," ensuring that subsequent projection, modeling, and other calculations always revolve around the user's intention, making the movement direction of the geometric element conform to the user's expectations. The resulting dragging direction vector between the target point and the starting point is: .
[0058] S302, calculate the Jacobian matrix corresponding to the objective equation.
[0059] In this embodiment, the "constraint change sensitivity" of the constraint equation system is quantified into a matrix form, namely the Jacobi matrix. Essentially, the Jacobi matrix is the "set of partial derivatives" of the constraint equation system with respect to the geometric element parameters. It can accurately describe the rate and direction of change of each constraint with respect to the geometric parameters. Its core function is to provide a key mathematical tool for the subsequent "projection of the dragging direction vector into the kernel space" to ensure that the movement direction obtained after projection strictly satisfies the constraint conditions.
[0060] For example, first, define the parameterized set of geometric elements (such as the coordinates of a point (x, y), the combination of endpoint coordinates of a line segment, etc., denoted as the parameter vector x), and the system of constraint equations. The specific equation form for =0 (i=1,..,m, where m is the number of constraints); secondly, for each constraint function Calculate the first-order partial derivatives of each component of the parameter vector x with respect to each component (e.g., constraints). =x+y 5=0, the partial derivative with respect to x is 1, and the partial derivative with respect to y is 1); finally, all partial derivatives are arranged according to the rule of "rows correspond to constraints, columns correspond to parameters" to form an m×n Jacobian matrix J (n is the dimension of the parameter vector x). The element in the i-th row and j-th column of the matrix is the partial derivative of the i-th constraint function with respect to the j-th parameter. This matrix will be directly used for the subsequent kernel space projection calculation of the drag direction vector and is the core mathematical foundation for realizing "constraint preservation".
[0061] S303, construct differential equations based on drag direction vector and Jacobian matrix.
[0062] In this embodiment, the "user-expected drag direction (i.e., drag direction vector)" is combined with the "constraint rules (i.e. Jacobian matrix)" to transform it into a dynamic mathematical model describing the continuous and compliant movement of geometric elements. Essentially, it quantifies the compliant direction of "where to move at each step" (the projection of the drag direction vector onto the Jacobian matrix kernel space) into a differential relationship of "the change of geometric parameters with drag progress (time)", ultimately forming a differential equation with initial conditions, which provides the core calculation basis for the subsequent generation of smooth intermediate drag points using the RKF method.
[0063] In the above method, by calculating the drag direction vector between the target point and the starting point, solving the Jacobian matrix corresponding to the target equation, and then constructing a differential equation by projecting the drag direction vector onto the kernel space of the Jacobian matrix, the drag direction is mathematically guaranteed to naturally meet the constraint requirements and can characterize the continuous motion law, providing core dynamic model support for the subsequent generation of constraint-compliant, smooth and continuous drag trajectories.
[0064] In one embodiment, see Figure 4 This is a schematic diagram of the process for constructing differential equations provided in the embodiments of this application. Figure 2 ,like Figure 4 As shown, step S303 includes: S401, determine the kernel space based on the Jacobian matrix; where the kernel space is used to represent the set of safe directions that meet the constraints.
[0065] In this embodiment, the “safe movement direction that does not violate the constraints” is selected from the Jacobian matrix, which is the kernel space of the Jacobian matrix. In essence, it is the set of all parameter change directions that can keep the constraint equations true. Determining the kernel space is to define the compliance range for the subsequent “projection of the drag direction vector”, and to ensure that no matter how the projection movement direction moves, it will not break the preset geometric constraints (such as parallelism, fixed distance, etc.).
[0066] Specifically, the Jacobian matrix J (m×n dimensions, where m is the number of constraints and n is the dimension of geometric element parameters) corresponding to the constraint equation system is explicitly defined. Its core meaning is to describe the sensitivity of the constraints to changes in parameters. Secondly, the mathematical definition of kernel space is "satisfying..." The set of all vectors v (i.e., the vector space orthogonal to the row vectors of the Jacobian matrix) is thus solved by solving the homogeneous linear equation system. The fundamental solution set of the system of equations is obtained. Finally, the vector space spanned by the fundamental solution set is determined as the kernel space of the Jacobian matrix. All vectors in this space correspond to the safe direction where the constraint still holds after movement, providing the core mathematical basis for projecting the user's drag direction vector into this space and obtaining the compliant movement direction.
[0067] S402, project the drag direction vector onto the kernel space to obtain the drag direction vector based on the kernel space.
[0068] In this embodiment, the user's desired drag direction vector is "compliantly screened". Through projection operation, "violation components" that would violate the constraints in the drag direction are removed, and only the components that fall within the kernel space (safe directions that meet the constraints) are retained. The final projected vector is the optimal actual movement direction that "both fits the user's drag intention and strictly satisfies the geometric constraints", providing the core driving term for the subsequent construction of differential equations.
[0069] Specifically, the kernel space of the Jacobian matrix that has been solved is explicitly defined (based on the homogeneous linear equation system). The fundamental solution set is spanned, and the orthonormal basis of the kernel space is determined (obtained by processing the fundamental solution set through methods such as Schmidt orthogonalization); secondly, the user drag direction vector is obtained (calculated from the parameter difference between the target point and the starting point, denoted as ). Finally, the projection vector is calculated using the orthogonal projection formula: the drag direction vector is... The projection vector is obtained by performing an inner product with each orthonormal basis vector in the kernel space, and then summing the weighted inner product results with the corresponding basis vectors. The projection vector falls entirely within the kernel space, ensuring that the constraint equations always hold true when moving in this direction, while preserving the user's original dragging intention to the greatest extent possible. This is a key step in achieving a balance between "constraint preservation" and "intent alignment".
[0070] S403 defines the projection vector as the instantaneous rate of change of the position parameter over time, thus obtaining the differential equation.
[0071] In this embodiment, the "compliant projection vector" is transformed into a dynamic mathematical relationship describing the continuous movement of geometric elements. Essentially, the compliant direction (projection vector) of "where to move and how fast to move at each step" is defined as the rate of change of the position parameters of the geometric elements with the dragging progress (time). Combined with the initial conditions of the starting point, a complete differential equation is finally formed, providing a core calculation model for the subsequent generation of smooth intermediate dragging points using the RKF method.
[0072] For example, first, the position parameter vector x of the geometric element (such as the coordinates of a point, the combination of the endpoint coordinates of a line segment, etc.) and the compliant projection vector obtained by kernel space projection are defined. (This both aligns with the user's dragging intent and satisfies the constraints); secondly, based on the physical meaning of the differential equation, the projection vector is directly defined as the instantaneous rate of change of the position parameter x with time t, i.e.
[0073] This formula quantifies the "regulation of position over time"; finally, it adds the initial conditions for the start of the dragging process: ( (Initial position parameters for geometric elements) Combining the rate of change equation with the initial conditions forms a complete differential equation system. This system of equations will serve as the core input for the numerical integration of the RKF method, supporting the subsequent generation of continuous and compliant drag trajectories. Therefore, the differential equation obtained above is:
[0074]
[0075] In the above method, the kernel space representing the set of constraint compliance and safety directions is determined by the Jacobian matrix. The drag direction vector is projected onto this kernel space to obtain the compliance projection vector, which is defined as the instantaneous rate of change of the position parameter over time to construct a differential equation. This ensures from a mathematical perspective that the drag direction always meets the constraint requirements, and at the same time provides accurate dynamic evolution model support for the subsequent generation of continuous and smooth drag trajectory.
[0076] S104, solve the differential equation to obtain multiple intermediate drag points that satisfy the first constraint condition.
[0077] In this embodiment, the constructed differential equation is solved by numerical integration (i.e., RKF method), and the continuous and compliant drag trajectory of the geometric element is discretized into a series of calculable and displayable specific position points. These intermediate drag points not only strictly satisfy the first constraint condition (and other preset constraints), but can also be connected into a smooth trajectory. Essentially, the "dynamic mathematical model" is transformed into "actually executable drag path nodes", providing core data support for subsequent calibration of the final position and the smooth dragging of geometric elements in CAD.
[0078] The RKF method is a single-step integration method with an adaptive step size, where the truncation error is between the fourth and fifth orders. Its core lies in simultaneously calculating solutions of both fourth and fifth order accuracy, and estimating the local truncation error by comparing the difference between the two. Based on this, the integration step size for the next step is dynamically adjusted. Specifically, the RKF method uses a larger step size to accelerate the integration process when the curve changes gently, and a smaller step size to ensure accuracy when the curve changes sharply. Therefore, using the RKF method achieves the best balance between accuracy and efficiency, effectively avoiding numerical instability or graphical jitter that may occur with fixed-step methods.
[0079] In one embodiment, see Figure 5 This is a schematic diagram of the process for solving differential equations provided in the embodiments of this application. Figure 3 ,like Figure 5 As shown, step S104 includes: S501, set the initial step size and error threshold.
[0080] In this embodiment, key calculation parameters are first set for the numerical integration of the RKF method. The initial step size defines the starting "calculation interval" of the numerical integration (i.e., the initial discrete granularity of the dragging progress), and the error threshold defines the upper limit of acceptable calculation accuracy. The combined effect of the two is to enable the RKF method to dynamically adjust the step size in the iteration, which ensures both the accuracy of the dragging trajectory (not exceeding the error threshold) and the calculation efficiency (avoiding unnecessary fine-grained calculations), supporting the efficient and high-precision generation of intermediate dragging points.
[0081] For example, firstly, determine the initial step size, which should be reasonably set based on the dragging range of the geometric element, the complexity of the constraints, and the real-time requirements. For instance, for short-distance dragging of common two-dimensional geometric elements (such as line segments and circles), the initial step size can be set to 0.1 (corresponding to the unit interval of parametric coordinates, or the initial increment of the dragging progress t). If the dragging range is large and the constraints are simple, the step size can be appropriately increased (e.g., 0.2), while if the constraints are complex, the step size can be decreased (e.g., 0.05). This ensures that the initial calculation does not miss key trajectory details, nor does it lead to computational redundancy due to an excessively small step size. Secondly, set an error threshold, referring to the display accuracy and constraint compliance requirements of the CAD software, typically set to 10. - ³~10-4 The magnitude (e.g., 0.001 or 0.0001) corresponds to the upper limit of the difference between the 4th and 5th order precision solutions estimated in the RKF method. This ensures that the deviation between the calculated intermediate drag point and the theoretical trajectory is within an acceptable range, without any visible jitter or constraint violation. Finally, the initial step size and error threshold are used as input parameters of the RKF method and integrated into the numerical integration process. In subsequent iterations, the RKF method dynamically adjusts the step size by comparing the difference between the 4th and 5th order solution estimates calculated in each iteration with the error threshold (increasing the step size to improve efficiency if the difference is less than the threshold, and decreasing the step size to maintain accuracy if the difference is greater than the threshold), ultimately achieving a balance between accuracy and efficiency.
[0082] S502, numerical integration of the differential equation is performed based on the initial step size and error threshold to obtain multiple intermediate drag points that satisfy the first constraint condition.
[0083] In this embodiment, by combining a preset initial step size and error threshold, the differential equation is solved using adaptive numerical methods. Essentially, this discretizes the dynamic model describing the continuous and compliant movement of geometric elements into a series of specific and displayable position points (intermediate drag points). These points not only strictly satisfy the first constraint condition but can also be connected in a smooth trajectory. At the same time, the step size is dynamically adjusted to balance computational accuracy (without exceeding the error threshold) and efficiency (avoiding redundant calculations), providing core data support for subsequent calibration of the final position and the smooth dragging of geometric elements in CAD.
[0084] In simple terms, differential equations define "how geometric elements should move continuously," and the initial step size and error threshold define "the initial granularity and upper limit of accuracy of the calculation." This means that a specialized adaptive numerical method is used to break down continuous motion into compliant, non-jumping "landing points," ensuring that constraints are not violated while allowing geometric elements in CAD to move smoothly.
[0085] In the above method, by setting an initial step size and an error threshold, an adaptive numerical integration method is used to solve the differential equation, which can dynamically balance computational accuracy and efficiency, and quickly generate multiple intermediate drag points that strictly satisfy the first constraint condition, providing accurate and efficient node support for the subsequent construction of continuous and compliant drag trajectories.
[0086] In one embodiment, see Figure 6 This is a schematic diagram of the process for solving differential equations provided in the embodiments of this application. Figure 2 ,like Figure 6 As shown, step S502 includes: S601, construct the first Lagrangian function for the current initial position and differential equation.
[0087] In this embodiment, based on the mathematical properties of the RKF method, each iteration requires calculating the projection equation once when estimating solutions of different orders of precision. A complete integration process involves several iterations, therefore, the computational cost of the projection equation constitutes the largest proportion of the computational cost and also offers the most optimization potential. The projection equation can be written in the following form:
[0088]
[0089] Among them It is the Jacobian matrix of the constraint equation system. Construct the Lagrangian function of this projective equation system:
[0090] S602, Derive the second constraint condition corresponding to the first Lagrange function.
[0091] In this embodiment, starting from the first Lagrangian function, the key constraint condition of "ensuring that the projection vector falls in the kernel space of the Jacobian matrix" is derived. Essentially, the requirement that "the projection vector must meet the geometric constraints" is transformed into a mathematical condition (i.e., the second constraint condition) that must be satisfied when optimizing the Lagrangian function. This ensures that the projection vector obtained afterward is the optimal movement direction that "both matches the user's dragging intention and strictly complies with regulations", providing a reliable right-hand side term for the differential equation.
[0092] For example, since the projection equation only contains equality constraints, the second constraint condition can also be called the Karush-Kuhn-Tucker condition, which is equivalent to the optimal condition given by the Lagrange multiplier method, i.e., the Lagrange function with respect to the independent variable. The gradient must be zero and the constraints of the original problem must be satisfied:
[0093] S603, numerical integration is performed on the differential equation based on the first Lagrange function and its corresponding second constraint condition to obtain multiple intermediate drag points that satisfy the first constraint condition.
[0094] In this embodiment, the Lagrangian function and the second constraint (KKT condition) are combined to ensure compliance of the movement direction. Then, the differential equation is solved by numerical integration to obtain a single intermediate drag point that meets the first constraint. Essentially, the projection vector (the right-hand side of the differential equation, i.e., the instantaneous movement direction) that "both conforms to the user's intention and is compliant" is first accurately solved by the Lagrangian function and KKT condition. Then, based on this compliant direction, the differential equation is integrated once using the RKF method to iterate from the current initial position to obtain a specific position point that strictly meets the first constraint condition. This point serves as a key node on the drag trajectory, providing a foundation for the subsequent generation of a complete and smooth trajectory and calibration of the final position.
[0095] In the above method, by constructing a first Lagrangian function for the current initial position and the differential equation, deriving its corresponding second constraint condition, and then combining the two to perform numerical integration on the differential equation, the movement direction that meets the constraint can be accurately locked, and multiple intermediate drag points that satisfy the first constraint condition can be efficiently generated, laying a solid and reliable node foundation for the subsequent construction of a continuous and compliant drag trajectory.
[0096] In one embodiment, see Figure 7 This is a schematic diagram of the process for solving differential equations provided in the embodiments of this application. Figure 3 ,like Figure 7 As shown, step S603 includes: S701, Solve the system of equations consisting of the first Lagrangian function and the second constraint condition to obtain the projection direction corresponding to the current position.
[0097] In this embodiment, by solving the system of equations composed of the Lagrange function and the second constraint, a compliant movement direction that "both matches the user's dragging intention and strictly satisfies the geometric constraints" is accurately obtained. Essentially, the dual requirements of "minimizing the deviation of the projection direction and meeting the constraints" are transformed into a mathematical solution process that can be directly calculated. The final output projection direction will be used as the right-hand side of the differential equation to determine the instantaneous movement direction of the current position of the geometric element. This is a key step in achieving "constraint preservation" and "intent alignment".
[0098] For example, the system of equations consisting of the first Lagrange function and the second constraint can be solved using linear algebraic methods (such as matrix elimination, pseudo-inverse solving, etc.), i.e.:
[0099] Solving this system of equations yields a unique projection direction x, which falls within the Jacobian matrix kernel space (satisfying the constraints) and preserves the user's dragging intent to the greatest extent (minimizing projection deviation). This direction can be directly used as the compliant instantaneous movement direction corresponding to the current position, supporting the numerical integration calculation of the differential equations.
[0100] S702, determine the next step size corresponding to the initial step size based on the projection direction and error threshold.
[0101] In this embodiment, the step size of the numerical integration is dynamically adjusted based on the current compliant projection direction (instantaneous movement direction) and the preset error threshold. Essentially, the step size is adapted to the changing characteristics of the current dragging trajectory (e.g., if the trajectory is flat, the step size is increased to improve efficiency, and if it is drastic, the step size is reduced to maintain accuracy). This ensures that the intermediate dragging points calculated subsequently meet the accuracy requirements (error does not exceed the threshold) while also taking into account real-time performance, avoiding the waste of efficiency or insufficient accuracy caused by a fixed step size.
[0102] Define the core input parameters, including the currently calculated projection direction (reflecting the current trend and magnitude of trajectory changes) and the preset error threshold (the maximum acceptable calculation deviation, such as 10). - ³~10 -4 (Order of magnitude), and the RKF method was used to calculate solution estimates for fourth and fifth order precision:
[0103]
[0104] Where h is the integration step size chosen for a single integration. It is an estimate of the intermediate point calculated within the step size range. These are the estimated value weights set by the RKF method.
[0105] Then, the local truncation error is estimated by comparing the differences between the two:
[0106] Based on this, dynamically adjust the next integration step size:
[0107] in It is a pre-set acceptable tolerance.
[0108] S703 calculates the next drag point corresponding to the current initial position based on the current initial position and the next step length.
[0109] In this embodiment, based on the current initial position and the adaptively adjusted step size, the next specific position point on the dragging trajectory is calculated by numerical integration. Essentially, it combines "compliant instantaneous movement direction (projection vector)" and "step size that adapts to accuracy and efficiency" to iterate from the current position to the next intermediate dragging point that strictly meets the constraints, gradually building a complete and smooth dragging trajectory, and providing continuous node support for the final accurate positioning of the target point.
[0110] Specifically, the parameter vector of the current initial position (such as the coordinates of geometric elements, core size parameters, etc.) is clearly defined, along with the compliant projection direction (the right-hand side of the differential equation, i.e., the instantaneous rate of change of the position parameters over time) determined through the previous steps, and the next step length after adaptive adjustment. Secondly, based on the numerical integration formula of the RKF method, the current initial position parameters, projection direction, and step length are substituted into the calculation. Through the combination of 4th and 5th order precision solutions built into the method, the increment of the position parameters (i.e., the parameter change from the current position to the next dragging point) is obtained. Finally, this parameter increment is added to the current initial position parameters to obtain the parameterized expression of the next dragging point (such as coordinate values, size values, etc.). This dragging point strictly satisfies the first constraint condition and all preset geometric constraints, maintains a continuous and smooth motion relationship with the current initial position, and because the step length has been adaptively adjusted according to the error threshold, it balances computational accuracy and efficiency. It can be directly used as the initial position for the next iteration, continuously generating subsequent dragging points to construct a complete trajectory.
[0111] In the above method, the Lagrangian function based on the second constraint is used to obtain the compliant projection direction of the current position. The next step length for adapting accuracy and efficiency is determined by combining the error threshold. Then, the next dragging point is calculated based on the current initial position and the step length. This iterative process realizes the numerical integration of the differential equation and efficiently generates multiple intermediate dragging points that strictly satisfy the first constraint. This provides accurate and efficient node support for constructing a constraint-compliant, smooth and continuous dragging trajectory.
[0112] S105, substitute multiple intermediate drag points into the target equation to obtain the drag trajectory of the user dragging the geometric element to the target point.
[0113] In this application, after successfully solving the initial value problem of the differential equation, we obtained a dragging point that approximates the constraint surface through numerical integration. Substituting the original optimization equations, we can then use numerical methods such as the Newton-Raphson iteration method or the trust region method to obtain an exact solution on the constrained surface. The trajectory on the constrained surface, composed of a series of precise solutions, is the final drag trajectory.
[0114] See Figure 8 This is a schematic diagram of the smooth drag positioning structure in the geometric constraint engine provided in the embodiments of this application, as shown below. Figure 8 As shown, it specifically includes: Core components (three-layer architecture from top to bottom) This diagram clarifies the core position of the "smooth drag solver" in the geometric constraint engine of the CAD system, and shows the hierarchical relationship from the system layer to the engine kernel layer. The functions and components of each layer are as follows: CAD Platform Layer (Top Application Layer): Core components: direct editing modeling, feature modeling, geometric modeling engine, geometric constraint engine (including the smooth drag solver of this invention), and Boolean operations.
[0115] Function: For specific modeling functions in CAD systems, the smooth drag solver is a key sub-component of the "geometric constraint engine," providing underlying support for drag-and-drop interactions in various modeling operations.
[0116] Engine kernel layer (intermediate core layer): Core components: intersection calculation, geometry management, constraint solving (including smooth drag solving), and state analysis.
[0117] Function: It undertakes the application requirements of the platform layer, realizes the core functions through the underlying geometry and constraint operations, and the core calculations (projection and differential equation solving) of the solver are all completed in this layer.
[0118] System layer (underlying support layer): Core components: resource manager, operating system interface, and file system interface.
[0119] Function: Provides basic resources and system interaction support for the upper-level engine and platform, ensuring the real-time performance and stability of the smooth dragging process.
[0120] See Figure 9 This is a schematic diagram of the overall process of the geometric element dragging method based on differential equations provided in the embodiments of this application, specifically as follows: 1. Input Phase (Process Start Point): Core node: Drag to start → Get starting point ,end Constraint equations .
[0121] Function: To clarify the basic input information for drag operations, including the initial position of geometric elements, the target position expected by the user, and the geometric constraints that must be followed (such as parallelism, fixed distance, etc.).
[0122] 2. Modeling Stage (Core Transformation Steps): Core Node 1: Constructing the system of optimization equations (objective function: Constraints: .
[0123] Purpose: To transform the "user drag-and-drop requirement" into a mathematical optimization problem, and to clarify the objective of "minimizing the drag distance" and the rules of "satisfying geometric constraints".
[0124] Core Node 2: Constructing the Initial Value Problem for Differential Equations ( Initial conditions: .
[0125] Function: Transforms static optimization problems into dynamic evolution problems by "projecting the dragging direction onto the Jacobian matrix kernel space" to ensure that the movement direction is compliant.
[0126] 3. Solving the projection equation (key supporting step): Core node: Constructing the projection equation ( , → Construct the Lagrangian function → Solve the KKT conditions → Obtain the least squares solution of the projection equation (compliant projection direction).
[0127] Function: Providing a "compliant direction of movement" for solving differential equations is a core step to ensure that constraints are not violated and must be performed in each iteration of the integral of the differential equation.
[0128] 4. Differential Equation Solving Stage (Core of Trajectory Generation): Core nodes: Solve differential equations using the RKF method → Calculate 4th and 5th order accurate solution estimates → Calculate the difference between solution estimates and adjust the integration step size (based on the error threshold) → Obtain the numerical solution of the differential equation (intermediate drag point).
[0129] Function: By using numerical integration with adaptive step size, a series of intermediate drag points that strictly satisfy the constraints are generated, balancing solution accuracy and efficiency.
[0130] 5. Final solution solving and output stage (process endpoint): Core steps: Substitute the intermediate drag point into the original optimization equation system → solve using Newton's iteration method / trust region method → obtain the accurate drag point → connect them to form a smooth drag trajectory on the constraint surface → dragging ends.
[0131] Function: By using "intermediate point + iterative optimization", a high-precision final position is obtained, ensuring the smoothness and accuracy of the dragging trajectory.
[0132] It should be understood that the sequence number of each step in the above embodiments does not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this application.
[0133] Corresponding to the differential equation-based geometric element dragging method in the above embodiment, Figure 10 This is a structural block diagram of a geometric element dragging device based on differential equations provided in the embodiments of this application. For ease of explanation, only the parts related to the embodiments of this application are shown.
[0134] Reference Figure 10 The device includes: The data acquisition module 101 is used to acquire the starting point, target point, and first constraint conditions corresponding to the geometric elements of the user's drag operation. The objective equation construction module 102 is used to construct the objective equation based on the starting point, the target point, and the first constraint condition. Differential equation construction module 103 is used to construct differential equations based on the objective equation; The drag point solving module 104 is used to solve the differential equation and obtain multiple intermediate drag points that satisfy the first constraint condition. The drag trajectory generation module 105 is used to substitute multiple intermediate drag points into the target equation to obtain the drag trajectory of the user dragging the geometric element to the target point.
[0135] Optionally, the objective equation construction module 102 is also used for: Calculate the drag distance between the target point and the starting point; Establish a system of constraint equations based on the constraints; Based on the set of constraint equations, construct the objective equation with the goal of minimizing the drag distance.
[0136] Optionally, the differential equation building module 103 is also used for: Calculate the drag direction vector of the user's drag operation based on the target point and the starting point; Calculate the Jacobian matrix corresponding to the objective equation; Construct a differential equation based on the drag direction vector and the Jacobian matrix.
[0137] Optionally, the differential equation building module 103 is also used for: The kernel space is determined based on the Jacobian matrix; whereby the kernel space represents the set of safe directions that meet the constraints. Projecting the drag direction vector onto the kernel space yields a projection vector of the drag direction vector based on the kernel space. The projection vector is defined as the instantaneous rate of change of the position parameter over time, resulting in a differential equation.
[0138] Optionally, the drag point solver module 104 is also used for: Set the initial step size and error threshold; Numerical integration of the differential equation is performed based on the initial step size and error threshold to obtain multiple intermediate drag points that satisfy the first constraint condition.
[0139] Optionally, the drag point solver module 104 is also used for: Construct the first Lagrangian function for the current initial position and the differential equation; Derive the second constraint condition corresponding to the first Lagrange function; Numerical integration of the differential equation is performed based on the first Lagrange function and its corresponding second constraint to obtain multiple intermediate drag points that satisfy the first constraint.
[0140] Optionally, the drag point solver module 104 is also used for: Solve the system of equations consisting of the first Lagrange function and the second constraint to obtain the projection direction corresponding to the current position; The next step size corresponding to the initial step size is determined based on the projection direction and the error threshold. Calculate the next drag point corresponding to the current initial position based on the current initial position and the next step length.
[0141] It should be noted that the information interaction and execution process between the above-mentioned devices / units are based on the same concept as the method embodiments of this application. For details on their specific functions and technical effects, please refer to the method embodiments section, and they will not be repeated here.
[0142] in addition, Figure 10 The geometric element dragging device based on differential equations shown can be a software unit, hardware unit, or a combination of software and hardware built into existing terminal devices. It can also be integrated into the terminal device as an independent accessory, or exist as an independent terminal device.
[0143] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the above-described division of functional units and modules is merely an example. In practical applications, the above functions can be assigned to different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiments can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit. Furthermore, the specific names of the functional units and modules are only for easy differentiation and are not intended to limit the scope of protection of this application. The specific working process of the units and modules in the above system can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.
[0144] Figure 11 This is a schematic diagram of the structure of the terminal device provided in the embodiments of this application. For example... Figure 11 As shown, the terminal device 11 of this embodiment includes: at least one processor 110 ( Figure 11(Only one is shown in the diagram) a processor, a memory 111, and a computer program 112 stored in the memory 111 and executable on at least one processor 110. When the processor 110 executes the computer program 112, it implements the steps in any of the above embodiments of the differential equation-based geometric element dragging method.
[0145] The terminal device can be a computing device such as a desktop computer, laptop, handheld computer, or cloud server. This terminal device may include, but is not limited to, a processor and memory. Those skilled in the art will understand that... Figure 11 This is merely an example of terminal device 11 and does not constitute a limitation on terminal device 11. It may include more or fewer components than shown, or combine certain components, or different components, such as input / output devices, network access devices, etc.
[0146] The processor 110 may be a Central Processing Unit (CPU), or it may be other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor.
[0147] In some embodiments, memory 111 may be an internal storage unit of terminal device 11, such as a hard disk or memory of terminal device 11. In other embodiments, memory 111 may be an external storage device of terminal device 11, such as a plug-in hard disk, smart media card (SMC), secure digital card (SD) card, flash card, etc., equipped on terminal device 11. Furthermore, memory 111 may include both internal storage units and external storage devices of terminal device 11. Memory 111 is used to store operating system, application programs, boot loader, data, and other programs, such as program code of computer programs. Memory 111 can also be used to temporarily store data that has been output or will be output.
[0148] This application also provides a computer-readable storage medium storing a computer program, which, when executed by a processor, can implement the steps in the above-described method embodiments.
[0149] This application provides a computer program product that, when run on a terminal device, enables the terminal device to implement the steps described in the various method embodiments above.
[0150] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, all or part of the processes in the methods of the above embodiments of this application can be implemented by a computer program instructing related hardware. The computer program can be stored in a computer-readable storage medium, and when executed by a processor, it can implement the steps of the various method embodiments described above. The computer program includes computer program code, which can be in the form of source code, object code, executable files, or certain intermediate forms. A computer-readable medium can include at least: any entity or device capable of carrying computer program code to a device / terminal equipment, a recording medium, a computer memory, a read-only memory (ROM), a random access memory (RAM), an electrical carrier signal, a telecommunication signal, and a software distribution medium. Examples include USB flash drives, portable hard drives, magnetic disks, or optical disks. In some jurisdictions, according to legislation and patent practice, computer-readable media cannot be electrical carrier signals or telecommunication signals.
[0151] In the above embodiments, the descriptions of each embodiment have different focuses. For parts that are not described in detail or recorded in a certain embodiment, please refer to the relevant descriptions of other embodiments.
[0152] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0153] In the embodiments provided in this application, it should be understood that the disclosed apparatus / terminal devices and methods can be implemented in other ways. For example, the apparatus / terminal device embodiments described above are merely illustrative. For instance, the division of modules or units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between devices or units may be electrical, mechanical, or other forms.
[0154] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0155] The above embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application, and should all be included within the protection scope of this application.
Claims
1. A method for differential equation based geometric element dragging, characterized in that, The method includes: Obtain the starting point, target point, and first constraint conditions corresponding to the geometric elements of the user's drag operation; Construct the objective equation based on the starting point, the target point, and the first constraint condition; Construct a differential equation based on the objective equation; Solving the differential equation yields multiple intermediate drag points that satisfy the first constraint condition; Substituting the multiple intermediate drag points into the target equation, the drag trajectory of the user dragging the geometric element to the target point is obtained.
2. The differential equation based geometric element dragging method of claim 1, wherein, The step of constructing the objective equation based on the starting point, the target point, and the first constraint includes: Calculate the drag distance between the target point and the starting point; Establish a system of constraint equations based on the aforementioned constraints; The objective equation is constructed based on the set of constraint equations and with the goal of minimizing the drag distance.
3. The differential equation based geometric element dragging method of claim 2, wherein, The step of constructing the differential equation based on the objective equation includes: Calculate the drag direction vector of the user drag operation based on the target point and the starting point; Calculate the Jacobian matrix corresponding to the objective equation; The differential equation is constructed based on the drag direction vector and the Jacobian matrix.
4. The differential equation based geometric element dragging method of claim 3, wherein, The step of constructing the differential equation based on the drag direction vector and the Jacobian matrix includes: The kernel space is determined based on the Jacobian matrix; wherein the kernel space is used to represent the set of safe directions that meet the constraints. Projecting the drag direction vector onto the kernel space yields a projection vector of the drag direction vector based on the kernel space. The projection vector is defined as the instantaneous rate of change of the position parameter over time, thus yielding the differential equation.
5. The differential equation based geometric element dragging method of claim 4, wherein, Solving the differential equation yields multiple intermediate drag points that satisfy the first constraint condition, including: Set the initial step size and error threshold; Numerical integration is performed on the differential equation based on the initial step size and the error threshold to obtain multiple intermediate drag points that satisfy the first constraint condition.
6. The differential equation based geometric element dragging method of claim 5, wherein, Numerical integration of the differential equation based on the initial step size and the error threshold yields multiple intermediate drag points that satisfy the first constraint condition, including: Construct a first Lagrange function for the current initial position and the differential equation; Derive the second constraint condition corresponding to the first Lagrange function; Numerical integration of the differential equation is performed based on the first Lagrange function and its corresponding second constraint to obtain multiple intermediate drag points that satisfy the first constraint.
7. The differential equation based geometric element dragging method of claim 6, wherein, The step of numerically integrating the differential equation based on the first Lagrange function and the second constraint to obtain multiple intermediate drag points satisfying the first constraint includes: Solve the system of equations consisting of the first Lagrange function and the second constraint to obtain the projection direction corresponding to the current position; The next step size corresponding to the initial step size is determined based on the projection direction and the error threshold. Calculate the next drag point corresponding to the current initial position based on the current initial position and the next step length.
8. A differential equation based geometry element dragging apparatus, characterized by, include: The data acquisition module is used to acquire the starting point, target point, and first constraint conditions corresponding to the geometric elements of the user's drag operation. The objective equation construction module is used to construct an objective equation based on the starting point, the target point, and the first constraint condition. A differential equation construction module is used to construct differential equations based on the target equation; The drag point solving module is used to solve the differential equation to obtain multiple intermediate drag points that satisfy the first constraint condition. The drag trajectory generation module is used to substitute multiple intermediate drag points into the target equation to obtain the drag trajectory of the user dragging the geometric element to the target point.
9. A terminal device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the method as described in any one of claims 1 to 7.
10. A computer-readable storage medium storing a computer program, the computer program comprising instructions that, when executed by a computer, cause the computer to perform the method of any one of claims 1 to 9. When the computer program is executed by a processor, it implements the method as described in any one of claims 1 to 7.