Curve drawing method and device, computer equipment and storage medium

By obtaining the fitting points and projection points on the 3D model of the teeth and generating the target curve, the problem of insufficient fit between the curve and the three-dimensional model in the prior art is solved, and the accuracy and fit of the curve are improved.

CN119444915APending Publication Date: 2025-02-14HEFEI MEIYA OPTOELECTRONICS TECH
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202310961147.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-07-31
Publication Date
2025-02-14

AI Technical Summary

Technical Problem

In the prior art, the extraction and drawing of curves on the three-dimensional model of tooth have problems such as inappropriate selection of fit points, resulting in insufficient fit between the curve and the three-dimensional model.

Method used

By obtaining the movement path of the curve start point and the mouse pointer, determine the middle point of the curve, and generate the target curve based on the fitted point and projected point. The method includes obtaining the fitted points, fitting the spline curve, projecting the interpolated points to the surface of the three-dimensional grid model, and generating the final target curve based on the fitted points and projected points.

Benefits of technology

The fit between the curve and the three-dimensional grid model is improved, the accuracy of the processing preparation is ensured, the spacing between points on the curve is reduced, and the generated curve is more suitable for the three-dimensional grid model.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119444915A_ABST
    Figure CN119444915A_ABST
Patent Text Reader

Abstract

The invention relates to a curve drawing method and device, computer equipment and a storage medium. The method comprises the following steps: acquiring a curve starting point, and adding the curve starting point as a fitting point; acquiring a first moving path of the mouse pointer, determining at least one curve middle point corresponding to the first moving path from the surface of the three-dimensional grid model, and adding each curve middle point as a fitting point; fitting according to each fitting point to obtain a spline curve, and obtaining each interpolation point on the spline curve; respectively determining a projection point of each interpolation point on the surface of the three-dimensional grid model; and generating a target curve according to each fitting point and each projection point. By adopting the method, the fitting degree of the curve and the surface of the three-dimensional grid model 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 computer image technology, and in particular to a curve drawing method, device, computer equipment and storage medium. Background Art

[0002] In the process of treating oral diseases, there is usually a need to construct a 3D model of the patient's teeth and extract special curves such as the gum line, curves or the boundary lines of different tooth surfaces on the 3D model to process the prepared body. For example, the curve can be the cervical margin line of the tooth model, such as Figure 1 As shown, the boundary line between the removed area and the unremoved area on the tooth model can be regarded as the cervical margin line on the tooth model.

[0003] In the prior art, technicians usually need to manually select fitting points on the 3D model, and then the software connects the fitting points to form the curve to be extracted. However, since the selection of fitting points will affect the quality of curve construction, if the fitting points are selected solely based on the experience of the technicians, it is easy to cause poor selection of fitting points, resulting in insufficient fit between the formed curve and the 3D model, which in turn leads to insufficient precision of the processed preparation. Summary of the invention

[0004] Based on this, it is necessary to provide a curve drawing method, device, computer equipment and storage medium to address the above technical problems.

[0005] In a first aspect, the present application provides a curve drawing method. The method comprises:

[0006] Obtaining a curve starting point, and adding the curve starting point as a fitting point;

[0007] Acquire a first moving path of the mouse pointer, and determine at least one curve middle point corresponding to the first moving path from the surface of the three-dimensional mesh model, and add each of the curve middle points as the fitting point;

[0008] Fitting a spline curve according to the fitting points, and obtaining interpolation points on the spline curve;

[0009] Respectively determine the projection point of each interpolation point on the surface of the three-dimensional grid model;

[0010] A target curve is generated according to each of the fitting points and each of the projection points.

[0011] In one embodiment, after generating the target curve according to each of the fitting points and each of the projection points, the method further includes:

[0012] In the case that the end point of the target curve does not coincide with the starting point of the curve, jump to the step of obtaining the first moving path of the mouse pointer until the end point of the target curve coincides with the starting point of the curve;

[0013] The target curve is taken as the final curve drawn.

[0014] In one embodiment, the step of respectively determining the projection points of each interpolation point on the surface of the three-dimensional mesh model comprises:

[0015] For any of the interpolation points, first distances between each vertex of the three-dimensional mesh model and the interpolation point are determined respectively, and a first target vertex is determined from each of the vertices according to each of the first distances;

[0016] Based on the coordinates of the interpolation point, the coordinates of the first target vertex, and the normal of the first target vertex, a projection point of the interpolation point on the surface of the three-dimensional mesh model is determined.

[0017] In one embodiment, after obtaining each interpolation point on the spline curve, the method further includes:

[0018] Determine a second distance between every two adjacent interpolation points;

[0019] In the case where there are two target interpolation points, determining a new interpolation point from the spline curve between the two target interpolation points, and adding the new interpolation point to each of the interpolation points, wherein the two target interpolation points are adjacent and a second distance between the two target interpolation points is greater than a second distance threshold;

[0020] Jump to the step of determining the second distance between every two adjacent interpolation points until the target interpolation point does not exist.

[0021] In one embodiment, determining at least one curve midpoint corresponding to the first movement path from the surface of the three-dimensional grid model includes:

[0022] According to a preset target point acquisition strategy, acquiring at least one target point from the first moving path;

[0023] For any of the target points, based on the camera coordinates in the model coordinate system and the target coordinates of the target point in the model coordinate system, a target straight line passing through the camera coordinates and the target coordinates is obtained, and according to the third distance between each vertex of the three-dimensional mesh model and the target straight line, a second target vertex whose third distance to the target straight line is less than a third distance threshold is determined, and based on the target coordinates, the target straight line, the normal of each of the second target vertices and the coordinates of each of the second target vertices, the middle point of the curve corresponding to the target point on the surface of the three-dimensional mesh model is determined, and the model coordinate system is the coordinate system where the three-dimensional mesh model is located.

[0024] In one embodiment, determining the middle point of the curve corresponding to the target point on the surface of the three-dimensional mesh model based on the target coordinates, the target straight line, the normal of each second target vertex and the coordinates of each second target vertex includes:

[0025] For any second target vertex, determining the projection coordinates of the target point based on the target coordinates, the target straight line, the normal of the second target vertex and the coordinates of the second target vertex;

[0026] The middle point of the curve corresponding to the target point on the surface of the three-dimensional mesh model is determined according to the average value of the projection coordinates corresponding to each of the second target vertices.

[0027] In one embodiment, after determining, based on the third distances between each of the vertices and the target straight line, a second target vertex whose third distance to the target straight line is less than a third distance threshold, the method further comprises:

[0028] Performing clustering processing on each of the second target vertices to obtain at least one clustering result, and acquiring a cluster center of each of the clustering results;

[0029] Determine the fourth distances between each cluster center and the camera coordinates respectively, and use the clustering result where the cluster center corresponding to the shortest fourth distance among the fourth distances is located as the first target clustering result, and use the clustering results other than the first target clustering result as the second target clustering result;

[0030] The second target vertices in each of the second target clustering results are deleted from each of the second target vertices.

[0031] In one embodiment, after generating the target curve according to each of the fitting points and each of the projection points, the method further includes:

[0032] When a mouse click is detected, acquiring a modification point corresponding to the click point of the mouse from the surface of the three-dimensional mesh model, and determining a fifth distance between the modification point and the target curve;

[0033] When the fifth distance is less than a fifth distance threshold, determining two first connection points corresponding to the modification point on the target curve;

[0034] A first update line is constructed based on the two first connection points and the modification point, and the target curve is updated based on the first update line.

[0035] In one embodiment, after generating the target curve according to each of the fitting points and each of the projection points, the method further includes:

[0036] In the case of detecting the movement of the mouse, determining a second movement path of the mouse pointer, determining a modification line corresponding to the second movement path from the surface of the three-dimensional mesh model, and determining a sixth distance between the modification line and the target curve;

[0037] When the sixth distance is less than a sixth distance threshold, determining two second connection points corresponding to the modification line on the target curve;

[0038] A second update line is constructed based on the two second connection points and the modification line, and the target curve is updated based on the second update line.

[0039] In one embodiment, after generating the target curve according to each of the fitting points and each of the projection points, the method further includes:

[0040] Determine a first point to be detected on the target curve, and determine a first line segment and a second line segment corresponding to the first point to be detected, wherein the second line segment is a curve in the target curve other than the first line segment;

[0041] The second points to be detected in the second line segment are traversed, and for any second point to be detected, a seventh distance between the second point to be detected and the first point to be detected is determined, and when the seventh distance is less than a seventh distance threshold, prompt information is generated and displayed, wherein the prompt information is used to indicate that the target curve has self-intersection.

