Two-dimensional curve rounding method, device and equipment based on CAD (Computer Aided Design), medium and product

By establishing local coordinate systems in the CAD model design and using homogeneous transformation matrix transformation curves, the problem of complex and low efficiency of two-dimensional curve rounding is solved, and a more efficient and accurate rounding design is achieved, which improves the product appearance and functionality.

CN119442361APending Publication Date: 2025-02-14NEW DIMENSION SYST
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411483368.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-23
Publication Date
2025-02-14

Smart Images

  • Figure CN119442361A_ABST
    Figure CN119442361A_ABST
Patent Text Reader

Abstract

The invention discloses a two-dimensional curve rounding method and device based on CAD, equipment, a medium and a product, and relates to the field of CAD modeling, the method comprises the following steps: obtaining a first curve and a second curve to be chamfered, and establishing a local coordinate system based on the first curve and the second curve; obtaining a global-to-local coordinate system homogeneous transformation matrix based on the local coordinate system; transforming the first curve and the second curve in the global coordinate system to a first standard curve and a second standard curve in a local coordinate system based on the global-to-local coordinate system homogeneous transformation matrix; determining a first circle center coordinate of a fillet in the local coordinate system; determining a first starting point and a first ending point of a fillet in the local coordinate system; converting a first circle center coordinate, a first starting point and a first ending point of a fillet in the local coordinate system into a second circle center coordinate, a second starting point and a second ending point in the global coordinate system based on the local-to-global coordinate system homogeneous conversion matrix, and determining the fillet through the second circle center coordinate, the second starting point and the second ending point, according to the method, the efficiency of two-dimensional curve rounding solving can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of CAD modeling, and in particular to a CAD-based two-dimensional curve filleting method, device, equipment, medium and product. Background Art

[0002] In modern manufacturing, CAD models are the core of product design, engineering analysis and manufacturing processes. Their accuracy and efficiency are directly related to product quality and production efficiency. As a key link in CAD model design, 2D curve fillet processing not only affects the appearance of the product, but is also directly related to the functionality and durability of the product.

[0003] In two-dimensional space, curves can be described by a variety of mathematical expressions, including but not limited to polynomial functions, trigonometric functions, and piecewise functions. Each curve has its own unique properties and morphology, which have different effects on solving the fillet equation. In addition, the introduction of the mouse point, as a key part of user interaction, the accuracy of its position and the rationality of its selection are directly related to the quality of the final result. When it is necessary to solve the fillet equation on a two-dimensional curve, it is first necessary to determine the geometric relationship between the curve equation and the mouse point. This usually involves the tangent or normal relationship between a point (or multiple points) on the curve and an arc of a specific radius centered at the mouse point. These relationships form the basis of the system of equations, and the order of the system of equations depends on the complexity of the curve and the chosen solution strategy.

[0004] However, for complex or non-standard curves, such as high-order polynomial curves, Bezier curves or parametric curves, their equations often contain multiple variables and complex mathematical expressions. In the solution process, it is necessary to establish a set of equations containing these variables and expressions and solve them through numerical methods or symbolic calculations. This process is not only cumbersome, but also affects the efficiency and accuracy of the solution. Summary of the invention

[0005] The purpose of this application is to provide a CAD-based two-dimensional curve filleting method, device, equipment, medium and product, which can improve the efficiency and accuracy of two-dimensional curve filleting solution.

[0006] To achieve the above objectives, this application provides the following solutions:

[0007] In a first aspect, the present application provides a CAD-based two-dimensional curve filleting method, comprising:

[0008] Acquire a first curve and a second curve to be rounded, wherein the first curve and the second curve are two-dimensional curves, the first curve and the second curve are located in a global coordinate system, and the first curve and the second curve are each one of a conic curve, a straight line, and a spline curve;

[0009] Establishing a local coordinate system based on the first curve and the second curve;

[0010] Based on the local coordinate system, a global-to-local coordinate system homogeneous transformation matrix is ​​obtained;

[0011] transforming the first curve and the second curve in the global coordinate system into a first standard curve and a second standard curve in the local coordinate system based on the global-to-local coordinate system homogeneous transformation matrix;

[0012] Calculating a reference point set of the first standard curve and the second standard curve;

[0013] Obtain a mouse point, and mark the point in the reference point set that is closest to the mouse point as a reference point;

[0014] Determine a first center of the rounded corner in the local coordinate system based on the mouse point coordinates, the first standard curve, and the second standard curve;

[0015] Based on the first circle center coordinates, determining a first starting point and a first ending point of the rounded corner in the local coordinate system;

[0016] Based on the local to global coordinate system homogeneous transformation matrix, the first center coordinates, the first starting point and the first ending point of the chamfer in the local coordinate system are converted into the second center coordinates, the second starting point and the second ending point in the global coordinate system, and the chamfer is determined by the second center coordinates, the second starting point and the second ending point in the global coordinate system. The chamfer is used to connect the first curve and the second curve to form a transition.

[0017] In a second aspect, the present application provides a two-dimensional curve fillet optimization device based on a CAD model, comprising:

[0018] A first acquisition module is used to acquire a first curve and a second curve to be rounded, wherein the first curve and the second curve are two-dimensional curves, the first curve and the second curve are located in a global coordinate system, and the first curve and the second curve are each one of a conic curve, a straight line, and a spline curve;

