A method and apparatus for generating three-dimensional model lettering and relief
By employing mesh-based geometric processing techniques and the Delaunay triangulation algorithm, the problems of precision and consistency in text engraving on complex 3D models were solved, achieving the effect of accurately engraving text on irregular surfaces.
Patent Information
- Application Number
- CN202411806900.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-10
- Publication Date
- 2025-10-24
- Estimated Expiration
- 2044-12-10
AI Technical Summary
Existing technologies make it difficult to accurately engrave text on complex three-dimensional models, especially on irregular surfaces or grid models with varying curvatures, where it is difficult to ensure accuracy and consistency in the engraving effect.
The geometric processing technology based on the grid method is used to fit the text model to the original model surface through the projection method, and the Delaunay triangulation algorithm is used to fill the empty areas to form a complete model surface.
It enables precise text engraving on complex 3D models, ensuring accurate and natural engraving results while minimizing damage to the original model surface.
Smart Images

Figure CN119672228B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the field of three-dimensional mesh processing and letter engraving in computer graphics, and particularly relates to a method and device for letter engraving on the surface of a three-dimensional mesh model. The present application aims to accurately calculate and process letter models to be engraved on the surface of a three-dimensional mesh model, and to provide high-quality model data for subsequent model processing or three-dimensional printing. BACKGROUND
[0002] Three-dimensional model mesh engraving technology can add more information to a three-dimensional model, and has more important application value in the dental field, especially in personalized modeling and customized repair of teeth. After obtaining various data of a patient's oral cavity through high-precision three-dimensional scanning technology, the data is used to generate a three-dimensional model of the patient's oral cavity. Meanwhile, personalized design and engraving can be performed on the tooth model, such as engraving the patient's name, number or other information on a false tooth, a tooth cover or a tooth corrector.
[0003] Traditional letter engraving relies on manual engraving or machine engraving. These methods are tedious to operate on complex curved surfaces or irregularly shaped surfaces, and it is difficult to ensure the accuracy and consistency of the engraving effect. With the development of computer graphics technology, algorithms can be used to automatically generate accurate letter effects, and the accuracy and naturalness of the engraving effect can be ensured without damaging the original model. However, for complex three-dimensional models, especially mesh models with irregular surfaces or varying curvatures, it is still a challenge to accurately engrave letters on their surfaces. SUMMARY
[0004] To solve the problem of text identification on a three-dimensional model in the prior art, the present application provides a method and device for generating three-dimensional model letter engraving and relief.
[0005] The present application uses a mesh-based geometric processing technique to find the original model triangle patches covered by the letters and the projection positions of the letter model vertices on the original model surface by using projection, so that the letter model is perfectly fitted on the surface of the original model, and at the same time, it is ensured that the surface of the original model will not be damaged. The hollow area generated at the same time is filled using a Delaunay triangulation algorithm to form a complete model surface.
[0006] The technical scheme provided by the present application is as follows:
[0007] The first aspect of the present application relates to a method for generating three-dimensional model letter engraving and relief, comprising the following steps:
[0008] Step 1: Establish a local coordinate system and obtain the position offset of each vertex in the character model through the input character model, starting position, and rotation angle, etc.
[0009] Step 2: Determine the size of the bounding box through the vertex information of the character model, and use the bounding box to perform initial detection on the original model to determine which vertices are within the bounding box.
[0010] Step 3: Add the triangular patches of the character model to the original model, and determine whether they are within the range of the character patches by lifting the initially detected vertices to the same plane as the character patches.
[0011] Step 4: Project the triangular patches of the character model downward and move them to the surface of the original model.
[0012] Step 5: Obtain the outline ring of the character area, determine the relationship between the inner and outer rings, and change the order of the vertex array of the inner and outer rings. The outer ring is counterclockwise, and the inner ring is clockwise.
[0013] Step 6: Construct the edge-point relationship array using the initial inner and outer ring relationship vertex array.
[0014] Step 7: Use the Delaunay triangulation algorithm to perform hole filling operation on the hollow area to form a complete model surface.
[0015] Step 8: Adjust the distance of the character surface extending inward and outward according to the set Distance variable to form a character carving or relief.
[0016] Further, in Step 1, the establishment of a local coordinate system and the obtaining of the position offset of each vertex in the character model through the input character model, starting position, and rotation angle, etc. includes:
[0017] Establishing a local coordinate system for the character area;
[0018] Calculating the position offset of each vertex in the character model;
[0019] The establishment of the local coordinate system for the character area uses the vertices and normal vectors of the triangular patches to construct the local coordinate system. One side of the triangular patch is taken as the Y-axis of the coordinate system, the normal vector is taken as the Z-axis, and the X-axis is obtained by the cross product of the Y and Z axes. Then, the Z-axis is fixed for rotation, and the rotated Y-axis is obtained by multiplying the rotation matrix R with the Y-axis vector. The new X-axis and Y-axis are taken as the X and Y axes during character drawing. ′ ′ ′
[0020] The position offset of each vertex in the text model can be obtained by adding the x, y and z values of all vertices to obtain an average value, which is the center point of the TextMesh vertex, and then subtracting the position of each vertex from the center point to obtain the position offset of each vertex.
[0021] Further, in step 2, the size of the bounding box is determined by the vertex information of the text model, and the original model is initially detected by the bounding box to determine which vertices are within the bounding box, including:
[0022] Determining the size of the bounding box;
[0023] Performing preliminary detection using the bounding box;
[0024] The size of the bounding box is the four bounding vertices of the text model, and the four vertices are moved up and down according to the input FaceHandle corresponding normal vector to obtain eight vertices, which form a complete bounding box.
[0025] The preliminary detection using the bounding box uses the maximum vertex coordinates (XMax, YMax, ZMax) and the minimum vertex coordinates (XMin, YMin, ZMin) of the bounding box as the limit range for breadth search to detect which vertices are within the bounding box.
[0026] Further, in step 3, the triangular faces of the text model are added to the original model, and whether the vertices detected preliminarily are within the range of the text faces is determined by lifting them to the same plane as the text faces, including:
[0027] Adding the triangular faces of the text model to the original model;
[0028] Determining whether the vertices detected preliminarily are within the range of the text faces;
[0029] Adding the triangular faces of the text model to the original model, i.e., using the position offset of each vertex of the text model obtained in step 1 to add the vertices to the original model.
[0030] Determining whether the vertices detected preliminarily are within the range of the text faces, there are two cases: 1. The vertices of the triangular faces are directly located within the triangular faces of the text model; 2. The vertices of the text model are within the triangular faces of the original model. Vector cross product method and triangular area method can also be used for determination.
[0031] Further, in step 4, the triangular faces of the text model are projected downward and moved to the surface of the original model, including:
[0032] Calculating the distance from each vertex of the text model to the surface of the original model;
[0033] Moving the text model to the surface of the original model;
[0034] The distance between the text model and the original model surface is calculated by taking the opposite of the normal vector of the initial triangle and extending along the normal vector direction from the text model vertex as the starting point to find the intersection point with the original model surface.
[0035] Moving the text model to the surface of the original model, i.e. using the distance calculated above, moving the corresponding distance in the opposite direction of the normal vector.
[0036] Further, in step 5, the contour ring of the text region is obtained, the inner and outer ring relationship is judged, and the inner and outer ring vertex array order is changed, including:
[0037] Obtaining the contour ring of the text region
[0038] Judging whether each ring in the text region is inside other rings and the number of rings;
[0039] Changing the inner and outer ring vertex array order according to the inner and outer ring;
[0040] Obtaining the contour ring of the text region, and traversing along the boundary edge to obtain the complete boundary ring.
[0041] Judging the inner and outer ring relationship of the text region, which can be judged by the sum of angles. If the sum of angles is equal to 2π, it means that the vertex is inside the ring; if the sum of angles is equal to 0, it means that the vertex is outside the ring. If the vertex is inside the other ring, it means that the ring is inside the other ring.
[0042]
[0043] Further, in step 6, the initial inner and outer ring relationship vertex array is constructed into an edge-point relationship array, including: using two two-dimensional arrays and one one-dimensional array for storage, and the lengths of the three arrays correspond to the inner and outer ring pairs, that is, how many times of hole filling operation is needed.
[0044] Further, in step 7, the hole filling operation on the hole region includes: using the Delaunay triangulation algorithm to fill the hole region formed by each inner and outer ring pair to form a complete model surface, including:
[0045] Traversing each pair of inner and outer rings according to the data structure established in step 6;
[0046] A Delaunay triangulation algorithm is used to perform a hole filling operation on the hole region.
[0047] Further, in step 8, according to the set Distance variable, the distance of the text surface extending inwards and outwards is adjusted to form text engraving or relief, including:
[0048] The text internal triangular facets are extended inwards or outwards according to the set value;
[0049] The extended triangular facets are connected with the original model surface;
[0050] A second aspect of the present application relates to a device for generating text engraving and relief of a three-dimensional model, comprising a memory and one or more processors, the memory storing executable code, and the one or more processors executing the executable code to implement the above-mentioned text engraving and relief generation method.
[0051] A third aspect of the present application relates to a computer readable storage medium, the medium storing a computer program for executing the above-mentioned method.
[0052] The present application provides a method and device for generating text engraving and relief of a three-dimensional model, which preliminarily detects by establishing a bounding box, distinguishes the original model triangular facets that may be within the text range, reduces the number of subsequent traversed original model vertices and triangular facets, and uses a ray intersection method to project the text onto the original model surface, so that the text does not damage the original model surface, and ensures the accuracy and naturalness of the effect.
[0053] The present application has the advantages that: the bounding box is established for preliminary detection, the number of subsequent traversed is reduced, and the text is projected onto the original model surface, so that the text does not damage the original model surface, and ensures the accuracy and naturalness of the effect. BRIEF DESCRIPTION OF DRAWINGS
[0054] Figure 1 is a schematic view of a triangular facet vertex in the region in the embodiment of the present application;
[0055] Figure 2 is a schematic view of a region vertex in a triangular facet in the embodiment of the present application;
[0056] Figure 3 is a schematic view of a vertex p in a triangular facet in the embodiment of the present application;
[0057] Figure 4 is a schematic view of a vertex p outside a triangular facet in the embodiment of the present application;
[0058] Figure 5 is a schematic view of a vertex p inside a triangular facet in the embodiment of the present application;
[0059] Figure 6 is a schematic diagram of a cross product vector when the vertex p is outside the triangle in an embodiment of the present application;
[0060] Figure 7 is a schematic diagram of an area comparison when the vertex p is inside in an embodiment of the present application;
[0061] Figure 8 is a schematic diagram of an area comparison when the vertex p is outside in an embodiment of the present application;
[0062] Figure 9 is a schematic diagram of the vertex of the text fitting the surface of the original model in an embodiment of the present application;
[0063] Figure 10 is a schematic diagram of the inner and outer rings in an embodiment of the present application;
[0064] Figure 11 is a schematic diagram of the point p inside the polygon in an embodiment of the present application;
[0065] Figure 12 is a schematic diagram of the point p outside the polygon in an embodiment of the present application;
[0066] Figure 13 is a schematic diagram of the hollow area after filling in an embodiment of the present application;
[0067] Figure 14 is a flowchart of the method of the present application. DETAILED DESCRIPTION
[0068] In order to more clearly understand the above-mentioned purposes, features and advantages of the present disclosure, the embodiments of the present disclosure and the features in the embodiments will be further described below with reference to the drawings of the present disclosure.
[0069] It should be noted that the expressions "first", "second", etc. mentioned in the present disclosure are only for the purpose of description, and cannot be understood as limiting the described objects to have a sequential order or a mutually dependent relationship.
[0070] Embodiment 1
[0071] The method for generating a three-dimensional model text engraving and relief related to the present embodiment includes the following steps.
[0072] Step 1: By inputting the text model, the starting position, the rotation angle and other information, a local coordinate system is established and the position offset of each vertex in the text model is obtained.
[0073] The present application uses OpenMesh as a bottom layer to support processing of a model mesh, and receives input of a mesh model data Mesh read by OpenMesh, a text model TextMesh, a triangle face FaceHandle in the starting position Mesh, and a rotation angle and the like information.
[0074] The input FaceHandle is taken as a reference plane, and a normal vector of the triangle face is taken as a reference normal vector. By taking three vertices of the triangle face as A(x1, y1, z1), B(x2, y2, z2), and C(x3, y3, z3), a barycentric coordinate G(x g ,y g ,z g ) of the triangle face is calculated as a center point of text drawing. For a position offset of each vertex in the TextMesh, an average value of x, y, and z values of all vertices is calculated first, and then a position offset of each vertex is calculated by subtracting the average value from a position of each vertex.
[0075]
[0076] A local coordinate system is constructed by using the vertices and the normal vector of the triangle face. One side of the triangle face is taken as a Y axis of the coordinate system, and the normal vector is taken as a Z axis. An X axis is calculated by a cross product of the Y and Z axes. Then, the Z axis is fixed to rotate, and a rotated Y ′ axis, a new X ′ axis, and a Y ′ axis are calculated by multiplying a rotation matrix R and a Y axis vector. The X and Y axes are taken as X and Y axes of text drawing.
[0077]
[0078] Step 2: A bounding box size is determined by using vertex information of the text model, and the original model is initially detected by using the bounding box to determine which vertices are in the bounding box.
[0079] Since the input TextMesh is a plane model, the Z axis is 0. Four bounding points in the same plane as the TextMesh are obtained first, and then eight vertices are obtained by moving the four points up and down according to the normal vector corresponding to the FaceHandle, so as to form a complete bounding box. Then, a vertex in the FaceHandle is taken as a starting point to perform a breadth search to detect which vertices are in the bounding box.
[0080] Step 3: The triangle face of the text model is added to the original model, and whether the vertices detected initially are in the range of the text face is determined by lifting the vertices to the same plane as the text face.
[0081] The center of gravity of the FaceHandle is extended along the normal vector to get a new plane point, which is used as the center point for the initial drawing of the text model. The text model is drawn on the outer plane using the position offset of each vertex of the text model from the center point obtained in step 1.
[0082] Subsequently, it is necessary to determine which triangular facets are within the coverage of the text model and are deleted in the subsequent steps. Whether a triangular facet is within the coverage of the text model can be determined by moving the three vertices of the triangular facet and the vertex coordinates of the text model to the same plane. Here, two cases need to be determined:
[0083] As shown in Figure 1 , the vertices of the triangular facet are directly inside the triangular facet in the text model;
[0084] As shown in Figure 2 , the vertices in the text model are inside the triangular facet of the original model.
[0085] At the same time, the range of the breadth-first search can be narrowed down using the vertices initially detected in step 2 and the range of the bounding box.
[0086] Determine whether the vertex is inside the triangle, and the combination of embodiments is described with reference to Figure 3 , 4 . As shown in Figure 3 , the vertex p is inside the triangle; as shown in Figure 4 , the vertex p is outside the triangle.
[0087] Vector cross product method: suppose there is a point p and a triangle T a T b T c on a plane, i.e. vectors T a T b , T b T c and T c T a represent the three edges of the triangle. If the point p is inside the triangle, the point p must be on the left side of vectors T a T b , T b T c and T c T a (If the vectors are clockwise, it is the right side). This can be determined by the dot product of vectors T a T b , T b T c and T c T a and Ta p, T b p and T c p, determine whether the three vectors point to the same direction. If they do, point o is inside the triangle (including the case that point o is on the edge of the triangle), otherwise, it is not.
[0088] For a better understanding of the present application, reference will be made to the following examples Figure 5 , 6 . As shown in Fig. 1, point o is inside the triangle, the three vectors cross out by point o; as shown in Fig. 2, point p is outside the triangle, the three vectors cross out by point p. Figure 5 Figure 6
[0089] Triangle area determination method: suppose there is a triangle T a T b T c on a plane, and a point p is connected with each vertex of the triangle, three new triangles are formed, and the areas of the three new triangles and the original triangle T a T b T c are calculated. The sum of the areas of the three new triangles is compared with the area of the original triangle T a T b T c . If the sum of the areas of the three new triangles is equal to the area of the original triangle T a T b T c , point o is inside the triangle (including the case that point p is on the edge of the triangle), if the sum of the areas of the three new triangles is greater than the area of the original triangle T a T b T c , point p is outside the triangle.
[0090] For a better understanding of the present application, reference will be made to the following examples Figure 7 , 8 . As shown in Fig. 3, point p is inside the triangle, the sum of the areas of the three new triangles is equal to the area of the original triangle T Figure 7 Figure 8
[0091] Step 4: project the triangular facets of the text model downward, and move to the surface of the original model.
[0092] At this time, the text model is drawn above the original model and is not associated with the original model. The distance between the vertex of the text model and the surface of the original model needs to be found. The normal vector of the initial triangular facet is reversed, and each vertex of the text model is taken as a starting point to extend along the normal vector direction to find the intersection point with the surface of the original model. The distance between the vertex of the text model and the surface of the original model can be found through the intersection point of the vertex of the text model and the original model.
[0093] Then, each vertex of the text model is moved in the direction opposite to the normal vector by a respective distance, so that each vertex of the text model can be attached to the surface of the original model, and the drawn text will not cause great damage to the surface of the original model. As shown in Figure 9 , the black lines and yellow points in the figure are the edges of the triangular facet and the vertices of the triangular facet, respectively, and the text vertices are completely attached to the surface of the original model.
[0094] In combination with the embodiments, please refer to Figure 9 . As shown in Figure 9 , the text vertices are attached to the surface of the original model.
[0095] Step 5: Obtain the contour ring of the text region, judge the inner and outer ring relationship, and change the order of the vertex array of the inner and outer rings. The outer ring is counterclockwise, and the inner ring is clockwise.
[0096] The boundary ring of the text region needs to be obtained for subsequent filling of the hollow region. The boundary ring must be a ring structure and must be a closed circular ring. The set of boundary points recorded in the previous step can be used, but the boundary points stored therein are not stored in a clockwise or counterclockwise order, so the data needs to be sorted or the boundary point set in a specific order needs to be reacquired. A point can be taken out as a starting boundary point, and all edges associated with the point can be taken out, and then the boundary edges can be taken out. There are only two such edges. Because if a point is a boundary point, there must be two boundary edges on the left and right. At the same time, the HalfEdge (half edge structure) in OpenMesh can be used, but one edge corresponds to two half edges, so the half edge in the clockwise direction needs to be found. The sector angle related to the half edge can be found. If the angle is positive (Angle≥0), it indicates that the angle is counterclockwise (that is, the rotation direction from the first half edge to the second half edge is counterclockwise); if the angle is negative (Angle<0), it indicates that the angle is clockwise (that is, the rotation direction from the first half edge to the second half edge is clockwise). The boundary ring can be obtained by repeatedly performing the step.
[0097] The boundary ring of the text region is obtained, but it cannot be directly used for the subsequent filling of the hole region. The containing relationship between the closed rings must be detected to determine whether the region surrounded by the boundary ring is to be subjected to the subsequent filling operation. Whether a ring of the ring set is inside other rings is detected, and how many other rings it is inside is recorded. If the current ring is inside other rings, it is marked as 2, otherwise it is marked as 1, and how many other rings the current ring is inside is also recorded. For the ring inside other rings, it can also be the outer ring of other rings. That is, whether the current ring is an inner ring or an outer ring can be determined by judging the number of outer rings of the current ring. If the number is odd, the current ring is an inner ring; if the number is even, the current ring is an outer ring. For the even case, it is also necessary to determine whether other rings are inside it. By repeating the above steps, all the inner-outer ring relationships in the text region can be divided. For the ring marked as an outer ring, the point set corresponding to the ring needs to be flipped, and the storage order is reversed to counterclockwise, and the inner ring is clockwise.
[0098] For a better understanding of the present application, reference will be made to the following examples Figure 10 . As Figure 10 shown in the figures, assume that the rings are all labeled. After the method of step 6, 1-(1, 0), 2-(2, 1), 3-(2, 1), 4-(2, 2), 5-(2, 2), 6-(1, 0) are obtained. No. 6 is an independent outer ring, and no. 4 is an outer ring with an inner ring. At the same time, according to the method described in step 6, it can be obtained that no. 2 is an inner ring, and no. 4 and no. 5 are outer rings in the inner ring, so the inner-outer ring pair is 1-2, 1-3, 4, 5, and 6. The no. 1 outer ring corresponds to the no. 2 and no. 3 inner rings, and no. 4, no. 5, and no. 6 are all independent outer rings, corresponding to 4 groups of inner-outer ring relationships.
[0099] Sum of angles judgment method: assume that there is a point p and a polygon ABCDEFGHI on a plane, as shown in Figure 11 . Connect the point p with each vertex of the polygon to form vectors from the point p to each vertex of the polygon. And two adjacent vectors in counterclockwise order form an angle, denoted as a i . If , it means that the point p is outside the polygon region; if , it means that the point p is inside the polygon region (including the boundary edge of the polygon region). Meanwhile, a i can be calculated by the following formula:
[0100]
[0101] For a better understanding of the present application, reference will be made to the following examples Figure 11 , 12 . As Figure 11 shown in the figures, the point p is inside the polygon, and the sum of the angles is equal to 2π; as Figure 12 shown in the figures, the point p is outside the polygon, and the sum of the angles is equal to 0.
[0102] Step 6: Construct the edge-point relationship array from the initial inner-outer loop vertex array.
[0103] The data structure created by the above steps cannot be directly used for the subsequent hole filling algorithm, and further processing is needed to store it using a suitable data structure. Two two-dimensional arrays and one one-dimensional array can be used for storage, and the lengths of the three arrays correspond to the inner-outer loop pair, that is, how many times the hole filling operation needs to be performed. The first two-dimensional array TotalEdgeVec stores the two vertices corresponding to the boundary edge in each inner-outer loop pair, using pair for storage; the second two-dimensional array TotalPointIndexVec stores the vertex index in each inner-outer loop pair; and the last one-dimensional array TotalHoopInAreaIndexVecIndex stores the inner loop index corresponding to each outer loop. Using such a data structure for storage can facilitate subsequent filling algorithms.
[0104] Step 7: Use the Delaunay triangulation algorithm to fill the hole area and form a complete model surface.
[0105] To fill the hole area, each time the hole area formed by an inner-outer loop pair is filled. From Step 7, the same index data from TotalEdgeVec, TotalPointIndexVec, and TotalHoopInAreaIndexVecIndex are taken out simultaneously for each filling operation. First, a pair of inner-outer loop edge set EdgeVec is taken out from TotalEdgeVec as the input and output of the single Delaunay triangulation algorithm. Let the number of edges of the inner-outer loop pair be N, and the edges in the outer loop and inner loop are stored in the edge set in counterclockwise and clockwise order, respectively. The two vertices of the Kth edge are L k1 , L k2 , and there is no longer an inner loop and an outer loop.
[0106] Step 1. If the number of edges N = 3, it means that the polygon (the shape formed by connecting the boundary edges of the hole area) itself is a triangle, and the filling is directly performed, and the triangulation ends; otherwise, let K = 1, and go to Step 2;
[0107] Step 2. Let K = K + 1, if L k2 is not on the left side of the edge L 11 L 12 , continue to execute Step 2; otherwise, go to Step 3;
[0108] Step 3. Judge whether the newly generated edge L 11 L k2 or L12 L k2 If yes, go to Step 2; otherwise, go to Step 4.
[0109] Step 4. Add vertex L k2 to the candidate vertex list, and if K = N (i.e., all the remaining vertices have been traversed), go to Step 5; otherwise, go to Step 2.
[0110] Step 5. Find the vertex L 11 from the candidate vertex list that forms the smallest circumcircle with vertices L k2 and L p2 , and record it as L 11 . Then generate a new triangle with vertices L k2 , L p2 and L 11 , and modify the data stored in the EdgeVec edge set as follows:
[0111] If neither edge L p2 L 12 nor edge L p2 L 12 is an edge of the current polygon, and original edge L p2 L N1 is no longer a boundary edge of the current polygon, then set N = N + 1, L p2 = L N2 , L 12 = L 12 , L p2 = L 12 , i.e., replace L p2 with L 12 , add a new edge L p2 L 11 , and complete the subdivision, and go to Step 1.
[0112] If edge L p2 L 12 or edge L p2 L 12 is the mth edge of the current polygon, and edge L p2 L 11 or edge L p2 L 11 is not an edge of the current polygon, then set L p2 = L 11 or L p2 = L m1 , L N1 = L m2 , L N2, N=N-1, the current two edges are no longer the boundary edges of the current polygon, and are deleted and replaced with newly generated edges, and one time of subdivision is completed, and Step 1 is performed.
[0113] If the edge L 11 L p2 and the edge L 12 L p2 are the mth and nth edges of the current polygon respectively, the edges L 12 L 12 , the edge L 11 L p2 and the edge L 12 L p2 are no longer the boundary edges of the current polygon, and are directly deleted, N=N-3, one time of subdivision is completed, and Step 1 is performed.
[0114] In combination with the embodiments, refer to Figure 13 . As shown in Figure 13 , the display effect after filling the hollow area in Figure 10 .
[0115] Step 8: According to the set Distance variable, the distance of the text surface extending inwards and outwards is adjusted to form the text carving or relief.
[0116] After the processing of Step 8, the hollows of the text area have been filled, and the text has been adhered to the surface of the original model. However, the current text does not have the effect of three-dimensional carving or relief, and the subsequent processing can be divided into two parts. The first part is that the internal triangular facets of the text extend inwards or outwards according to the set value, and the second part is that the extended triangular facets are connected with the original model surface to obtain the newly generated hollows. The first part: using the normal vector of the initial triangular facet as the extension direction, taking each triangular facet in the set of stored internal triangular facets of the text, adding FaceNormal*Distance to each vertex to obtain a new vertex position, generating a new triangular facet, and deleting the original text surface. The second part: taking the corresponding adjacent points A1, B1, A2, B2 from the original text surface boundary point set and the newly generated text surface boundary point set, using the four vertices to generate two new triangular facets A1B1A2 and A2B2A1. Until all the vertices in the boundary point set are processed, the hollow area can be filled to form a complete text carving or relief.
[0117] In summary, the method for generating a three-dimensional model text carving and relief provided by the embodiments of the present disclosure has the following advantages:
[0118] 1. Generating text engraving and embossing on original model, increasing information carried by model, such as carving out patient's name, number or other information on denture, mouthpiece or teeth corrector.
[0119] 2. Using bounding box for preliminary detection, reducing traversal number in subsequent processing, improving algorithm performance.
[0120] 3. Simultaneously using ray intersection method, projecting text to original model surface, so that text will not destroy original model surface, ensuring accuracy and naturalness of effect.
[0121] Embodiment 2
[0122] This embodiment relates to a device for generating text engraving and embossing of three-dimensional model, which comprises a memory and one or more processors, the memory stores executable code, and the one or more processors execute the executable code to implement the method for generating text engraving and embossing of three-dimensional model according to embodiment 1.
[0123] Embodiment 3
[0124] This embodiment provides a computer readable storage medium, which stores computer instructions, and the instructions are used to execute the method for generating text engraving and embossing of three-dimensional model according to embodiment 1.
[0125] The above embodiments are only exemplary description of the present application, and do not limit its application; although the foregoing embodiments have been described in detail, those skilled in the art can modify or replace the technical steps in these embodiments, and these modifications or replacements will not change the core essence of the corresponding technical solution, and will not exceed the technical scope of the embodiments of the present application.
Claims
1. A method of generating three-dimensional model lettering and relief, characterized by, The method comprises the following steps: Step 1: establishing a local coordinate system and obtaining the position offset of each vertex in the text model by inputting the text model, the initial position and the rotation angle information; Step 2: determining the size of the bounding box, performing preliminary detection on the original model by using the bounding box, and judging which vertices are in the bounding box; Step 3: adding the triangular facets of the text model to the original model, and judging whether the vertices detected preliminarily are in the range of the text facets by lifting the vertices to the same plane as the text facets; Step 4: projecting the triangular facets of the text model downward and moving them to the surface of the original model; Step 5: obtaining the contour rings of the text area, judging the inner and outer ring relationship, and changing the order of the vertex array of the inner and outer rings, with the outer ring being counterclockwise and the inner ring being clockwise; Step 6: constructing an edge-vertex relationship array from the initial inner and outer ring relationship vertex array; Step 7: using the Delaunay triangulation algorithm to perform hole filling operation on the hole area to form a complete model surface; Step 8: adjusting the distance of the text surface extending inward and outward according to the set Distance variable to form a text carving or relief.
2. The method according to claim 1, wherein the step 1 specifically comprises: establishing a local coordinate system of the text area; calculating the position offset of each vertex in the text model; The local coordinate system of the text region is established by using the vertex and normal vector of the triangular facet to construct the local coordinate system, taking one side of the triangular facet as the Y axis of the coordinate system, taking the normal vector as the Z axis, and obtaining the X axis by the cross product of the Y and Z axes; then the Z axis is fixed to rotate, and the rotated axis is obtained by multiplying the rotation matrix R and the Y axis vector, and the new axis and axis are taken as the X and Y axes during text drawing. the position offset of each vertex in the text model is obtained by adding the x, y and z values of all vertices to obtain an average value, which is the center point of the TextMesh vertex, and then subtracting the position of each vertex from the center point to obtain the position offset of each vertex.
3. The method according to claim 1, wherein the step 2 specifically comprises: determining the size of the bounding box; performing preliminary detection by using the bounding box; the bounding box is formed by four surrounding vertices of the text model, and eight vertices are obtained by moving the four vertices upward and downward according to the input normal vector corresponding to the triangular facets, and the rectangular body connecting the eight vertices forms the bounding box; the preliminary detection by using the bounding box includes using the maximum vertex coordinates XMax, YMax and ZMax and the minimum vertex coordinates XMin, YMin and ZMin of the bounding box as the limit range for the breadth search to detect which vertices are in the bounding box.
4. The method according to claim 1, wherein the step 3 specifically comprises: adding the triangular facets of the text model to the original model; judging whether the vertices detected preliminarily are in the range of the text facets; adding the triangular facets of the text model to the original model includes adding the vertices to the original model by using the position offset of each vertex of the text model obtained in the step 1; judging whether the vertices detected preliminarily are in the range of the text facets includes two cases:
1. the vertices of the triangular facets are directly located inside the triangular facets in the text model; 2. the vertices in the text model are inside the triangular facets of the original model; using vector cross product method and triangular area method for judgment.
5. The method of claim 1, wherein the step 4 further comprises: calculating the distance from each vertex of the text model to the surface of the original model; moving the text model to the surface of the original model. The step of calculating the distance from each vertex of the text model to the surface of the original model comprises: inverting the normal vector of the initial triangle, and taking each vertex of the text model as the starting point, extending along the normal vector direction to find the intersection point with the surface of the original model; and calculating the distance from each vertex of the text model to the surface of the original model by taking the intersection point of the vertex of the text model and the surface of the original model. The step of moving the text model to the surface of the original model comprises: using the distance calculated above, moving the corresponding distance in the opposite direction of the normal vector.
6. The method of claim 1, wherein the step 5 further comprises: obtaining the contour rings of the text region; judging whether each ring in the text region is inside or outside other rings and the number of rings; reordering the vertex array of the inner and outer rings according to the inner and outer rings; obtaining the contour rings of the text region, and traversing along the boundary edges to obtain the complete boundary ring; determining the inside and outside ring relationship in the text area, judging by the sum of the included angle; if the sum of the included angle is equal to , it indicates that the vertex is in the ring; if the sum of the included angle is equal to , it indicates that the vertex is outside the ring; if the vertex is located in other ring, it indicates that the ring where the vertex is located is in the other ring; 。 7. The method of claim 1, wherein the step of constructing the edge-point relationship array from the initial inner-outer ring relationship vertex array comprises: using two two-dimensional arrays and one one-dimensional array to store, and the lengths of the three arrays correspond to the pairs of inner and outer rings, indicating the number of times of hole filling operations required for the hole region.
8. The method of claim 1, wherein the step 7 further comprises: traversing each pair of inner and outer rings according to the data structure established in the step 6; using the Delaunay triangulation algorithm to perform the hole filling operation on the hole region.
9. The method of claim 1, wherein the step 8 of setting the Distance variable adjusts the distance of the text surface extending inward or outward to form the text carving or the text relief, and the step 8 further comprises: extending the text internal triangle inward or outward by a set value; connecting the extended triangle with the surface of the original model.
10. An apparatus for generating a three-dimensional model text carving and relief, comprising a memory and one or more processors, wherein the memory stores executable code, and the one or more processors execute the executable code to implement the method of any one of claims 1-9.
Citation Information
Patent Citations
Method for engraving three-dimensional model based on line pattern
CN104143209A
Embossed grid representation and 3D printing slicing method and system based on bump mapping
CN106875495A