[0042] In a second aspect, the present application also provides a curve drawing device. The device comprises:

[0043] A first acquisition module, used for acquiring a starting point of a curve and adding the starting point of the curve as a fitting point;

[0044] A first determination module is used to obtain a first moving path of the mouse pointer, and determine at least one curve middle point corresponding to the first moving path from the surface of the three-dimensional mesh model, and add each of the curve middle points as the fitting point;

[0045] A fitting module, used to fit a spline curve according to the fitting points and obtain interpolation points on the spline curve;

[0046] A second determination module, used to respectively determine the projection point of each interpolation point on the surface of the three-dimensional grid model;

[0047] A generating module is used to generate a target curve according to each of the fitting points and each of the projection points.

[0048] In one embodiment, the device further comprises:

[0049] A first processing module, configured to jump to the step of obtaining a first moving path of a mouse pointer when the end point of the target curve does not coincide with the starting point of the curve, until the end point of the target curve coincides with the starting point of the curve;

[0050] The second processing module is used to use the target curve as the final drawn curve.

[0051] In one embodiment, the second determining module is further used to:

[0052] For any of the interpolation points, first distances between each vertex of the three-dimensional mesh model and the interpolation point are determined respectively, and a first target vertex is determined from each of the vertices according to each of the first distances;

[0053] Based on the coordinates of the interpolation point, the coordinates of the first target vertex, and the normal of the first target vertex, a projection point of the interpolation point on the surface of the three-dimensional mesh model is determined.

[0054] In one embodiment, the device further comprises:

[0055] A third determining module, used to determine a second distance between every two adjacent interpolation points;

[0056] An adding module is used to determine a new interpolation point from the spline curve between the two target interpolation points when there are two target interpolation points, and add the new interpolation point to each of the interpolation points, wherein the two target interpolation points are adjacent and the second distance between the two target interpolation points is greater than a second distance threshold; jump to the step of determining the second distance between every two adjacent interpolation points until there are no target interpolation points.

[0057] In one embodiment, the first determining module is further used to:

[0058] According to a preset target point acquisition strategy, acquiring at least one target point from the first moving path;

[0059] For any of the target points, based on the camera coordinates in the model coordinate system and the target coordinates of the target point in the model coordinate system, a target straight line passing through the camera coordinates and the target coordinates is obtained, and according to the third distance between each vertex of the three-dimensional mesh model and the target straight line, a second target vertex whose third distance to the target straight line is less than a third distance threshold is determined, and based on the target coordinates, the target straight line, the normal of each of the second target vertices and the coordinates of each of the second target vertices, the middle point of the curve corresponding to the target point on the surface of the three-dimensional mesh model is determined, and the model coordinate system is the coordinate system where the three-dimensional mesh model is located.

[0060] In one embodiment, the first determining module is further used to:

[0061] For any second target vertex, determining the projection coordinates of the target point based on the target coordinates, the target straight line, the normal of the second target vertex and the coordinates of the second target vertex;

[0062] The middle point of the curve corresponding to the target point on the surface of the three-dimensional mesh model is determined according to the average value of the projection coordinates corresponding to each of the second target vertices.

[0063] In one embodiment, the device further comprises:

[0064] A clustering module, used for performing clustering processing on each of the second target vertices to obtain at least one clustering result, and obtaining a cluster center of each of the clustering results;

[0065] a fourth determination module, configured to respectively determine fourth distances between each of the cluster centers and the camera coordinates, and use the clustering result where the cluster center corresponding to the shortest fourth distance among the fourth distances is located as the first target clustering result, and use the clustering results other than the first target clustering result as the second target clustering result;

[0066] The deleting module is used to delete the second target vertices in each of the second target clustering results from each of the second target vertices.

[0067] In one embodiment, the device further comprises:

[0068] A second acquisition module is used to acquire, when a mouse click is detected, a modification point corresponding to the click point of the mouse from the surface of the three-dimensional mesh model, and determine a fifth distance between the modification point and the target curve;

[0069] A fifth determining module, configured to determine, when the fifth distance is less than a fifth distance threshold, two first connection points corresponding to the modification point on the target curve;

[0070] The first updating module is used to construct a first updating line based on the two first connecting points and the modification point, and to update the target curve based on the first updating line.

[0071] In one embodiment, the device further comprises:

[0072] a sixth determination module, configured to determine, when detecting the movement of the mouse, a second movement path of the mouse pointer, determine a modification line corresponding to the second movement path from the surface of the three-dimensional mesh model, and determine a sixth distance between the modification line and the target curve;

[0073] A seventh determination module, configured to determine two second connection points corresponding to the modification line on the target curve when the sixth distance is less than a sixth distance threshold;

[0074] The second updating module is used to construct a second updating line based on the two second connection points and the modification line, and to update the target curve based on the second updating line.

[0075] In one embodiment, the device further comprises:

[0076] an eighth determination module, configured to determine a first to-be-detected point on the target curve, and determine a first line segment and a second line segment corresponding to the first to-be-detected point, wherein the second line segment is a curve in the target curve other than the first line segment;

[0077] A ninth determination module is used to traverse the second points to be detected in the second line segment, determine the seventh distance between the second point to be detected and the first point to be detected for any second point to be detected, and generate and display prompt information when the seventh distance is less than the seventh distance threshold, wherein the prompt information is used to indicate that the target curve has self-intersection.

[0078] In a third aspect, the present application further provides a computer device, wherein the computer device comprises a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, any one of the above methods is implemented.

[0079] In a fourth aspect, the present application further provides a computer-readable storage medium, wherein a computer program is stored on the computer-readable storage medium, and when the computer program is executed by a processor, any of the above methods is implemented.

[0080] In a fifth aspect, the present application further provides a computer program product, wherein the computer program product comprises a computer program, and when the computer program is executed by a processor, any of the above methods is implemented.

[0081] The above-mentioned curve drawing method, device, computer equipment and storage medium track the movement path of the mouse, fit the fitting points on the path with a spline curve, and then project the spline curve onto the surface of the three-dimensional grid model by projecting the interpolation points in the spline curve onto the surface of the three-dimensional grid model, so as to obtain the target curve finally generated. The embodiment of the present application does not completely rely on the selection of fitting points when generating a curve, but grabs the interpolation points from the spline curve after generating the spline curve according to the fitting points for the first time, and projects the interpolation points onto the surface of the three-dimensional grid model, thereby obtaining projection points other than a plurality of fitting points. Since the projection points correspond to the positions of the original spline curve, are located on the surface of the three-dimensional grid model and are relatively large in number, the curve is generated according to the projection points and the fitting points, and while retaining the characteristics of the original spline curve generated according to the fitting points, the spacing between the points on the curve can be reduced, so that the curve generated according to the points is more in line with the three-dimensional grid model. BRIEF DESCRIPTION OF THE DRAWINGS

[0082] Figure 1 A schematic diagram of a neck margin line;

[0083] Figure 2 A schematic diagram of a flow chart of a curve drawing method in one embodiment;

[0084] Figure 3 A schematic diagram of a spline curve obtained by fitting in one embodiment;

[0085] Figure 4 is a schematic diagram of projecting a spline curve onto a model surface in one embodiment;

[0086] Figure 5 A schematic diagram of a flow chart of a curve drawing method in one embodiment;

[0087] Figure 6 A schematic diagram of a process of drawing a curve in real time in one embodiment;

[0088] Figure 7 is a schematic diagram of a complete curve in one embodiment;

[0089] Figure 8 is a flow chart of step 208 in one embodiment;

[0090] Fig. 9 A schematic diagram of calculating a projection point in one embodiment;

[0091] Fig.10 A schematic diagram of a flow chart of a curve drawing method in one embodiment;

[0092] Fig.11 A schematic diagram of a spline curve suspended in an embodiment;

[0093] Fig.12 A schematic diagram of a process of adding a new interpolation point in one embodiment;

[0094] Fig.13 is a schematic diagram of a curve generated after adding a new interpolation point in one embodiment;

[0095] Fig.14 is a flow chart of step 204 in one embodiment;

[0096] Fig.15 is a schematic diagram of target coordinates of a target point in a model coordinate system in one embodiment;

[0097] Fig.16 A schematic diagram of calculating the third distance from a vertex to a target straight line in one embodiment;

[0098] Fig.17 is a schematic diagram of a second target vertex in one embodiment;

[0099] Fig.18 A schematic diagram of second target vertices on the front and back sides of a model in one embodiment;