[0019] An establishing module, configured to establish a local coordinate system based on the first curve and the second curve;

[0020] A second acquisition module is used to obtain a global-to-local coordinate system homogeneous transformation matrix based on the local coordinate system;

[0021] A transformation module, configured to transform the first curve and the second curve in the global coordinate system into a first standard curve and a second standard curve in the local coordinate system based on the global-to-local coordinate system homogeneous transformation matrix;

[0022] A calculation module, used for calculating a reference point set of the first standard curve and the second standard curve;

[0023] A marking module, used for obtaining the coordinates of a mouse point, and marking the point in the reference point set closest to the mouse point as a reference point;

[0024] A first determination module, configured to determine first center coordinates of a rounded corner in the local coordinate system based on the mouse point coordinates, the first standard curve, and the second standard curve;

[0025] A second determination module, configured to determine a first starting point and a first ending point of the rounded corner in the local coordinate system based on the first circle center coordinates;

[0026] A conversion module is used to convert the first center coordinates, the first starting point and the first ending point of the chamfer in the local coordinate system into the second center coordinates, the second starting point and the second ending point in the global coordinate system based on the local to global coordinate system homogeneous conversion matrix, and determine the chamfers of the first curve and the second curve through the second center coordinates, the second starting point and the second ending point in the global coordinate system.

[0027] In a third aspect, the present application provides a computer device comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the steps of any one of the above-mentioned two-dimensional curve chamfer optimization methods based on a CAD model.

[0028] In a fourth aspect, the present application provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of any one of the above-mentioned two-dimensional curve chamfer optimization methods based on a CAD model.

[0029] In a fifth aspect, the present application provides a computer program product, including a computer program, which, when executed by a processor, implements the steps of any one of the above-mentioned two-dimensional curve chamfer optimization methods based on a CAD model.

[0030] According to the specific embodiments provided in this application, this application discloses the following technical effects:

[0031] The present application provides a two-dimensional curve chamfer optimization method and device based on a CAD model, by obtaining a first curve and a second curve to be chamfered, wherein the first curve and the second curve belong to two-dimensional curves, the first curve and the second curve are located in a global coordinate system, and the first curve and the second curve are each one of a conic curve, a straight line and a spline curve. A local coordinate system is established based on the first curve and the second curve obtained. A global to local coordinate system homogeneous transformation matrix is ​​obtained based on the local coordinate system. The global to local coordinate system homogeneous transformation matrix is ​​used to transform the first curve and the second curve located in the global coordinate system to a first standard curve and a second standard curve in the local coordinate system. A reference point set of the first standard curve and the second standard curve is calculated. The coordinates of a mouse point are obtained, and the point closest to the mouse point in the reference point set is marked as a reference point. Based on the coordinates of the mouse point, the first standard curve and the second standard curve, the first center coordinates of the chamfered corner in the local coordinate system are determined. Based on the first center coordinates, a first starting point and a first ending point of the chamfered corner in the local coordinate system are determined. Based on the local to global coordinate system homogeneous transformation matrix, the first center coordinates, the first starting point and the first end point of the chamfer in the local coordinate system are transformed into the second center coordinates, the second starting point and the second end point in the global coordinate system, and the chamfers of the first curve and the second curve are determined by the second center coordinates, the second starting point and the second end point in the global coordinate system. The above method simplifies the chamfer solution process and improves the efficiency and accuracy of the solution. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0033] Figure 1 This is an application environment diagram of a two-dimensional curve fillet optimization method based on a CAD model in an embodiment of the present application;

[0034] Figure 2 A schematic diagram of a flow chart of a two-dimensional curve fillet optimization method based on a CAD model provided in one embodiment of the present application;

[0035] Figure 3 A schematic diagram of functional modules of a two-dimensional curve chamfer optimization device based on a CAD model provided in one embodiment of the present application;

[0036] Figure 4 A schematic diagram of the structure of a computer device provided in one embodiment of the present application. DETAILED DESCRIPTION

[0037] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0038] In order to make the above-mentioned objects, features and advantages of the present application more obvious and easy to understand, the present application is further described in detail below with reference to the accompanying drawings and specific implementation methods.