[0100] Fig.19 is a schematic diagram of the camera position in one embodiment;

[0101] Fig. 20 A schematic diagram of calculating a projection point in one embodiment;

[0102] Fig.21 is a flow chart of step 1404 in one embodiment;

[0103] Fig. 22 A schematic diagram of a flow chart of a curve drawing method in one embodiment;

[0104] Fig.23 is a schematic diagram of a clustering result in one embodiment;

[0105] Fig.24 A schematic diagram of a midpoint of a curve obtained in one embodiment;

[0106] Fig.25 A schematic diagram of a flow chart of a curve drawing method in one embodiment;

[0107] Fig.26 A schematic diagram of determining two first connection points in one embodiment;

[0108] Fig. 27 A schematic diagram of the effect of clicking to modify a curve in an embodiment;

[0109] Fig.28 A schematic diagram of a flow chart of a curve drawing method in one embodiment;

[0110] Fig.29 A schematic diagram of determining two second connection points in one embodiment;

[0111] Fig.30 A schematic diagram of the effect of drawing a line to modify a curve in one embodiment;

[0112] Fig.31 A schematic diagram of a flow chart of a curve drawing method in one embodiment;

[0113] Fig.32 is a schematic diagram of a self-intersecting curve in one embodiment;

[0114] Fig.33 is a schematic diagram of self-intersection detection in one embodiment;

[0115] Fig.34 It is a structural block diagram of a curve drawing device in one embodiment;

[0116] Fig.35 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION

[0117] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0118] In one embodiment, Figure 2 As shown, a curve drawing method is provided. This embodiment takes the method applied to a terminal as an example. It can be understood that the method can also be applied to a server, and can also be applied to a system including a terminal and a server, and is implemented through the interaction between the terminal and the server. In this embodiment, the method includes the following steps:

[0119] Step 202: Obtain the starting point of the curve and add the starting point of the curve as a fitting point.

[0120] In the embodiment of the present application, the starting point of the curve is a point on the surface of the three-dimensional mesh model of the tooth, and the point can be selected by the operator on the three-dimensional mesh model. For example, the operator can click on the three-dimensional mesh model, and the terminal automatically captures the click point and projects the click point onto the surface of the three-dimensional mesh model to obtain the starting point of the curve, or the operator can manually input the coordinates to obtain the starting point of the curve. The embodiment of the present application does not specifically limit this.

[0121] After obtaining the curve start point, the curve start point may be added as a fitting point for fitting the spline curve.

[0122] Step 204 , obtaining a first moving path of the mouse pointer, and determining at least one curve middle point corresponding to the first moving path from the surface of the three-dimensional mesh model, and adding each curve middle point as a fitting point.

[0123] In an embodiment of the present application, an operator can draw on the surface of a three-dimensional grid model by moving a mouse pointer. The terminal automatically captures a target point on the movement path of the mouse pointer, projects the target point onto the surface of the three-dimensional grid model to obtain a midpoint of the curve, adds the midpoint of the curve as a fitting point, and then fits a spline curve based on the fitting points, thereby generating a curve that matches the first movement path of the mouse pointer and is located on the surface of the three-dimensional grid model.

[0124] Exemplarily, the terminal can collect the target point of the mouse pointer on the screen at regular intervals, obtain the screen coordinates of the target point, convert the screen coordinates into target coordinates in the model coordinate system where the three-dimensional mesh model is located (this can be accomplished through any conversion algorithm between screen coordinates and world coordinates), and then obtain a straight line by connecting the target coordinates and the camera coordinates (the camera coordinates are the coordinates corresponding to the camera in the model coordinate system, and the camera represents the position and viewing angle of the current three-dimensional mesh model), and then use the position where the straight line passes through the surface of the three-dimensional mesh model as the midpoint of the curve.

[0125] It should be noted that the above method is only an example, and the midpoint of the curve corresponding to the position of the mouse pointer may also be obtained by other methods, and the embodiment of the present application does not specifically limit this.

[0126] Step 206: fitting a spline curve according to the fitting points, and obtaining interpolation points on the spline curve.

[0127] In the embodiment of the present application, after obtaining each fitting point, a spline curve passing through each fitting point can be fitted. The embodiment of the present application does not specifically limit the method of fitting the spline curve, and any spline curve fitting algorithm is applicable to the embodiment of the present application.

[0128] Since the fitted spline curve may not completely fit the surface of the 3D mesh model (such as Figure 3 As shown, the ball on the spline curve is located inside the three-dimensional grid model), so it is necessary to adjust the position of the interpolation point on the spline curve and project the interpolation point onto the surface of the three-dimensional grid model so that the spline curve can also be projected onto the surface of the three-dimensional grid model. The interpolation point is any point in the spline curve. Multiple interpolation points can be taken at equal intervals between two fitting points, or points that can best express the curve characteristics of the spline curve can be taken as interpolation points, such as multiple points with the largest curvature, or when connecting the points through line segments, a group of points whose multi-segment broken lines are closest to the spline curve are taken as interpolation points. The embodiments of the present application do not make specific limitations on this.

[0129] Step 208, respectively determine the projection points of each interpolation point on the surface of the three-dimensional mesh model.

[0130] In the embodiment of the present application, the projection point of the interpolation point on the surface of the three-dimensional mesh model can be determined by the coordinates of each interpolation point. For example, the projection point can be determined by referring to the method of obtaining the middle point of the curve through the target coordinates of the mouse pointer, or, since the coordinates of each triangular mesh vertex in the three-dimensional mesh model and the normal of the vertex are known, the projection point of the interpolation point on the tangent plane at the location of any vertex can be determined based on the coordinates and normal of the vertex, and then the projection point of the interpolation point on the tangent plane is used as the projection point of the interpolation point on the surface of the three-dimensional mesh model. The embodiment of the present application does not make specific limitations on this.

[0131] Step 210: Generate a target curve according to each fitting point and each projection point.

[0132] In the embodiment of the present application, a spline curve fitting can be performed again on each fitting point and each projection point to obtain a spline curve passing through each fitting point and each projection point, and the spline curve is used as the target curve finally generated. Compared with the spline curve generated only based on each fitting point for the first time, the spline curve needs to pass through more points on the surface of the three-dimensional mesh model at this time, so the obtained spline curve will be closer to the surface of the three-dimensional mesh model, so the spline curve obtained at this time can be used as the target curve finally generated.

[0133] Alternatively, when the distances between the selected interpolation points are close, the distances between the projection points obtained from the interpolation points will also be close. In this case, it is also possible to directly connect every two adjacent projection points to obtain multiple polylines, and use the polylines as the final generated target curve. Since the projection points are all located on the surface of the 3D mesh model, and the length of each line segment is short, the line segment connecting two projection points on the surface of the 3D mesh model will also fit the surface of the 3D mesh model more closely, such as Figure 4 shown.

[0134] The curve drawing method provided in the embodiment of the present application tracks the moving path of the mouse, fits the fitting points on the path with a spline curve, and then projects the spline curve onto the surface of the three-dimensional grid model by projecting the interpolation points in the spline curve onto the surface of the three-dimensional grid model, thereby obtaining the target curve finally generated. The embodiment of the present application does not completely rely on the selection of fitting points when generating the curve, but grabs the interpolation points from the spline curve after generating the spline curve according to the fitting points for the first time, and projects the interpolation points onto the surface of the three-dimensional grid model, thereby obtaining projection points other than multiple fitting points. Since the projection points correspond to the positions of the original spline curves, are located on the surface of the three-dimensional grid model, and are relatively large in number, the curve is generated according to the projection points and the fitting points, and while retaining the characteristics of the original spline curve generated according to the fitting points, the spacing between the points on the curve can be reduced, so that the curve generated according to the points is more in line with the three-dimensional grid model.

[0135] In one embodiment, Figure 5 As shown, in step 210, after generating the target curve according to each fitting point and each projection point, the method further includes:

[0136] Step 502 , when the end point of the target curve does not coincide with the starting point of the curve, jump to the step of obtaining the first moving path of the mouse pointer until the end point of the target curve coincides with the starting point of the curve.

[0137] Step 504: Use the target curve as the final drawn curve.

[0138] In the embodiment of the present application, a curve can be generated in real time along the moving path of the mouse pointer, so that the operator can see the drawing result of the curve in real time. Whether the end point of the generated target curve coincides with the starting point of the curve can be used as a criterion for judging whether the curve drawing is completed. If the curve is not drawn, the terminal can continue to execute the steps of detecting the moving path of the mouse pointer and generating a curve corresponding to the moving path.