[0039] The CAD-based two-dimensional curve rounding method provided in the embodiment of the present application can be applied to Figure 1 In the application environment shown. Among them, the terminal 102 communicates with the server 104 through the network. The data storage system can store the data that the server 104 needs to process. The data storage system can be set up separately, or it can be integrated on the server 104, or it can be placed on the cloud or other servers. The terminal 102 can send the acquired first curve and second curve to be rounded to the server 104. After the server 104 receives the first curve and second curve to be rounded, for the first curve and second curve to be processed, the server 104 establishes a local coordinate system based on the first curve and the second curve, obtains a global to local coordinate system homogeneous transformation matrix based on the local coordinate system, and transforms the first curve and the second curve in the global coordinate system to the first standard curve and the second standard curve in the local coordinate system based on the global to local coordinate system homogeneous transformation matrix. Then, the reference point set of the first standard curve and the second standard curve is calculated, the coordinates of the mouse point are obtained, and the point closest to the mouse point in the reference point set is marked as the reference point. Based on the coordinates of the mouse point, the first standard curve and the second standard curve, the first center coordinates of the rounded corner in the local coordinate system are determined. Based on the first center coordinates, the first starting point and the first ending point of the rounded corner in the local coordinate system are determined. Based on the local to global coordinate system homogeneous conversion matrix, the first center coordinates, the first starting point and the first ending point of the rounded corner in the local coordinate system are converted to the second center coordinates, the second starting point and the second ending point in the global coordinate system. The rounded corners of the first curve and the second curve are determined by the second center coordinates, the second starting point and the second ending point in the global coordinate system. The server 104 can feed back the obtained rounded corners of the first curve and the second curve to the terminal 102. In addition, in some embodiments, the CAD-based two-dimensional curve chamfering method can also be implemented independently by the server 104 or the terminal 102. For example, the terminal 102 can directly process the first curve and the second curve to be processed, or the server 104 can obtain the first curve and the second curve to be processed from the data storage system and process the first curve and the second curve to be processed.

[0040] The terminal 102 may be, but is not limited to, various desktop computers, laptop computers, smart phones, tablet computers, IoT devices, and portable wearable devices. The IoT devices may be smart speakers, smart TVs, smart air conditioners, smart vehicle-mounted devices, etc. The portable wearable devices may be smart watches, smart bracelets, head-mounted devices, etc. The server 104 may be implemented as an independent server or a server cluster consisting of multiple servers, or may be a cloud server.

[0041] In an exemplary embodiment, Figure 2 As shown, a CAD-based two-dimensional curve filleting method is provided. The method is executed by a computer device, and can be executed by a computer device such as a terminal or a server alone, or by a terminal and a server together. In the embodiment of the present application, the method is applied to Figure 1 The server 104 in the example is used as an example to illustrate the method, which includes the following steps 201 to 209. Among them:

[0042] Step 201, obtaining a first curve and a second curve to be rounded, wherein the first curve and the second curve are two-dimensional curves, the first curve and the second curve are located in a global coordinate system, and the first curve and the second curve are each one of a conic curve, a straight line and a spline curve.

[0043] Step 202: Establish a local coordinate system based on the first curve and the second curve.

[0044] Step 203: Obtain a global-to-local coordinate system homogeneous transformation matrix based on the local coordinate system.

[0045] Step 204 : transforming the first curve and the second curve in the global coordinate system into the first standard curve and the second standard curve in the local coordinate system based on the global to local coordinate system homogeneous transformation matrix.

[0046] Step 205: Calculate the reference point sets of the first standard curve and the second standard curve.

[0047] Step 206, obtaining the mouse point, and marking the point in the reference point set that is closest to the mouse point as the reference point.

[0048] Step 207: Determine a first center of the rounded corner in the local coordinate system based on the mouse point coordinates, the first standard curve, and the second standard curve.

[0049] Step 208: Determine a first starting point and a first ending point of the rounded corner in the local coordinate system based on the first circle center coordinates.

[0050] Step 209, based on the local to global coordinate system homogeneous transformation matrix, the first center coordinates, the first starting point and the first ending point of the chamfer in the local coordinate system are converted into the second center coordinates, the second starting point and the second ending point in the global coordinate system, and the chamfers of the first curve and the second curve are determined by the second center coordinates, the second starting point and the second ending point in the global coordinate system. The chamfers are used to connect the first curve and the second curve to form a transition.

[0051] Specifically, the specific forms of the "first curve and the second curve to be rounded" must first be clarified. These two curves, as geometric elements in two-dimensional space, can be conic curves (such as ellipses, hyperbolas), straight lines, or free-form spline curves. In the global coordinate system, they not only define the boundaries of the figure, but also determine the basis for the rounding operation. In order to understand more intuitively, this embodiment provides a scenario: in CAD (computer-aided design) software, the user draws a figure formed by the intersection of an ellipse and a straight line, and needs to add smooth fillets at these two intersections. At this time, the ellipse is the first curve and the straight line is the second curve. The global to local coordinate system homogeneous transformation matrix can accurately map the curve located in the global coordinate system to the local coordinate system to achieve a smooth transition of the coordinate system. The global to local coordinate system homogeneous transformation matrix contains information on geometric transformations such as translation and rotation. In the local coordinate system, the first curve and the second curve are converted into a first standard curve and a second standard curve. This conversion process is essentially a normalization of the curve morphology.

[0052] It can be understood that as a set of intersection points of the first standard curve and the second standard curve, its calculation accuracy directly affects the final effect of the rounded corner. Based on the coordinates of the mouse point, the shape and position relationship of the first standard curve and the second standard curve, the first center coordinates of the rounded corner in the local coordinate system are determined. Once the center coordinates are determined, the starting point and the ending point of the rounded corner can be obtained based on the point and the shape of the first standard curve and the second standard curve. The determination of the first center coordinates, the starting point and the ending point of the rounded corner not only limits the range of the rounded corner, but also determines the specific shape and size of the rounded corner. Through the local to global coordinate system homogeneous transformation matrix, the center coordinates, starting point and ending point of the rounded corner in the local coordinate system are converted back to the global coordinate system to obtain the second center coordinates, the second starting point and the second ending point. The rounded corner is determined by the positioning of these three points in the global coordinate system. The design of the rounded corner smoothly connects the first curve and the second curve visually and structurally, and in this way, a natural transition between the two curves is achieved.