[0139] For example, Figure 6 As shown, the end distance (for example, 0.5 mm) can be preset, and each time the target curve is generated, the distance between the end point of the generated target curve (that is, the middle point of the curve corresponding to the last target point obtained from the first moving path of the mouse pointer) and the starting point of the curve is determined. When the distance is less than the end distance, it is determined that the end point of the target curve has coincided with the starting point of the curve. The terminal can then stop detecting the moving path of the mouse pointer, and connect the end point of the target curve with the starting point of the curve to complete the drawing of a closed complete curve, as shown in FIG. Figure 7 shown.

[0140] The curve drawing method provided in the embodiment of the present application, when the end point of the target curve and the starting point of the curve do not coincide, repeatedly executes the step of generating the target curve according to the first movement path of the mouse, so that the operator can see the drawing result of the curve in real time before the curve is drawn.

[0141] In one embodiment, Figure 8 As shown, in step 208, the projection points of each interpolation point on the surface of the three-dimensional mesh model are determined respectively, including:

[0142] Step 802: for any interpolation point, first distances between each vertex of the three-dimensional mesh model and the interpolation point are determined respectively, and a first target vertex is determined from each vertex according to each first distance.

[0143] Step 804 , determining a projection point of the interpolation point on the surface of the three-dimensional mesh model based on the coordinates of the interpolation point, the coordinates of the first target vertex, and the normal of the first target vertex.

[0144] In the embodiment of the present application, the projection point of the interpolation point on the surface of the three-dimensional mesh model can be determined according to the coordinates and normals of the vertices in the three-dimensional mesh model. Since the projection point calculated by the normal will have a certain error with the surface of the three-dimensional mesh model, the closer the distance between the interpolation point and the projection point is, the smaller the error is. Therefore, the vertex closer to the interpolation point can be selected as the first target vertex, and then the projection point can be calculated according to the first target vertex to improve the accuracy of calculating the projection point.

[0145] The first distance between each vertex and the interpolation point can be determined based on the coordinates of the interpolation point and the coordinates of each vertex. Exemplarily, all vertices whose first distance is less than the first distance threshold can be used as first target vertices, and then the projection points of the interpolation points corresponding to the normals of each first target vertex are respectively calculated based on the coordinates and normals of each first target vertex, and then the average of the calculated coordinates of each projection point is taken to obtain the final projection point; alternatively, the vertex with the smallest first distance can be selected as the first target vertex. The embodiments of the present application do not specifically limit this.

[0146] It should be noted that a kdtree (k-dimensional tree) corresponding to each vertex in the three-dimensional mesh model can be established in advance, and the first target vertex can be determined according to the nearest neighbor search algorithm based on the kdtree, so that there is no need to determine the first target vertex by calculating the first distance between all vertices and the interpolation point, which can speed up the search for the first target vertex. The embodiment of the present application does not specifically limit the method for constructing a kdtree, and any method for constructing a kdtree is applicable to the embodiment of the present application. For example, if the Vtk software (visualization toolkit, a three-dimensional visualization toolkit) is used to construct a three-dimensional mesh model, the coordinates of each vertex of the three-dimensional mesh model can be passed to the object of this class by calling vtkKdTreePointLocator (a class) to construct a kdtree.

[0147] Reference Fig. 9 As shown in FIG. 1 , a method of determining the projection point based on the coordinates and normal of the vertex is shown. In the figure, X is the first target vertex, is the normal of the first target vertex, P is the interpolation point, is the vector from P to X, and O is the projection point. By taking as the projection direction of the interpolation point, the intersection of the projection direction and the plane corresponding to the normal of the first target vertex can be obtained, which is also the projection point of the interpolation point.

[0148] According to the coordinates of the interpolation point and the coordinates of the first target vertex, the direction vector from the interpolation point to the first target vertex can be calculated. By calculating the dot product of the vector and the vector divided by the dot product of the vector and the vector, the length of the projection of the vector in the direction of the vector and the ratio of the vector length can be obtained (see formula (1)):

[0149]

[0150] The product of the ratio m and the length of the vector component on the x-axis, y-axis, and z-axis of the model coordinate system (that is, the coordinate system where the three-dimensional mesh model is located) can be obtained to obtain the vector from the interpolation point to the projection point. The coordinates of the projection point can be obtained by summing the coordinates of the interpolation point and the vector from the interpolation point to the projection point (see formula (II)):

[0151]

[0152] Among them, refers to the coordinate of the projection point on the i-axis (i can be x, y or z), refers to the coordinate of the interpolation point on the i-axis, refers to the component vector of the normal of the first target vertex on the i-axis, and m refers to the ratio.

[0153] The curve drawing method provided in the embodiment of the present application determines the first target vertex, and determines the projection point of the interpolation point on the surface of the three-dimensional mesh model according to the coordinates and normal of the first target vertex. The embodiment of the present application can obtain the coordinates of the projection point with the required accuracy without the need to determine the exact position of the projection point through complex calculations, which can speed up the speed of determining the projection point and thus improve the speed of drawing the curve.

[0154] In one embodiment, Fig.10 As shown, in step 206, after obtaining each interpolation point on the spline curve, the method further includes:

[0155] Step 1002: determine the second distance between every two adjacent interpolation points.

[0156] Step 1004, when there are two target interpolation points, determine a new interpolation point from the spline curve between the two target interpolation points, and add the new interpolation point to each interpolation point, wherein the two target interpolation points are adjacent and the second distance between the two target interpolation points is greater than the second distance threshold.

[0157] Jump to the step of determining the second distance between every two adjacent interpolation points until there is no target interpolation point.

[0158] In the embodiment of the present application, if the spacing between interpolation points is not limited when obtaining interpolation points, for example, the point that best represents the curve characteristics of the spline curve is taken as the interpolation point, then the spacing between two interpolation points may be large, such as Fig.11 As shown in Figure 2. In this case, even if the interpolation points are projected onto the surface of the 3D mesh model, the line segment connecting the two projected points may still enter the interior of the 3D mesh model or may not fit the surface of the 3D mesh model. Therefore, it is necessary to add new interpolation points between the interpolation points to solve the above problem.

[0159] like Fig.12As shown, after obtaining the interpolation points, the second distance between every two adjacent interpolation points can be calculated. If there are two target interpolation points whose second distance is greater than the second distance threshold (the value can be set by a person skilled in the art according to requirements), a new interpolation point needs to be added between the two target interpolation points. For example, the maximum distance between the two interpolation points can be preset, and then the number of new interpolation points that need to be added between the target interpolation points can be determined based on the positive integer that is smaller than the ratio of the second distance to the maximum distance and is closest to the ratio (for example, if the second distance is 0.07mm and the maximum distance is 0.03mm, the ratio of the second distance to the maximum distance is 2.33, and the positive integer that is smaller than the ratio and is closest to the ratio is 2, so two new interpolation points are inserted at equal intervals so that the distance between the interpolation points meets the maximum distance requirement. After inserting two new interpolation points, the distance between each interpolation point is 0.023mm). Alternatively, a new interpolation point may be inserted between two target interpolation points, and then the process of determining the second distance between every two adjacent interpolation points may be repeated. Each time when it is determined that a target interpolation point exists, a new interpolation point is added between the two target interpolation points, thereby completing the process of adding a new interpolation point.

[0160] After adding new interpolation points, a target curve can be generated based on the original interpolation points, the newly added interpolation points and the fitting points. The method of generating the target curve can refer to the relevant description of the above embodiment, and the embodiment of this application will not be repeated here. The target curve finally generated can refer to Fig.13 shown.

[0161] The curve drawing method provided in the embodiment of the present application adds a new interpolation point between the interpolation points when the second distance between the two interpolation points is greater than the second distance threshold to increase the density of the interpolation points, thereby improving the fit between the generated curve and the surface of the three-dimensional mesh model.

[0162] In one embodiment, Fig.14 As shown, in step 204, determining at least one curve midpoint corresponding to the first moving path from the surface of the three-dimensional grid model includes:

[0163] Step 1402: Acquire at least one target point from the first moving path according to a preset target point acquisition strategy.

[0164] Step 1404, for any target point, based on the camera coordinates in the model coordinate system and the target coordinates of the target point in the model coordinate system, obtain a target straight line passing through the camera coordinates and the target coordinates, and determine a second target vertex whose third distance to the target straight line is less than a third distance threshold based on the third distance between each vertex of the three-dimensional mesh model and the target straight line, and determine the midpoint of the curve corresponding to the target point on the surface of the three-dimensional mesh model based on the target coordinates, the target straight line, the normal of each second target vertex and the coordinates of each second target vertex, where the model coordinate system is the coordinate system where the three-dimensional mesh model is located.