[0053] In another exemplary embodiment of the present application, the above step 202 is replaced by the following steps 2021 to 2026:

[0054] Step 2021, determining whether the first curve and the second curve contain a feature center;

[0055] Step 2022, if both the first curve and the second curve contain a feature center, determining the reference priority of the first curve and the second curve;

[0056] Step 2023: if the first curve and the second curve have different reference priorities, the characteristic center of the two-dimensional curve with a higher reference priority among the first curve and the second curve is determined as the origin, a line connecting the characteristic center of the other two-dimensional curve and the origin is used as the first coordinate axis, a normalized vector of the first coordinate axis is determined based on the first coordinate axis, a normalized vector of the second coordinate axis is determined based on the normalized vector of the first coordinate axis, and a local coordinate system is established based on the normalized vector of the first coordinate axis, the origin, and the normalized vector of the second coordinate axis;

[0057] Step 2024: if the first curve and the second curve have the same reference priority, the characteristic center of any two-dimensional curve is determined as the origin, the line connecting the characteristic center of the other two-dimensional curve and the origin is used as the first coordinate axis, the normalized vector of the first coordinate axis is determined based on the first coordinate axis, the normalized vector of the second coordinate axis is determined based on the normalized vector of the first coordinate axis, and a local coordinate system is established based on the normalized vector of the first coordinate axis, the origin, and the normalized vector of the second coordinate axis;

[0058] Step 2025, if only one of the first curve and the second curve contains the characteristic center, the characteristic axis of the two-dimensional curve containing the characteristic center is used as the first coordinate axis, any point on the first coordinate axis is determined as the origin, the normalized vector of the first coordinate axis is determined based on the first coordinate axis, the normalized vector of the second coordinate axis is determined based on the normalized vector of the first coordinate axis, and a local coordinate system is established based on the normalized vector of the first coordinate axis, the origin, and the normalized vector of the second coordinate axis;

[0059] Step 2026: If neither the first curve nor the second curve contains a feature center, the first curve and the second curve cannot be rounded.

[0060] Specifically, the benchmark priority is reduced in the order of conic section, straight line and spline curve. Conic section has characteristic axis and characteristic center, the straight line itself is the characteristic axis, and the points on the straight line are all characteristic centers, while spline curve has no characteristic axis and characteristic center.

[0061] In another exemplary embodiment of the present application, the above step 205 is replaced by the following steps 2051 to 2054:

[0062] Step 2051, storing the intersection of the first standard curve and the second standard curve into a reference point set;

[0063] Step 2052, when the number of intersection points in the reference point set is zero, calculate the two closest points on the first standard curve and the second standard curve, and store the midpoint of the line connecting the two closest points on the first standard curve and the second standard curve in the reference point set;

[0064] Step 2053, storing the characteristic center of the first standard curve and the midpoint of the characteristic center of the second standard curve into the reference point set;

[0065] Step 2054: store the point on the second standard curve closest to the characteristic center of the first standard curve and the midpoint of the characteristic center of the first standard curve into the reference point set. Calculate the closest point on the second standard curve by Lagrange multiplier method.

[0066] Specifically, the intersection points between the first standard curve and the second standard curve are calculated, and these intersection points are recorded in a specific reference point set P. When the two standard curves do not have an intersection point, the two closest points on the first standard curve and the second standard curve are calculated, and the midpoint of the two points is stored in the reference point set P.

[0067] You can choose to use the Lagrange multiplier method with the equations of the two curves as constraints, and the distance between the points on the two curves as the objective function, so that the points on the two curves when the objective function is minimum are the two closest points on the two curves, and the midpoint of the two points is stored in the reference point set as a virtual intersection. By storing the midpoint of the characteristic center of the first standard curve and the characteristic center of the second standard curve in the reference point set, it is equivalent to constructing a virtual intersection that combines the characteristics of the two curves. Find the point closest to the characteristic center of the first standard curve on the second standard curve, and store this point and the midpoint of the characteristic center of the first standard curve in the reference point set. The Lagrange multiplier method is a method for solving the extreme value of a function under given constraints, and is used to find the point closest to the characteristic center of the first standard curve in the parameter space of the second standard curve. With the parameter equation of the second standard curve as a constraint, the distance between the characteristic center of the first standard curve and the point on the second standard curve is the objective function, so that the point on the second standard curve when the objective function is minimum is the two closest points on the two curves.

[0068] In another exemplary embodiment of the present application, the above step 207 is replaced by the following steps 2071 to 2074:

[0069] Step 2071, marking the distance between the mouse point and the first center of the circle as L1, marking the distance between the first standard curve and the first center of the circle as L2, and marking the distance between the second standard curve and the first center of the circle as L3;

[0070] Step 2072, based on L1=L2=L3, calculate the coordinates of the center of the first circle;

[0071] Step 2073, when the number of first circle centers is zero, the mouse point cannot be chamfered in the area where it is located. When the number of first circle centers is two, the first circle center farthest from the reference point is marked as the first circle center of the chamfer in the local coordinate system.

[0072] Specifically, in most graphical user interface (GUI) environments, the mouse point coordinates refer to the specific position of the current mouse pointer on the screen, usually in pixels, and are determined by the horizontal coordinate (X axis) and the vertical coordinate (Y axis). In actual operation, the mouse point coordinates can also be obtained by directly inputting the horizontal coordinate and the vertical coordinate. Calculate the distance between the mouse point and each point in the reference point set P, and find the point with the smallest distance. For example, the straight-line distance between two points is calculated in two-dimensional space by using the Euclidean distance. By using search algorithms, such as KD tree (K-dimensional tree) or R tree (R-tree) and other data structures to organize the reference point set P, it is possible to quickly locate the point set that is closer to the mouse point, and perform precise searches within this range.

[0073] It should be noted that considering the jitter of the mouse point coordinates, due to the instability of user operations, the mouse point coordinates may change slightly in a short period of time, which may lead to frequent switching of the reference point, thereby affecting the rounding of the 2D curve. It is necessary to set a tolerance range (tolerance), and recalculate the reference point only when the mouse point moves to a certain distance.

[0074] It can be understood that the mouse point coordinates are marked as M(x 0 ,y 0 ), mark the center coordinate of the rounded corner as O'(x c1 ,y c1 ), when the distances from the mouse point, the first standard curve and the second standard curve to the center of the first circle are equal, under the condition that L1=L2=L3, this equidistance characteristic can be used to calculate the coordinates of the center of the first circle.

[0075] When the number of circle centers is zero, it means that there is no preset circle center for reference in the current area. At this time, the chamfering operation in this area with the mouse point will be restricted or impossible. This may be because the area is not suitable for rounding, or the position of the circle center needs to be replanned. When there are two circle centers, it is necessary to further determine which center is more suitable as the reference for the rounding. Selecting according to the principle of "the farthest from the reference point P'" can ensure that the rounding operation better reflects the overall shape and contour characteristics of the part visually. Mark the first circle center farthest from the reference point P' as the first circle center of the rounding in the local coordinate system, and the coordinates of the first circle center of the rounding in the local coordinate system are O'(X c2 ,y c2 ).

[0076] According to the local coordinate system, the coordinates of the first center of the rounded corner are O'(x c2 ,y c2 ), with the two standard curve parameter equations as constraints, the distance between the first circle center coordinate point and the point on the standard curve is the objective function, and the point on the standard curve when the objective function is the minimum is the end point of the rounded corner on the curve, denoted as P 1 (x p1 ,y p1 ), P 2 (x p2 ,y p2 ), determine the starting and ending points of the fillet in the local coordinate system by calculation:

[0077]

[0078] If Δ>0, then P 1 (x p1 ,y p1 ) is the starting point, otherwise P 2 (x p2 ,y p2 ) is the starting point, and the other point is the ending point. The starting point is recorded as the first starting point P A '(x' a , y' a ), the end point is recorded as the first end point P B '(x' b , y' b ). According to the local to global coordinate system homogeneous transformation matrix, the first center coordinates, the first starting point and the first ending point of the chamfer in the local coordinate system are transformed into the second center coordinates, the second starting point and the second ending point in the global coordinate system, and the chamfers of the first curve and the second curve are determined by the second center coordinates, the second starting point and the second ending point in the global coordinate system.

[0079] In a specific embodiment, the first curve and the second curve are both conic curves, and the characteristic center of the first curve is O 1 (x 01 ,y 01 ), the characteristic center of the second curve is O 2 (x 02 ,y 02 ), select the characteristic center of the first curve as the origin, take the line connecting the characteristic center of the first curve and the characteristic center of the second curve as a coordinate axis, and calculate O 2 O 1 The normalized vector of 1 (x 1 ,y 1 ), according to A 1 (x1 ,y 1 ) Calculate the normalized vector of the other coordinate axis and record it as A 2 (x 2 ,y 2 ), according to O 1 (x 01 ,y 01 ), A 1 (x 1 ,y 1 ) and A 2 (x 2 ,y 2 ) Establish local coordinate system A 1 -O 1 -A 2 . Through the local coordinate system A 1 -O 1 -A 2 , we get the local-to-global coordinate system rotation matrix Rot and the local-to-global coordinate system translation vector T, where A 2 (x 2 ,y 2 ) is calculated as follows:

[0080]

[0081] The above local to global coordinate system rotation matrix Rot is expressed as:

[0082]

[0083] The above local to global coordinate system translation vector T is expressed as:

[0084]

[0085] The local-to-global coordinate system rotation matrix Rot and the local-to-global coordinate system translation vector T are combined to obtain the following local-to-global coordinate system homogeneous transformation matrix R:

[0086]

[0087] Global to local coordinate system translation vector T rev It is expressed as:

[0088] T rev =-Rot -1 T;

[0089] The global to local coordinate system homogeneous transformation matrix is ​​expressed as:

[0090]

[0091] The first and second curves in the global coordinate system are transformed by the global to local coordinate system homogeneous transformation matrix R rev Transform to the local coordinate system, the transformation process is expressed by the following formula:

[0092]

[0093] in, represents the points on the first and second curves in the global coordinate system, Represents the points on the first and second standard curves in the local coordinate system.