[0165] In the embodiment of the present application, the preset target point acquisition strategy is a strategy for grabbing the target point from the first moving path. For example, the preset target point acquisition strategy may be to grab the current position of the mouse pointer on the screen once at a preset interval and use the position as the target point; or it may be to grab the target point once the mouse pointer passes a preset distance; or it may be to detect the moving direction of the mouse pointer and grab the target point only when the mouse pointer changes the moving direction, which is not specifically limited in the embodiment of the present application. When using Vtk software, the target point can also be automatically acquired by calling the mouse movement event in the software.

[0166] After obtaining the target point, since the coordinates of the target point are relative to the screen coordinates, it is necessary to use any screen coordinate and world coordinate conversion algorithm to convert the screen coordinates of the target point into the target coordinates of the target point in the model coordinate system. Fig.15 As shown, it is a schematic diagram of the obtained target coordinates, and the corresponding model is a three-dimensional mesh model of the teeth, which can be obtained by scanning with a digital oral impression device. Based on the camera coordinates and the target coordinates, a target straight line passing through the camera coordinates and the target coordinates can be obtained. Since the camera represents the perspective of observing the three-dimensional target model, the target straight line can represent the line of sight from the observation perspective to the target coordinates. The intersection of this straight line and the three-dimensional mesh model is the point that the operator is most likely to want to select on the three-dimensional mesh model when moving the mouse pointer on the screen. Therefore, this point can be used as the middle point of the curve corresponding to the target point.

[0167] By determining the third distance between each vertex of the 3D mesh model and the target line, the vertex that is closest to the intersection of the target line and the surface of the 3D mesh model can be found. Fig.16 As shown, assuming that the vertex is X, the target coordinate is P, is the direction vector of the determined target line, is the vector from point P to point X, and O is the projection point of vertex X on the target line. The ratio of the length of the projection of the vector in the direction of the vector to the length of the vector can be obtained by calculating the ratio of the dot product of the vector and the square of the vector modulus (see formula (III)):

[0168]

[0169] By respectively multiplying the ratio t with the length of the vector components for the model coordinate system x-axis, y-axis, and z-axis, we can obtain the vector of the projection point from the target coordinate to the vertex on the target line. By summing the target coordinate with this vector, we can obtain the coordinates of the projection point of the vertex on the target line (see formula (IV)):

[0170]

[0171] Among them, refers to the coordinates of the projection point of the vertex on the target line on the i-axis (i can be x, y or z), refers to the value of the target coordinates on the i-axis, refers to the component vector of the direction vector of the target line on the i-axis, and t refers to the ratio.

[0172] After obtaining the coordinates of the projection point of the vertex on the target line, the third distance from the vertex to the target line can be calculated based on the coordinates of the vertex and the coordinates (see formula (V)):

[0173] D=|XO|Formula (V)

[0174] Take the vertex whose third distance is less than the third distance threshold as the second target vertex, refer to Fig.17 As shown in FIG. , an example of the second target vertex is obtained. It should be noted that, Fig.18 As shown in , the target line may pass through both the side of the 3D mesh model facing the camera (front) and the side facing away from the camera (back). The position of the camera can be found in Fig.19 As shown in the figure, the black sphere is the camera. Since the operator generally needs to select the point on the front side, the second target vertex obtained on the back side needs to be deleted. The distance from each second target vertex to the camera coordinates can be calculated, and two distance intervals can be divided according to the distance. The second target vertices in the distance interval with a larger distance can be deleted, so that only the second target vertices on the front side are retained.

[0175] For any second target vertex, the projection point of the target coordinate corresponding to the normal of the second target vertex can be obtained according to the normal and coordinates of the second target vertex. Only the second target vertex closest to the target coordinate can be selected to calculate the projection point, and the projection point can be used as the middle point of the curve; or, the projection point of the target coordinate corresponding to each second target vertex normal can be calculated respectively, and the average of the coordinates of each projection point can be used as the middle point of the curve. This embodiment of the application does not specifically limit this.

[0176] Reference Fig. 20As shown in FIG. 1 , a method of calculating the projection point of the target coordinates according to the normal and coordinates of the second target vertex. In the figure, X is the second target vertex, is the normal of the second target vertex, is the direction vector of the target line, is the vector from point P to point X, and O is the middle point of the curve. By calculating the dot product of the vector and the vector divided by the dot product of the vector and the vector, the ratio m of the projection length of the vector in the direction of the vector and the projection length of the vector in the direction of the vector can be obtained (see formula (VI)):

[0177]

[0178] By enlarging the vector by the ratio m, we can get the vector from point P to the tangent plane surface. By summing the coordinates of point P and the enlarged vector, we can get the coordinates of the middle point of the curve (see formula (VII)):

[0179]

[0180] Among them, refers to the coordinates of the middle point of the curve on the i-axis (i can be x, y or z), refers to the value of the target coordinates on the i-axis, refers to the component vector of the direction vector of the target line on the i-axis, and m refers to the ratio.

[0181] It should be noted that the starting point of the curve corresponding to the click point of the mouse in the above embodiment can also be obtained in the above manner. That is, the click point of the mouse is used as the above target point, and the starting point of the curve corresponding to the click point is the intersection of the target line determined by the target point and the three-dimensional grid model.

[0182] The curve drawing method provided in the embodiment of the present application obtains the target point from the moving path of the mouse pointer, generates the target straight line and determines the second target vertex according to the target point, determines the projection point of the normal of each second target vertex corresponding to the target point, and then determines the middle point of the curve corresponding to the target point on the surface of the three-dimensional mesh model according to each projection point. Since the cutting plane is close to the surface of the three-dimensional mesh model, the embodiment of the present application can obtain the coordinates of the middle point of the curve with accuracy that meets the requirements without the need to determine the exact position of the middle point of the curve through complex calculations, which can speed up the speed of determining the middle point of the curve, thereby improving the speed of drawing the curve.

[0183] In one embodiment, Fig.21 As shown, in step 1404, based on the target coordinates, the target straight line, the normals of each second target vertex and the coordinates of each second target vertex, the middle point of the curve corresponding to the target point on the surface of the three-dimensional mesh model is determined, including:

[0184] Step 2102, for any second target vertex, determine the projection coordinates of the target point based on the target coordinates, the target straight line, the normal of the second target vertex and the coordinates of the second target vertex.

[0185] Step 2104: Determine the middle point of the curve corresponding to the target point on the surface of the three-dimensional mesh model according to the average value of the projection coordinates corresponding to each second target vertex.

[0186] In the embodiment of the present application, the projection coordinates of the target coordinates on the tangent planes of each second target vertex can be calculated respectively, and the coordinates of the middle point of the curve can be determined according to the average value of each projection coordinate. This is because the target coordinates may be far away from the surface of the three-dimensional mesh model, so it is not possible to determine in a simple way which second target vertex tangent plane the projection point of the target coordinates on will be closest to the surface of the three-dimensional mesh model. By calculating the coordinates of the middle point of the curve according to the average value of each projection coordinate, the accuracy of determining the middle point of the curve can be improved while reducing the amount of calculation.

[0187] For any second target vertex, the projection coordinates of the target point on the tangent plane of the second target vertex can be determined based on the coordinates and normal of the second target vertex. The calculation method of the projection coordinates can refer to the above-mentioned embodiment, and the embodiment of the present application will not be repeated here. After obtaining multiple projection coordinates, the x-axis coordinate of the midpoint of the curve can be obtained according to the average value of the values ​​of each projection coordinate on the x-axis; the y-axis coordinate of the midpoint of the curve can be obtained according to the average value of the values ​​of each projection coordinate on the y-axis; the z-axis coordinate of the midpoint of the curve can be obtained according to the average value of the values ​​of each projection coordinate on the z-axis, and then the midpoint of the curve is obtained.

[0188] The curve drawing method provided in the embodiment of the present application determines the projection coordinates of the target point on the tangent plane where each second target vertex is located, and then determines the middle point of the curve corresponding to the target point on the surface of the three-dimensional mesh model according to the average value of each projection coordinate. Since the target point may be far away from the surface of the three-dimensional mesh model, each projection coordinate corresponding to the target point may have a certain deviation from the surface of the three-dimensional mesh model. By averaging each projection coordinate, the deviation can be reduced, and the accuracy of determining the middle point of the curve can be improved while ensuring a low amount of calculation.