[0094] The fillet center O'(x c2 ,y c2 ), starting point P A '(x' a , y' a ) and the end point P B '(x' b , y' b ) is transformed into the global coordinate system through the local to global coordinate system homogeneous transformation matrix R, and the final fillet center O(x c2 ,y c2 ), starting point P A (x a ,y a ), end point P B (x b ,y b ), according to the rounding center O(x c2 ,y c2 ), starting point P A (x a ,y a ), end point P B (x b ,y b ) determines the fillet of the first curve and the second curve.

[0095] The transformation process of the fillet center O is expressed by the following formula:

[0096]

[0097] Starting point P A The transformation process is expressed by the following formula:

[0098]

[0099] End point P B The transformation process is expressed by the following formula:

[0100]

[0101] In a specific embodiment, the first curve is a straight line, the second curve is a spline curve, the first curve itself is a characteristic axis, and any point on the first curve is selected as the characteristic center and is recorded as O 1 (x 01 ,y 01 ), and O 1 (x 01 ,y 01 ) as the origin. Calculate the normalized vector in the direction of the line and record it as A 1 (x 1 ,y 1 ), according to A 1 (x 1 ,y 1 ) Calculate the normalized vector of the other coordinate axis and record it as A 2 (x 2 ,y 2 ), according to O 1 (x 01 ,y 01 ), A 1 (x 1 ,y 1 ) and A 2 (x 2 ,y 2 ) Establish local coordinate system A 1 -O 1 -A 2 The method of establishing the local coordinate system in this embodiment, and the method of finally determining the rounded corners of the first curve and the second curve, are similar to those in the previous embodiment, and will not be described in detail here.

[0102] Based on the same inventive concept, the embodiment of the present application also provides a device for implementing the above-mentioned CAD-based two-dimensional curve chamfering. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the above-mentioned method, so the specific limitations of one or more CAD-based two-dimensional curve chamfering device embodiments provided below can refer to the limitations of the CAD-based two-dimensional curve chamfering method above, and will not be repeated here.

[0103] In an exemplary embodiment, Figure 4 As shown, a CAD-based two-dimensional curve rounding device is provided, comprising:

[0104] A first acquisition module 410 is used to acquire a first curve and a second curve to be rounded, wherein the first curve and the second curve are two-dimensional curves, the first curve and the second curve are located in a global coordinate system, and the first curve and the second curve are each one of a conic curve, a straight line, and a spline curve;

[0105] An establishing module 420, configured to establish a local coordinate system based on the first curve and the second curve;

[0106] A second acquisition module 430 is used to obtain a homogeneous transformation matrix from a global coordinate system to a local coordinate system based on the local coordinate system;

[0107] A transformation module 440, configured to transform the first curve and the second curve in the global coordinate system into the first standard curve and the second standard curve in the local coordinate system based on the global to local coordinate system homogeneous transformation matrix;

[0108] A calculation module 450, configured to calculate a reference point set of a first standard curve and a second standard curve;

[0109] The marking module 460 is used to obtain the mouse point and mark the point closest to the mouse point in the reference point set as the reference point;

[0110] A first determination module 470, configured to determine a first center of a rounded corner in a local coordinate system based on the mouse point coordinates, the first standard curve, and the second standard curve;

[0111] A second determination module 480 is used to determine a first starting point and a first ending point of the rounded corner in the local coordinate system based on the first circle center coordinates;

[0112] The conversion module 490 is used to convert the first center coordinates, the first starting point and the first ending point of the chamfered corner in the local coordinate system into the second center coordinates, the second starting point and the second ending point in the global coordinate system based on the local to global coordinate system homogeneous transformation matrix, and determine the chamfered corner by the second center coordinates, the second starting point and the second ending point in the global coordinate system.

[0113] As an optional implementation, a module 420 is established, specifically for:

[0114] Determine whether the first curve and the second curve contain a feature center;

[0115] If both the first curve and the second curve contain the feature center, determining the reference priority of the first curve and the second curve;

[0116] If the first curve and the second curve have different reference priorities, the characteristic center of the two-dimensional curve with a higher reference priority between the first curve and the second curve is determined as the origin, the line connecting the characteristic center of the other two-dimensional curve and the origin is used as the first coordinate axis, the normalized vector of the first coordinate axis is determined based on the first coordinate axis, the normalized vector of the second coordinate axis is determined based on the normalized vector of the first coordinate axis, and a local coordinate system is established based on the normalized vector of the first coordinate axis, the origin, and the normalized vector of the second coordinate axis;

[0117] If the first curve and the second curve have the same reference priority, the characteristic center of any two-dimensional curve is determined as the origin, the line connecting the characteristic center of the other two-dimensional curve and the origin is used as the first coordinate axis, the normalized vector of the first coordinate axis is determined based on the first coordinate axis, the normalized vector of the second coordinate axis is determined based on the normalized vector of the first coordinate axis, and a local coordinate system is established based on the normalized vector of the first coordinate axis, the origin and the normalized vector of the second coordinate axis;

[0118] If only one of the first curve and the second curve contains the characteristic center, the characteristic axis of the two-dimensional curve containing the characteristic center is used as the first coordinate axis, any point on the first coordinate axis is determined as the origin, a normalized vector of the first coordinate axis is determined based on the first coordinate axis, a normalized vector of the second coordinate axis is determined based on the normalized vector of the first coordinate axis, and a local coordinate system is established based on the normalized vector of the first coordinate axis, the origin, and the normalized vector of the second coordinate axis;

[0119] If neither the first curve nor the second curve contains the feature center, the first curve and the second curve cannot be rounded.

[0120] As an optional implementation, the calculation module 450 is specifically configured to:

[0121] Storing the intersection of the first standard curve and the second standard curve in a reference point set;

[0122] When the number of intersection points in the reference point set is zero, the two closest points on the first standard curve and the second standard curve are calculated, and the midpoint of the two closest points on the first standard curve and the second standard curve is stored in the reference point set;

[0123] Alternatively, the characteristic center of the first standard curve and the midpoint of the characteristic center of the second standard curve are stored in the reference point set;

[0124] Alternatively, the characteristic center of the first standard curve and the midpoint of the point on the second standard curve closest to the characteristic center of the first standard curve are stored in the reference point set.

[0125] As an optional implementation manner, the first determining module 470 is specifically configured to:

[0126] The distance between the mouse point and the center of the first circle is marked as L1, the distance between the first standard curve and the center of the first circle is marked as L2, and the distance between the second standard curve and the center of the first circle is marked as L3;

[0127] Based on L1=L2=L3, calculate the coordinates of the center of the first circle;

[0128] When the number of first circle centers is zero, the mouse point cannot be chamfered in the area where it is located. When the number of first circle centers is two, the first circle center farthest from the reference point is marked as the first circle center of the chamfer in the local coordinate system.

[0129] In an exemplary embodiment, a computer device is provided. The computer device may be a server or a terminal. The internal structure diagram thereof may be as follows: Figure 4 As shown. The computer device includes a processor, a memory, an input / output interface (Input / Output, referred to as I / O) and a communication interface. The processor, the memory and the input / output interface are connected through a system bus, and the communication interface is connected to the system bus through the input / output interface. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store the first curve and the second curve data to be rounded. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a two-dimensional curve rounding method based on CAD is implemented.

[0130] Those skilled in the art will understand that Figure 4 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.

[0131] In an exemplary embodiment, a computer device is further provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the steps in the above-mentioned method embodiments when executing the computer program.

[0132] In an exemplary embodiment, a computer-readable storage medium is provided, storing a computer program, and when the computer program is executed by a processor, the steps in the above method embodiments are implemented.

[0133] In an exemplary embodiment, a computer program product is provided, including a computer program, and when the computer program is executed by a processor, the steps in the above method embodiments are implemented.

[0134] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant regulations.

[0135] Those of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM may be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM).

[0136] The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. The non-relational database may include a distributed database based on blockchain, etc., but is not limited thereto. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, etc., but is not limited thereto.

[0137] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0138] This article uses specific examples to illustrate the principles and implementation methods of this application. The description of the above embodiments is only used to help understand the method and core ideas of this application. At the same time, for those skilled in the art, according to the ideas of this application, there will be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as limiting this application.

Claims

1. A CAD-based two-dimensional curve rounding method, characterized in that: The CAD-based two-dimensional curve filleting method comprises: Acquire a first curve and a second curve to be rounded, wherein the first curve and the second curve are two-dimensional curves, the first curve and the second curve are located in a global coordinate system, and the first curve and the second curve are each one of a conic curve, a straight line, and a spline curve; Establishing a local coordinate system based on the first curve and the second curve; Based on the local coordinate system, a global-to-local coordinate system homogeneous transformation matrix is ​​obtained; transforming the first curve and the second curve in the global coordinate system into a first standard curve and a second standard curve in the local coordinate system based on the global-to-local coordinate system homogeneous transformation matrix; Acquire a reference point set of the first standard curve and the second standard curve; Obtain a mouse point, and mark the point in the reference point set that is closest to the mouse point as a reference point; Determine a first center of the rounded corner in the local coordinate system based on the mouse point coordinates, the first standard curve, and the second standard curve; Determine a first starting point and a first ending point of the rounded corner in the local coordinate system based on the first center coordinate of the rounded corner in the local coordinate system; Based on the local to global coordinate system homogeneous transformation matrix, the first center coordinates, the first starting point and the first ending point of the chamfer in the local coordinate system are converted to the second center coordinates, the second starting point and the second ending point in the global coordinate system, and the chamfer of the first curve and the second curve is determined by the second center coordinates, the second starting point and the second ending point in the global coordinate system. The chamfer is used to connect the first curve and the second curve to form a transition.