[0189] In one embodiment, Fig. 22 As shown, in step 1404, after determining the second target vertex whose third distance to the target straight line is less than the third distance threshold according to the third distance between each vertex and the target straight line, the method further includes:

[0190] Step 2202: cluster each second target vertex to obtain at least one clustering result, and acquire the cluster center of each clustering result.

[0191] Step 2204, respectively determine the fourth distances between each cluster center and the camera coordinates, and use the clustering result where the cluster center corresponding to the shortest fourth distance among the fourth distances is located as the first target clustering result, and use the clustering results other than the first target clustering result as the second target clustering result.

[0192] Step 2206: delete the second target vertices in each second target clustering result from each second target vertex.

[0193] In an embodiment of the present application, the second target vertices on the back side can be deleted by clustering. By clustering the second target vertices, at least one clustering result can be determined. Since the distance between the vertices is negligible compared to the distance between the front and back sides of the three-dimensional mesh model, the vertices in a clustering result must be vertices located on the same face of the three-dimensional mesh model. In this way, the clustering result closest to the camera, that is, the clustering result located on the front side of the three-dimensional mesh model, can be determined based on the distance between each clustering result and the camera.

[0194] The cluster center of each clustering result can be obtained respectively (when using an algorithm such as the k-means clustering algorithm that performs clustering based on the cluster center, the cluster center determined by the algorithm can be used; when using an algorithm such as the hierarchical clustering algorithm that does not have a cluster center, the cluster center can be calculated based on the coordinate mean of each second target vertex in the cluster), and the fourth distance between the cluster center and the camera coordinates is calculated as the distance between the clustering result and the camera, refer to Fig.23 The figure shows an example of the obtained clustering results and cluster centers. The clustering result with the smallest fourth distance is the clustering result located on the front of the three-dimensional mesh model. The second target vertex in the clustering result (first clustering result) is retained, and the second target vertices in other clustering results (second target results) are deleted, so that the second target vertices located on the front of the three-dimensional mesh model can be screened out. After obtaining the second target vertices on the front, the middle point of the curve can be determined based on each second target vertex, such as Fig.24 shown.

[0195] The curve drawing method provided in the embodiment of the present application clusters the second target vertices and deletes the other second target vertices except the clustering results closest to the camera, so that only the second target vertices on the front surface of the teeth can be retained, avoiding the second target vertices on other surfaces from interfering with the calculation of the midpoint of the curve.

[0196] In one embodiment, Fig.25 As shown, in step 108, after generating the target curve according to each fitting point and each projection point, the method further includes:

[0197] Step 2502, when a mouse click is detected, obtain a modification point corresponding to the mouse click point from the surface of the three-dimensional mesh model, and determine the fifth distance between the modification point and the target curve.

[0198] Step 2504: when the fifth distance is less than the fifth distance threshold, determine two first connection points corresponding to the modification point on the target curve.

[0199] Step 2506: construct a first update line based on the two first connection points and the modification point, and update the target curve based on the first update line.

[0200] In the embodiment of the present application, after the target curve is drawn, the operator can modify the target curve by clicking. When the mouse click is detected, the method of obtaining the middle point of the curve corresponding to the target point in the aforementioned embodiment can be referred to to obtain the modification point corresponding to the mouse click point on the surface of the three-dimensional mesh model, and when the fifth distance between the modification point and the target curve is small, the target curve is modified according to the modification point. The embodiment of the present application does not specifically limit the method of determining the fifth distance. For example, the point on the target curve closest to the modification point (the point on the target curve includes the fitting point and the projection point) can be determined, and the distance between the point and the modification point is used as the fifth distance; or the curve expression of the target curve in three-dimensional space can be determined, and the projection point of the modification point on the curve is calculated according to the curve expression, and the distance between the modification point and the projection point is used as the fifth distance.