2. The CAD-based two-dimensional curve rounding method according to claim 1, characterized in that: The establishing of a local coordinate system based on the first curve and the second curve specifically includes: Determining whether the first curve and the second curve contain a feature center; If both the first curve and the second curve contain a feature center, determining a reference priority of the first curve and the second curve; If the reference priorities of the first curve and the second curve are different, the characteristic center of the two-dimensional curve with a higher reference priority among the first curve and the second curve is determined as the origin, the line connecting the characteristic center of the other two-dimensional curve and the origin is used as the first coordinate axis, the normalized vector of the first coordinate axis is determined based on the first coordinate axis, the normalized vector of the second coordinate axis is determined based on the normalized vector of the first coordinate axis, and the local coordinate system is established based on the normalized vector of the first coordinate axis, the origin and the normalized vector of the second coordinate axis; If the reference priorities of the first curve and the second curve are the same, a characteristic center of any one of the two-dimensional curves is determined as the origin, a line connecting the characteristic center of the other two-dimensional curve and the origin is used as the first coordinate axis, a normalized vector of the first coordinate axis is determined based on the first coordinate axis, a normalized vector of the second coordinate axis is determined based on the normalized vector of the first coordinate axis, and the local coordinate system is established based on the normalized vector of the first coordinate axis, the origin, and the normalized vector of the second coordinate axis; If only one of the first curve and the second curve contains a characteristic center, the characteristic axis of the two-dimensional curve containing the characteristic center is used as the first coordinate axis, any point on the first coordinate axis is determined as the origin, a normalized vector of the first coordinate axis is determined based on the first coordinate axis, a normalized vector of the second coordinate axis is determined based on the normalized vector of the first coordinate axis, and the local coordinate system is established based on the normalized vector of the first coordinate axis, the origin, and the normalized vector of the second coordinate axis; If neither the first curve nor the second curve contains a feature center, the local coordinate system cannot be established for the first curve and the second curve.

3. The CAD-based two-dimensional curve filleting method according to claim 2, characterized in that: The reference priority decreases in the order of the conic section, the straight line, and the spline curve.

4. The CAD-based two-dimensional curve rounding method according to claim 1, characterized in that: The calculating of the reference point set of the first standard curve and the second standard curve specifically includes: Storing the intersection of the first standard curve and the second standard curve in the reference point set; When the number of intersection points in the reference point set is zero, calculating the two closest points on the first standard curve and the second standard curve, and storing the midpoint of the two closest points on the first standard curve and the second standard curve in the reference point set; Alternatively, storing the characteristic center of the first standard curve and the midpoint of the characteristic center of the second standard curve in the reference point set; Alternatively, the point on the second standard curve that is closest to the characteristic center of the first standard curve and the midpoint of the characteristic center of the first standard curve are stored in the reference point set.

5. The CAD-based two-dimensional curve filleting method according to claim 1, characterized in that: The determining, based on the mouse point coordinates, the first standard curve and the second standard curve, of a first center of the rounded corner in the local coordinate system specifically includes: Mark the distance between the mouse point and the first center of the circle as L1, mark the distance between the first standard curve and the first center of the circle as L2, and mark the distance between the second standard curve and the first center of the circle as L3; Based on L1=L2=L3, calculating the coordinates of the center of the first circle; When the number of the first circle centers is 0, the mouse point cannot be chamfered in the area where it is located. When the number of the first circle centers is 2, the first circle center farthest from the reference point is marked as the first circle center of the chamfer in the local coordinate system.

6. The CAD-based two-dimensional curve filleting method according to claim 2, characterized in that: The global to local coordinate system homogeneous transformation matrix includes the inverse matrix of the local to global coordinate system rotation matrix and the global to local coordinate system translation vector; the local to global coordinate system rotation matrix is ​​obtained based on the normalized vector of the first coordinate axis and the normalized vector of the second coordinate axis, and the global to local coordinate system translation vector is obtained based on the origin.

7. A CAD-based two-dimensional curve rounding device, characterized in that: The CAD-based two-dimensional curve rounding device comprises: A first acquisition module is used to acquire a first curve and a second curve to be rounded, wherein the first curve and the second curve are two-dimensional curves, the first curve and the second curve are located in a global coordinate system, and the first curve and the second curve are each one of a conic curve, a straight line, and a spline curve; An establishing module, configured to establish a local coordinate system based on the first curve and the second curve; A second acquisition module is used to obtain a homogeneous transformation matrix from the global to the local coordinate system based on the local coordinate system; A transformation module, configured to transform the first curve and the second curve in the global coordinate system into a first standard curve and a second standard curve in the local coordinate system based on the global-to-local coordinate system homogeneous transformation matrix; A calculation module, used for calculating a reference point set of the first standard curve and the second standard curve; A marking module, used for obtaining a mouse point, and marking a point in the reference point set that is closest to the mouse point as a reference point; A first determination module, configured to determine a first center of a rounded corner in the local coordinate system based on the mouse point coordinates, the first standard curve, and the second standard curve; A second determination module, used for determining a first starting point and a first ending point of the rounded corner in the local coordinate system based on the first circle center coordinates; A conversion module is used to convert the first center coordinates, the first starting point and the first ending point of the chamfer in the local coordinate system into the second center coordinates, the second starting point and the second ending point in the global coordinate system based on the local to global coordinate system homogeneous conversion matrix, and determine the chamfer of the first curve and the second curve through the second center coordinates, the second starting point and the second ending point in the global coordinate system, and the chamfer is used to connect the first curve and the second curve to form a transition.

8. A computer device comprising: A memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the steps of the CAD-based two-dimensional curve chamfering method described in any one of claims 1 to 6.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the CAD-based two-dimensional curve chamfering method described in any one of claims 1 to 6 are implemented.

10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the CAD-based two-dimensional curve chamfering method described in any one of claims 1 to 6 are implemented.