[0201] When the fifth distance is less than the fifth distance threshold (the value can be preset by those skilled in the art), it is necessary to determine two first connection points on the target curve so as to update the target curve by constructing a first update line passing through the two first connection points and the modification point. Exemplarily, a preset angle can be set in advance, and a straight line perpendicular to the target curve and passing through the modification point is used as the baseline. Straight lines passing through the modification point and having an angle of preset angle with the baseline are determined on the left and right sides of the baseline, respectively, and then the intersection points of the two straight lines with the target curve are respectively used as the first connection points, so that the curvature of the update line remains constant; or, referring to Fig.26 As shown, you can also preset the preset distance ( Fig.26 The preset distance R in should be greater than the fifth distance threshold. Fig.26 D in is the fifth distance), and the modification point ( Fig.26 Draw a circle with the preset distance as the radius and the two intersection points of the circle and the target curve as the first connection points ( Fig.26It should be noted that the above are only two examples of determining the first connection point. In fact, the first connection point can also be determined by other methods. The embodiment of the present application does not specifically limit the method of determining the first connection point.

[0202] After determining the first connection point, a spline curve can be fitted based on the first connection point and the modification point, and then the interpolation point can be taken from the spline curve with reference to the method in the aforementioned embodiment, and the interpolation point is projected onto the surface of the three-dimensional mesh model, and then the first update line is obtained based on the projection points, the first connection point and the modification point. The target curve between the two first connection points can then be deleted (since the target curve is a closed figure, the two first connection points will divide the target curve into a shorter line segment and a longer line segment, and both line segments belong to the target curve between the two first connection points by definition. Since the purpose of modification is generally to modify the shorter line segment, only the shorter part of the target curve between the two first connection points can be deleted here). The first update line is connected to the deleted part of the curve to complete the modification of the curve. Refer to Fig. 27 The following is a schematic diagram of the effect of clicking Modify.

[0203] The curve drawing method provided in the embodiment of the present application determines the modification point and two first connection points on the target curve, constructs a first update line based on the modification point and the two first connection points, and updates the target curve. After the target curve is drawn, it can support modifying the target curve by clicking to modify.

[0204] In one embodiment, Fig.28 As shown, in step 208, after generating the target curve according to each fitting point and each projection point, the method further includes:

[0205] Step 2802, when the mouse movement is detected, determine the second movement path of the mouse pointer, determine the modification line corresponding to the second movement path from the surface of the three-dimensional mesh model, and determine the sixth distance between the modification line and the target curve.

[0206] Step 2804: When the sixth distance is less than the sixth distance threshold, determine two second connection points corresponding to the modification line on the target curve.

[0207] Step 2806: construct a second update line based on the two second connection points and the modification line, and update the target curve based on the second update line.

[0208] In the embodiment of the present application, after the target curve is drawn, the operator can modify the target curve by drawing a line. For example, the operator can start the line drawing modification by clicking the mouse to indicate, and draw a line on the screen by moving the mouse; the terminal can start detecting the second moving path of the mouse pointer when the mouse click is detected, and grab multiple target points from the second moving path, and then refer to the method of obtaining the middle point of the curve according to the target point in the above embodiment, and then generating the target curve according to the middle point of the curve, and generate a modification line according to the target point grabbed from the second moving path, and when the sixth distance between the modification line and the target curve is small, the target curve is modified according to the modification line. The embodiment of the present application does not specifically limit the method of determining the sixth distance. For example, the distance between the point closest to the point on the target curve and the point can be determined for any point on the modification line, and the distances corresponding to all points are used as the sixth distance (there are multiple sixth distances), or the average value of the distances corresponding to all points is used as the sixth distance (there is only one sixth distance); or the two endpoints of the modification line can be respectively determined for the two endpoints of the target curve The point closest to the endpoint is determined, and the distance between the endpoint and the point closest to the endpoint is used as the sixth distance.

[0209] When the sixth distance is less than the preset sixth distance threshold (if there are multiple sixth distances, all sixth distances may be less than the sixth distance threshold, or any sixth distance may be less than the sixth distance threshold), two second connection points need to be determined from the target curve, so as to update the target curve by connecting the two second connection points and the update line. An extension line of the update line may be constructed according to the arc of the update line at the endpoint, and the intersection of the extension line and the target curve may be used as the second connection point. Or as Fig.29 As shown, you can also set the distance endpoint ( Fig.29 The closest point between EP1 and EP2 in the figure is used as the second connection point ( Fig.29 FP1 and FP2 in the figure, D1 is the distance between EP1 and FP1, and D2 is the distance between EP2 and FP2), which is not specifically limited in the embodiments of the present application.

[0210] After determining the second connection point, for any endpoint of the update line, the update line and the second connection point can be connected by a line segment, and referring to the method of projecting the spline curve onto the surface of the three-dimensional mesh model in the above embodiment, the line segment connecting the endpoint and the second connection point is also projected onto the surface of the three-dimensional mesh model to construct the second update line. The shorter part of the target curve between the two second connection points can be deleted to obtain the updated target curve. Fig.30 The figure below is a schematic diagram of the effect of drawing a line to modify the target curve.

[0211] The curve drawing method provided in the embodiment of the present application determines a modification line and two second connection points on the target curve, constructs a second update line based on the modification point and the two second connection points, and updates the target curve. After the target curve is drawn, it can support modifying the target curve by drawing a line.

[0212] In one embodiment, Fig.31 As shown, in step 108, after generating the target curve according to each fitting point and each projection point, the method further includes:

[0213] Step 3102, determining a first point to be detected on the target curve, and determining a first line segment and a second line segment corresponding to the first point to be detected, wherein the second line segment is a curve in the target curve other than the first line segment.

[0214] Step 3104, traverse the second points to be detected in the second line segment, and for any second point to be detected, determine the seventh distance between the second point to be detected and the first point to be detected, and when the seventh distance is less than the seventh distance threshold, generate and display prompt information, wherein the prompt information is used to indicate that the target curve has self-intersection.

[0215] In the present application embodiment, Fig.32 As shown, after the target curve forms a closed figure, there may be abnormal self-intersecting parts in the target curve, so it is necessary to perform self-intersection detection on the target curve, and when it is detected that the target curve has self-intersection, the operator is prompted to eliminate the self-intersecting part by modification.

[0216] You can determine whether the target curve has self-intersection by traversing each point on the target curve and detecting whether there are other line segments close to the point except the line segment where the traversed point is located. The first point to be detected is any point on the target curve. Fig.33 As shown, the preset distance can be set by Fig.33 R in, draw a circle with the first point to be detected as the center and the preset distance as the radius, take the two intersection points of the circle and the target curve as the endpoints of the first line segment, take the shorter section of the curve between the two endpoints as the first line segment, and take the longer section of the curve between the two endpoints as the second line segment.

[0217] It should be noted that, refer to Fig.33 As shown in the figure, there may be more than two intersection points between the circle and the target curve. In this case, two points can be randomly selected from the intersection points as endpoints, which will not affect the effect of self-intersection detection.

[0218] The second point to be detected is any point on the second line segment. Traverse each second point to be detected and determine the seventh distance between the second point to be detected and the first point to be detected ( Fig.33D), and determine whether the seventh distance is less than the seventh distance threshold. The seventh distance threshold is a preset value, which can take a smaller value slightly larger than the distance between vertices, such as 0.05mm. When the seventh distance is less than the seventh distance threshold, it means that the second line segment is relatively close to the first line segment at the first point to be detected. Since the second line segment is generally not parallel to the first line segment in the normal drawing of the target curve, and the distance between the two is less than the seventh distance threshold, it can be determined that the second line segment and the first line segment intersect when the seventh distance is less than the seventh distance threshold. At this time, a prompt message indicating that the target curve has self-intersection can be generated, and the prompt message can be displayed so that the operator can modify the target curve.

[0219] The curve drawing method provided in the embodiment of the present application determines the first line segment and the second line segment, and determines whether there is an intersection between the first line segment and the second line segment by determining the distance between the first line segment and the second line segment, and then outputs a prompt message when there is an intersection, which can prevent the operator from mistakenly saving a self-intersecting curve.

[0220] It should be understood that, although the various steps in the flowcharts involved in the above-mentioned embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.

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

[0222] In one embodiment, Fig.34 As shown, a curve drawing device 3400 is provided, comprising: a first acquisition module 3402, a first determination module 3404, a fitting module 3406, a second determination module 3408, and a generation module 3410, wherein:

[0223] A first acquisition module 3402 is used to acquire a curve starting point and add the curve starting point as a fitting point;

[0224] A first determination module 3404 is used to obtain a first moving path of the mouse pointer, and determine at least one curve middle point corresponding to the first moving path from the surface of the three-dimensional mesh model, and add each of the curve middle points as the fitting point;

[0225] A fitting module 3406, configured to obtain a spline curve by fitting the fitting points and obtain interpolation points on the spline curve;

[0226] A second determination module 3408, configured to respectively determine the projection point of each interpolation point on the surface of the three-dimensional mesh model;

[0227] The generating module 3410 is used to generate a target curve according to each of the fitting points and each of the projection points.

[0228] The curve drawing device provided in the embodiment of the present application tracks the moving path of the mouse, performs spline curve fitting on the fitting points on the path, and then projects the spline curve onto the surface of the three-dimensional grid model by projecting the interpolation points in the spline curve onto the surface of the three-dimensional grid model, thereby obtaining the target curve. The embodiment of the present application does not completely rely on the selection of fitting points when generating the curve, but grabs the interpolation points from the spline curve after generating the spline curve according to the fitting points for the first time, and projects the interpolation points onto the surface of the three-dimensional grid model, thereby obtaining projection points other than multiple fitting points. Since the projection points correspond to the positions of the original spline curve, are located on the surface of the three-dimensional grid model, and are relatively large in number, the curve is generated according to the projection points and the fitting points, and while retaining the characteristics of the original spline curve generated according to the fitting points, the spacing between the points on the curve can be reduced, so that the curve generated according to the points is more in line with the three-dimensional grid model.

[0229] In one embodiment, the device further comprises:

[0230] A first processing module, configured to jump to the step of obtaining a first moving path of a mouse pointer when the end point of the target curve does not coincide with the starting point of the curve, until the end point of the target curve coincides with the starting point of the curve;

[0231] The second processing module is used to use the target curve as the final drawn curve.

[0232] In one embodiment, the second determining module 3408 is further configured to:

[0233] For any of the interpolation points, first distances between each vertex of the three-dimensional mesh model and the interpolation point are determined respectively, and a first target vertex is determined from each of the vertices according to each of the first distances;

[0234] Based on the coordinates of the interpolation point, the coordinates of the first target vertex, and the normal of the first target vertex, a projection point of the interpolation point on the surface of the three-dimensional mesh model is determined.

[0235] In one embodiment, the device further comprises:

[0236] A third determining module, used to determine a second distance between every two adjacent interpolation points;

[0237] An adding module is used to determine a new interpolation point from the spline curve between the two target interpolation points when there are two target interpolation points, and add the new interpolation point to each of the interpolation points, wherein the two target interpolation points are adjacent and the second distance between the two target interpolation points is greater than a second distance threshold; jump to the step of determining the second distance between every two adjacent interpolation points until there are no target interpolation points.

[0238] In one embodiment, the first determining module 3404 is further configured to:

[0239] According to a preset target point acquisition strategy, acquiring at least one target point from the first moving path;

[0240] For any of the target points, based on the camera coordinates in the model coordinate system and the target coordinates of the target point in the model coordinate system, a target straight line passing through the camera coordinates and the target coordinates is obtained, and according to the third distance between each vertex of the three-dimensional mesh model and the target straight line, a second target vertex whose third distance to the target straight line is less than a third distance threshold is determined, and based on the target coordinates, the target straight line, the normal of each of the second target vertices and the coordinates of each of the second target vertices, the middle point of the curve corresponding to the target point on the surface of the three-dimensional mesh model is determined, and the model coordinate system is the coordinate system where the three-dimensional mesh model is located.

[0241] In one embodiment, the first determining module 3404 is further configured to:

[0242] For any second target vertex, determining the projection coordinates of the target point based on the target coordinates, the target straight line, the normal of the second target vertex and the coordinates of the second target vertex;

[0243] The middle point of the curve corresponding to the target point on the surface of the three-dimensional mesh model is determined according to the average value of the projection coordinates corresponding to each of the second target vertices.

[0244] In one embodiment, the device further comprises:

[0245] A clustering module, used for performing clustering processing on each of the second target vertices to obtain at least one clustering result, and obtaining a cluster center of each of the clustering results;

[0246] a fourth determination module, configured to respectively determine fourth distances between each of the cluster centers and the camera coordinates, and use the clustering result where the cluster center corresponding to the shortest fourth distance among the fourth distances is located as the first target clustering result, and use the clustering results other than the first target clustering result as the second target clustering result;

[0247] The deleting module is used to delete the second target vertices in each of the second target clustering results from each of the second target vertices.

[0248] In one embodiment, the device further comprises:

[0249] A second acquisition module is used to acquire, when a mouse click is detected, a modification point corresponding to the click point of the mouse from the surface of the three-dimensional mesh model, and determine a fifth distance between the modification point and the target curve;

[0250] A fifth determining module, configured to determine, when the fifth distance is less than a fifth distance threshold, two first connection points corresponding to the modification point on the target curve;

[0251] The first updating module is used to construct a first updating line based on the two first connecting points and the modification point, and to update the target curve based on the first updating line.

[0252] In one embodiment, the device further comprises:

[0253] a sixth determination module, configured to determine, when detecting the movement of the mouse, a second movement path of the mouse pointer, determine a modification line corresponding to the second movement path from the surface of the three-dimensional mesh model, and determine a sixth distance between the modification line and the target curve;

[0254] A seventh determination module, configured to determine two second connection points corresponding to the modification line on the target curve when the sixth distance is less than a sixth distance threshold;

[0255] The second updating module is used to construct a second updating line based on the two second connection points and the modification line, and to update the target curve based on the second updating line.

[0256] In one embodiment, the device further comprises:

[0257] an eighth determination module, configured to determine a first to-be-detected point on the target curve, and determine a first line segment and a second line segment corresponding to the first to-be-detected point, wherein the second line segment is the target curve other than the first line segment in the target curve;

[0258] A ninth determination module is used to traverse the second points to be detected in the second line segment, determine the seventh distance between the second point to be detected and the first point to be detected for any second point to be detected, and generate and display prompt information when the seventh distance is less than the seventh distance threshold, wherein the prompt information is used to indicate that the target curve has self-intersection.

[0259] Each module in the above-mentioned curve drawing device can be implemented in whole or in part by software, hardware and a combination thereof. Each of the above-mentioned modules can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute the operations corresponding to each of the above modules.

[0260] In one embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as follows: Fig.35 As shown. The computer device includes a processor, a memory and a network interface connected through a system bus. Among them, 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 and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The network 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 curve drawing method is implemented.

[0261] Those skilled in the art will understand that Fig.35 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.

[0262] In one embodiment, a computer device is 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.

[0263] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps in the above-mentioned method embodiments are implemented.

[0264] In one embodiment, a computer program product is provided, including a computer program, which implements the steps in the above method embodiments when executed by a processor.

[0265] 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.

[0266] Those skilled 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), magnetoresistive 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. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. 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 are not limited to this.

[0267] 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.

[0268] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.

Claims

1. A curve drawing method, characterized in that: The method comprises: Obtaining a curve starting point, and adding the curve starting point as a fitting point; Acquire a first moving path of the mouse pointer, and determine at least one curve middle point corresponding to the first moving path from the surface of the three-dimensional mesh model, and add each of the curve middle points as the fitting point; Fitting a spline curve according to the fitting points, and obtaining interpolation points on the spline curve; Respectively determine the projection point of each interpolation point on the surface of the three-dimensional grid model; A target curve is generated according to each of the fitting points and each of the projection points.

2. The method according to claim 1, characterized in that After generating the target curve according to the fitting points and the projection points, the method further includes: In the case that the end point of the target curve does not coincide with the starting point of the curve, jump to the step of obtaining the first moving path of the mouse pointer until the end point of the target curve coincides with the starting point of the curve; The target curve is taken as the final curve drawn.

3. The method according to claim 1, characterized in that The step of respectively determining the projection points of each interpolation point on the surface of the three-dimensional mesh model comprises: For any of the interpolation points, first distances between each vertex of the three-dimensional mesh model and the interpolation point are determined respectively, and a first target vertex is determined from each of the vertices according to each of the first distances; Based on the coordinates of the interpolation point, the coordinates of the first target vertex, and the normal of the first target vertex, a projection point of the interpolation point on the surface of the three-dimensional mesh model is determined.

4. The method according to claim 1, characterized in that: After obtaining each interpolation point on the spline curve, the method further includes: Determine a second distance between every two adjacent interpolation points; In the case where there are two target interpolation points, determining a new interpolation point from the spline curve between the two target interpolation points, and adding the new interpolation point to each of the interpolation points, wherein the two target interpolation points are adjacent and a second distance between the two target interpolation points is greater than a second distance threshold; Jump to the step of determining the second distance between every two adjacent interpolation points until the target interpolation point does not exist.

5. The method according to claim 1, characterized in that The step of determining at least one curve middle point corresponding to the first moving path from the surface of the three-dimensional grid model comprises: According to a preset target point acquisition strategy, acquiring at least one target point from the first moving path; For any of the target points, based on the camera coordinates in the model coordinate system and the target coordinates of the target point in the model coordinate system, a target straight line passing through the camera coordinates and the target coordinates is obtained, and according to the third distance between each vertex of the three-dimensional mesh model and the target straight line, a second target vertex whose third distance to the target straight line is less than a third distance threshold is determined, and based on the target coordinates, the target straight line, the normal of each of the second target vertices and the coordinates of each of the second target vertices, the middle point of the curve corresponding to the target point on the surface of the three-dimensional mesh model is determined, and the model coordinate system is the coordinate system where the three-dimensional mesh model is located.

6. The method according to claim 5, characterized in that The step of determining the middle point of the curve corresponding to the target point on the surface of the three-dimensional mesh model based on the target coordinates, the target straight line, the normal of each second target vertex, and the coordinates of each second target vertex includes: For any second target vertex, determining the projection coordinates of the target point based on the target coordinates, the target straight line, the normal of the second target vertex and the coordinates of the second target vertex; The middle point of the curve corresponding to the target point on the surface of the three-dimensional mesh model is determined according to the average value of the projection coordinates corresponding to each of the second target vertices.

7. The method according to claim 5 or 6, characterized in that: After determining, based on the third distances between each of the vertices and the target straight line, a second target vertex whose third distance to the target straight line is less than a third distance threshold, the method further includes: Performing clustering processing on each of the second target vertices to obtain at least one clustering result, and acquiring a cluster center of each of the clustering results; Determine the fourth distances between each cluster center and the camera coordinates respectively, and use the clustering result where the cluster center corresponding to the shortest fourth distance among the fourth distances is located as the first target clustering result, and use the clustering results other than the first target clustering result as the second target clustering result; The second target vertices in each of the second target clustering results are deleted from each of the second target vertices.

8. The method according to claim 1, characterized in that After generating the target curve according to the fitting points and the projection points, the method further includes: When a mouse click is detected, acquiring a modification point corresponding to the click point of the mouse from the surface of the three-dimensional mesh model, and determining a fifth distance between the modification point and the target curve; When the fifth distance is less than a fifth distance threshold, determining two first connection points corresponding to the modification point on the target curve; A first update line is constructed based on the two first connection points and the modification point, and the target curve is updated based on the first update line.

9. The method according to claim 1, characterized in that: After generating the target curve according to the fitting points and the projection points, the method further includes: In the case of detecting the movement of the mouse, determining a second movement path of the mouse pointer, determining a modification line corresponding to the second movement path from the surface of the three-dimensional mesh model, and determining a sixth distance between the modification line and the target curve; When the sixth distance is less than a sixth distance threshold, determining two second connection points corresponding to the modification line on the target curve; A second update line is constructed based on the two second connection points and the modification line, and the target curve is updated based on the second update line.

10. The method according to claim 1, characterized in that After generating the target curve according to the fitting points and the projection points, the method further includes: Determine a first point to be detected on the target curve, and determine a first line segment and a second line segment corresponding to the first point to be detected, wherein the second line segment is a curve in the target curve other than the first line segment; The second points to be detected in the second line segment are traversed, and for any second point to be detected, a seventh distance between the second point to be detected and the first point to be detected is determined, and when the seventh distance is less than a seventh distance threshold, prompt information is generated and displayed, wherein the prompt information is used to indicate that the target curve has self-intersection.

11. A curve drawing device, characterized in that: The device comprises: A first acquisition module, used for acquiring a starting point of a curve and adding the starting point of the curve as a fitting point; A first determination module is used to obtain a first moving path of the mouse pointer, and determine at least one curve middle point corresponding to the first moving path from the surface of the three-dimensional mesh model, and add each of the curve middle points as the fitting point; A fitting module, used to fit a spline curve according to the fitting points and obtain interpolation points on the spline curve; A second determination module, used to respectively determine the projection point of each interpolation point on the surface of the three-dimensional grid model; A generating module is used to generate a target curve according to each of the fitting points and each of the projection points.

12. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 10 are implemented.

13. 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 method according to any one of claims 1 to 10 are implemented.

14. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 10 are implemented.

Citation Information

Cited By

  • Generation method and device of curved surface model in geometric engine, program product and medium

    CN120411422A