Triangular facet-based hole feature extraction method, system and device
By performing vertex deduplication, boundary extraction, and hole feature analysis on triangular facet data, the problem of low efficiency in hole feature extraction in traditional methods is solved, achieving automated and accurate hole feature extraction and enhancing the application value of lightweight models.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- JIHUA LAB
- Filing Date
- 2026-06-22
- Publication Date
- 2026-07-24
Smart Images

Figure CN122454098A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of part image detection, and in particular to a method, system and device for hole feature extraction based on triangular facets. Background Technology
[0002] Lightweight 3D model formats such as CGR and JT are widely used for model visualization, design review, data sharing, and downstream processes. For editable formats like Part and Step, efficient automation can be achieved by directly accessing the model's geometric layer data and automatically identifying and extracting hole features. However, for non-editable lightweight formats like CGR, which only contain discrete triangular facets and lack parameterized definitions for hole features, traditional feature extraction methods are inapplicable. With such models, process engineers must manually identify hole locations in a 3D visualization environment and manually select hole boundaries or surfaces to extract features, resulting in low efficiency. Summary of the Invention
[0003] This application aims to improve at least one technical problem in the background art.
[0004] This application provides a hole feature extraction method based on triangular facets, which includes acquiring target surface data of a target part, wherein the target surface data includes multiple triangular facets; Extract the vertex coordinates of all triangles from the target face data, and perform deduplication and indexing on all triangle vertex coordinates to obtain unique vertex index data. Based on the unique vertex index data, the edges of each triangular facet are extracted to obtain the set of boundary edges; Construct the original boundary ring set based on the adjacency relationships in the boundary edge set; A validity analysis is performed on the original set of boundary rings to obtain valid boundary rings; Based on the geometric characteristics of the effective boundary rings, the inner boundary rings can be identified from the effective boundary rings; Geometric feature analysis of the inner boundary ring is performed to determine the hole type corresponding to the inner boundary ring; Geometric parameters are calculated based on the hole type to obtain the hole characteristic parameters.
[0005] According to some technical solutions of this application, the step of extracting the vertex coordinates of all triangular facets from the target facet data and performing deduplication and indexing processing on all triangular vertex coordinates to obtain unique vertex index data specifically includes: Extract the vertex coordinates of all triangles from the target face data as the original vertices to obtain the original vertex list; Create a unique vertex list and index mapping table; Iterate through each original vertex in the original vertex list and extract the original vertices in sequence as the current original vertex; Compare the coordinates of the current original vertex with the coordinates of the unique vertex in the unique vertex list; If the coordinate difference between the current original vertex and a certain unique vertex is within the preset tolerance range, then the two are determined to be the same vertex, the original vertex is mapped to the index of the unique vertex, and the mapping relationship is recorded in the index mapping table. If the coordinate difference between the current original vertex and all unique vertices in the unique vertex list exceeds the preset tolerance range, then the current original vertex is determined to be a new unique vertex. The original vertex is added to the unique vertex list as a new unique vertex, a new unique index is assigned to the new unique vertex, the original vertex is mapped to the new unique index, and the mapping relationship is recorded in the index mapping table. After traversal, a list of unique vertices and a mapping from the original vertices to the unique vertex indices are obtained; The mapping relationships are integrated to obtain unique vertex index data.
[0006] According to some technical solutions of this application, the step of extracting the edge lines of each triangular facet based on the unique vertex index data to obtain the boundary edge set specifically includes: Construct an edge count table; Iterate through each triangle, taking each triangle obtained in turn as the current triangle and obtaining the coordinates of the three original vertices of the current triangle; Based on the unique vertex index data, find the unique vertex index corresponding to each original vertex of the current triangle facet to obtain three unique vertex indices; Combine the three unique vertex indices to generate multiple edges; For each generated edge, rearrange the indices of its two unique vertices in ascending order of their values to obtain a canonical edge; Using the normalized edge as the index key, search the edge count table to see if the index key exists. If it exists, increment the count value corresponding to the index key by 1; if it does not exist, add the index key to the edge count table and set the count value to 1. After traversing all the triangular faces, the normalized edges with a count of 1 in the edge count table are marked as boundary edges and integrated to obtain the boundary edge set.
[0007] According to some technical solutions of this application, the step of constructing the original boundary ring set based on the adjacency relationship in the boundary edge set specifically includes: Select a boundary edge from the set of boundary edges as the starting edge, and record the two endpoints of the starting edge, which are denoted as the starting point and the current point, respectively; Using the current point as the search point, find the boundary edge in the boundary edge set that coincides with the coordinates of the current point, and use it as the adjacent edge; Connect the found adjacent edge to the current boundary edge, and update the other endpoint of the adjacent edge that is different from the current point to the new current point; Repeat the search until the new current point coincides with the starting point coordinates, and form an original boundary loop by connecting all the boundary edges traversed during the search process in the order of connection. Remove all boundary edges that form the original boundary ring from the boundary edge set and continue the search until the boundary edge set is empty, thus obtaining the original boundary ring set.
[0008] According to some technical solutions of this application, the step of performing validity analysis on the original set of boundary rings to obtain valid boundary rings specifically includes: Traverse each original boundary ring in the set of original boundary rings and count the number of vertices in each original boundary ring; Determine if the number of vertices is less than 3. If so, the original boundary cycle is determined to be invalid and removed; otherwise, the original boundary cycle is determined to be valid and marked. After the traversal is complete, all original boundary cycles marked as valid cycles are taken as valid boundary cycles; Integrate all valid boundary rings to obtain the set of valid boundary rings.
[0009] According to some technical solutions of this application, the step of identifying the inner boundary ring from the effective boundary ring based on the geometric characteristics of the effective boundary ring specifically includes: For each valid boundary ring in the set of valid boundary rings, calculate the perimeter of the valid boundary ring and the area of the region it encloses; The valid boundary ring with the largest perimeter and area is marked as the outer boundary ring, and all other valid boundary rings are marked as inner boundary rings.
[0010] According to some technical solutions of this application, the step of performing geometric feature analysis on the inner boundary ring to determine the hole type corresponding to the inner boundary ring specifically includes: Calculate and determine the circularity, eccentricity, and number of corner points that make up the inner boundary ring; If the roundness is greater than the first preset threshold, then the hole type corresponding to the inner boundary ring is determined to be a round hole; If the roundness is not greater than the first preset threshold and the eccentricity is greater than the second preset threshold, then the hole type corresponding to the inner boundary ring is determined to be an elliptical hole. If the number of corner points is greater than or equal to 3, then the hole type corresponding to the inner boundary ring is determined to be a polygonal hole or an irregular hole.
[0011] According to some technical solutions of this application, the step of calculating geometric parameters based on the hole type to obtain hole characteristic parameters specifically includes: Determine the hole type corresponding to each inner boundary ring; If the hole type is a circular hole, then calculate the center coordinates, diameter, area of the circular hole, and its normal as the hole characteristic parameters; If the hole type is an elliptical hole, then calculate the major axis length, minor axis length, center point coordinates and normal of the elliptical hole as hole characteristic parameters; If the hole type is a polygonal hole or an irregular hole, then calculate its center point coordinates and area as hole characteristic parameters.
[0012] This application also provides a hole feature extraction system based on triangular facets, including: The acquisition module is used to acquire target surface data of the target part, wherein the target surface data includes multiple triangular facets; The processing module is used to extract the vertex coordinates of all triangles from the target face data, and to perform deduplication and indexing on all triangle vertex coordinates to obtain unique vertex index data. The extraction module is used to extract the edges of each triangle based on the unique vertex index data to obtain the set of boundary edges; The building module is used to construct the original set of boundary rings based on the adjacency relationships in the set of boundary edges; The analysis module is used to perform validity analysis on the original set of boundary rings to obtain valid boundary rings; The identification module is used to identify the inner boundary ring from the valid boundary ring based on the geometric features of the valid boundary ring; The determination module is used to perform geometric feature analysis on the inner boundary ring and determine the hole type corresponding to the inner boundary ring. The calculation module is used to calculate geometric parameters based on the hole type to obtain the hole characteristic parameters.
[0013] This application also provides a hole feature extraction device based on triangular facets, the hole feature extraction device based on triangular facets includes: a memory and at least one processor, the memory storing instructions; at least one processor calls the instructions in the memory to cause the hole feature extraction device based on triangular facets to perform the various steps of the hole feature extraction method based on triangular facets as described above.
[0014] The hole feature extraction method based on triangular facets provided in this application has at least the following beneficial effects: by sequentially performing vertex deduplication, boundary extraction, loop construction, internal and external classification, type identification, and parameter calculation on the target facet data, the automatic extraction of hole features in the non-editable CGR model is realized, which significantly improves the efficiency and accuracy of hole feature extraction and provides a data foundation for the in-depth application of lightweight models in process design, processing planning, and other fields. Attached Figure Description
[0015] Figure 1 A schematic flowchart of the hole feature extraction method provided in the embodiments of this application; Figure 2 This is a structural diagram of the hole feature extraction system provided in the embodiments of this application; Figure 3 This is a schematic diagram of the hole feature extraction device provided in the embodiments of this application; Figure 4 This is a schematic diagram illustrating the recognition effect of holes on a model provided in an embodiment of this application. Detailed Implementation
[0016] The embodiments of this application are described in detail below. Examples of these embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals denote the same or similar elements or elements having the same or similar functions throughout. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the present invention, and should not be construed as limiting the present invention.
[0017] In the description of this application, it should be understood that the orientation descriptions, such as up, down, front, back, left, right, etc., indicate the orientation or positional relationship based on the orientation or positional relationship shown in the accompanying drawings. They are only for the convenience of describing this application and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation or be constructed or operated in a specific orientation. Therefore, they should not be construed as limiting the present invention.
[0018] In the description of this application, unless otherwise expressly defined, terms such as "setup," "installation," and "connection" should be interpreted broadly, and those skilled in the art can reasonably determine the specific meaning of the above terms in this application in conjunction with the specific content of the technical solution.
[0019] The following is combined with Figures 1 to 4 Embodiments of the present invention will be described.
[0020] This application provides a method for hole feature extraction based on triangular facets, including: S100, Obtain target surface data of the target part, wherein the target surface data includes multiple triangular facets. This embodiment provides a hole feature extraction method based on triangular facets. Taking a CGR format mechanical part model as an example, the model is composed of a large number of triangular facets.
[0021] S200: Extract the vertex coordinates of all triangular facets from the target surface data, and perform deduplication and indexing processing on all triangular vertex coordinates to obtain unique vertex index data, thereby obtaining the target surface data of the target part. In this embodiment, by parsing the CGR file, all triangular facet data of the surface to be processed on the part are obtained. Each triangular facet is defined by the three-dimensional coordinates of its three vertices, and all facet data constitute a set. Extract the coordinates of all vertices from these triangular facets. For example, three facets may have a total of 5 physical vertices, but due to the repetition of coordinates, they actually correspond to only 3 spatial points. Through tolerance merging, establish an index mapping from the original vertices to the unique vertices. For example, map the original vertices P1 and P2 to the unique vertex V1, P3 to V2, and P4 and P5 to V3.
[0022] S300: Based on the unique vertex index data, extract the edges of each triangular facet to obtain the boundary edge set. Specifically, based on these unique vertex indices, traverse each triangular facet and generate edges composed of unique vertex indices, such as (V1,V2), (V2,V3), and (V3,V1). By counting how many faces share each edge, edges used by only one facet are marked as boundary edges, thus obtaining the boundary edge set.
[0023] S400, construct the original boundary ring set based on the adjacency relationship in the boundary edge set. In this step, in the boundary edge set, the edges that are connected end to end are connected sequentially using the adjacency relationship of the edges. For example, starting from an edge, find the next edge that shares an endpoint along its endpoint until a closed loop is formed, thereby constructing multiple original boundary rings, including the outer contour ring and the internal hole ring of the part.
[0024] S500: Perform a validity analysis on the original set of boundary cycles to obtain valid boundary cycles. In this step, the constructed boundary cycles are checked for validity. For example, if a cycle consists of only 2 vertices, its number of vertices is less than 3, then it is determined to be an invalid cycle and discarded, finally obtaining valid boundary cycles.
[0025] S600, Identify the inner boundary ring from the valid boundary rings based on their geometric characteristics. In this step, the geometric characteristics of all valid boundary rings, such as perimeter or area, are calculated. Since the perimeter and area of the outer contour ring are usually much larger than those of the inner hole ring, the valid boundary ring with the largest perimeter and area is marked as the outer boundary ring by comparison, and all other valid boundary rings are marked as inner boundary rings. S700, Perform geometric feature analysis on the inner boundary ring to determine the hole type corresponding to the inner boundary ring. In this step, the geometric feature analysis is performed on the inner boundary ring. For example, its roundness is calculated, such as the ratio of the square of the perimeter to the area. If this value is close to 4π, it is determined to be a circular hole; if the roundness is small and the length-to-width ratio is large, it is determined to be an elliptical hole; if the number of corner points constituting the ring is large, it is determined to be a polygonal hole or an irregular hole.
[0026] S800: Calculate the geometric parameters based on the hole type to obtain the hole characteristic parameters. In this step, the specific hole characteristic parameters are calculated according to the determined hole type. If it is a circular hole, calculate its center coordinates, diameter, area, and normal; if it is an elliptical hole, calculate its center point, major axis, minor axis, and normal, and output these parameters.
[0027] Therefore, this embodiment sequentially performs vertex deduplication, boundary extraction, loop construction, internal and external classification, type identification, and parameter calculation, realizing the fully automatic extraction of hole features in the non-editable CGR model. This significantly improves the efficiency and accuracy of hole feature extraction, providing a data foundation for the in-depth application of lightweight models in process design, processing planning, and other stages.
[0028] In some embodiments, step S200 involves extracting the vertex coordinates of all triangular faces from the target face data, and performing deduplication and indexing processing on all triangular vertex coordinates to obtain unique vertex index data, specifically including: S210, extract the vertex coordinates of all triangles from the target face data as the original vertices to obtain the original vertex list; S220, Create a unique vertex list and index mapping table; S230, traverse each original vertex in the original vertex list and take the extracted original vertices as the current original vertex; S240, compare the coordinates of the current original vertex with the coordinates of the unique vertex in the unique vertex list; S250, if the coordinate difference between the current original vertex and a certain unique vertex is within the preset tolerance range, then the two are determined to be the same vertex, the original vertex is mapped to the index of the unique vertex, and the mapping relationship is recorded in the index mapping table. S260, if the coordinate difference between the current original vertex and all unique vertices in the unique vertex list exceeds the preset tolerance range, then the current original vertex is determined to be a new unique vertex, the original vertex is added to the unique vertex list as a new unique vertex, a new unique index is assigned to the new unique vertex, the original vertex is mapped to the new unique index, and the mapping relationship is recorded in the index mapping table. S270, after traversal is complete, we obtain a list of unique vertices and a mapping relationship from the original vertices to the unique vertex indices; S280, integrate the mapping relationships to obtain unique vertex index data.
[0029] In this embodiment, after obtaining the original vertex data of all triangles, an empty list of unique vertices, UniqueVerts, and an empty index map, IndexMap, are created.
[0030] Traverse the original vertex list. For example, the first original vertex is A(0,0,0). Since UniqueVerts is empty, determine that A is a new unique vertex, add it to UniqueVerts, assign it index 0, and record A corresponding to index 0 in IndexMap.
[0031] Process the second original vertex B(0,0,0.001). Compare it with A(0,0,0) in UniqueVerts. If the preset coordinate tolerance is greater than the distance between the two points, then B and A are determined to be the same vertex, and B is recorded as 0 in IndexMap.
[0032] Process the third original vertex C(1,0,0). Compare it with all unique vertices in UniqueVerts. The distance between the two points is 1, which exceeds the tolerance. Therefore, C is determined to be a new vertex, added to UniqueVerts, assigned index 1, and recorded as C corresponding to index 1.
[0033] Repeat this process until all original vertices have been processed. Ultimately, you obtain a list of UniqueVerts and a mapping that indicates which unique vertex index should be used for each original vertex; this mapping is the unique vertex index data.
[0034] Therefore, by setting tolerance to merge duplicate vertices, this embodiment can effectively eliminate vertex redundancy in triangular facet data caused by computational precision or model discretization, establish a unified indexing system, provide an accurate and efficient topological foundation for subsequent edge extraction and boundary judgment, and avoid erroneous boundary identification caused by duplicate vertices.
[0035] In some embodiments, step S300 involves extracting the edges of each triangular facet based on unique vertex index data to obtain a set of boundary edges, specifically including: S310, Construct an edge counting table; S320, traverse each triangle, take each triangle obtained in turn as the current triangle and obtain the coordinates of the three original vertices of the current triangle; S330: Based on the unique vertex index data, find the unique vertex index corresponding to each original vertex of the current triangle facet to obtain three unique vertex indices; S340 combines three unique vertex indices to generate multiple edges; S350, for each generated edge, rearrange the indices of its two unique vertices in ascending order of their values to obtain a normalized edge; S360, using the normalized edge as the index key, search the edge count table to see if the index key exists; S370, if it exists, increment the count value corresponding to the index key by 1; if it does not exist, add the index key to the edge count table and set the count value to 1. S380: After traversing all triangular faces, mark the normalized edges with a count value of 1 in the edge count table as boundary edges and integrate them to obtain the boundary edge set.
[0036] In this embodiment, firstly, an empty edge count table EdgeCount is created, with edges as keys and the number of shares as values.
[0037] Traverse the first triangular facet, whose three original vertex coordinates are A(0,0,0), B(1,0,0), and C(0,1,0). By looking up the unique vertex index data, we obtain their corresponding unique vertex indices as 0, 1, and 2. Generate three edges from these three indices: (0,1), (1,2), and (2,0). For each edge, sort its two endpoint indices in ascending order to obtain the normalized edges. For example, (0,1) is already in ascending order, so we directly search for it in EdgeCount using (0,1) as the key. If not found, we add it and set the count to 1. We process (1,2) and (2,0) in the same way.
[0038] Traverse the second triangular facet, whose three vertices are B(1,0,0), D(1,1,0), and C(0,1,0), corresponding to unique indices 1, 3, and 2. The generated canonical edges are (1,3), (2,3), and (1,2). Among them, edge (1,2) already exists in EdgeCount, so its count is increased from 1 to 2; while (1,3) and (2,3) are new edges, and their counts are set to 1.
[0039] After traversing all faces, check the EdgeCount table. Edges with a count of 1 are the boundary edges. For example, edge (0,1) has a count of 1, edge (0,2) has a count of 1, edge (1,3) has a count of 1, edge (2,3) has a count of 1, and edge (1,2) has a count of 2. Collect these edges with a count of 1 to form the boundary edge set.
[0040] Therefore, by performing normalized sorting and frequency statistics on each edge, this embodiment can accurately distinguish between boundary edges used by a single facet and internal edges shared by multiple facets, achieving the goal of accurately extracting boundary edges from discrete triangular facets and providing reliable boundary data for subsequent hole feature identification.
[0041] In some embodiments, step S400, constructing an original boundary ring set based on the adjacency relationships in the boundary edge set, specifically includes: S410: Select a boundary edge from the set of boundary edges as the starting edge, and record the two endpoints of the starting edge as the starting point and the current point, respectively. S420: Using the current point as the search point, find the boundary edge in the boundary edge set that coincides with the coordinates of the current point and use it as the adjacent edge. S430, connect the found adjacent edge to the current boundary edge, and update the other endpoint of the adjacent edge that is different from the current point to the new current point; S440, repeat the search until the new current point coincides with the starting point coordinates, and form an original boundary loop by connecting all the boundary edges passed during the search process in the order of connection. S450, remove all boundary edges that have formed the original boundary ring from the boundary edge set and continue the search until the boundary edge set is empty, thus obtaining the original boundary ring set.
[0042] In this embodiment, firstly, an edge is randomly selected from the set of boundary edges as the starting edge, such as E1(V0,V1), and its starting point is recorded as V0 and its current point as V1.
[0043] Then, begin searching for the next edge. In the remaining set of boundary edges, search for all edges that contain the current point V1. In a typical manifold triangular mesh, because the boundary edges form closed loops, each boundary vertex is adjacent to only two boundary edges. Therefore, usually only one adjacent edge will be found, and this edge can be directly used as the next edge. For example, if the only adjacent edge found is E2(V1,V2), then E2 is directly selected.
[0044] Connect E2 to the current cycle and update the current point to V2. Continue the search until the other end of an edge is the starting point V0. At this point, a closed boundary cycle is constructed. Record all the edges contained in the cycle: [E1, E2, ..., En].
[0045] Remove all edges of the cycle from the boundary edge set, and then repeat the above process to continue searching for the next cycle among the remaining edges. Continue until the boundary edge set is empty, resulting in the original boundary cycle set containing multiple cycles.
[0046] Therefore, this embodiment, through an adjacency search based on endpoint coincidence and an optimal selection strategy based on tangent angle difference, can efficiently and accurately connect discrete boundary edges into a closed boundary loop. Even when multiple edges share a common point, it can correctly select the path, effectively solving the branch ambiguity problem in boundary loop construction and ensuring the integrity and correctness of the loop.
[0047] In some embodiments, step S500 involves performing a validity analysis on the original set of boundary rings to obtain valid boundary rings, specifically including: S510, traverse each original boundary ring in the set of original boundary rings and count the number of vertices in the original boundary rings; S520, determine if the number of vertices is less than 3. If yes, determine that the original boundary cycle is an invalid cycle and remove it; otherwise, determine that the original boundary cycle is a valid cycle and mark it. S530, after traversal is complete, all original boundary cycles marked as valid cycles are taken as valid boundary cycles; S540 integrates all valid boundary rings to obtain a set of valid boundary rings.
[0048] In this embodiment, several original boundary loops, such as loop A, loop B, and loop C, are identified. The number of vertices in each loop is counted.
[0049] Ring A consists of three vertices; for example, a triangular hole has 3 vertices. Ring B consists of twenty vertices; for example, an approximately circular hole has 20 vertices. Ring C consists of two vertices; for example, an invalid ring has 2 vertices.
[0050] According to the preset judgment rules, boundary cycles with fewer than 3 vertices are considered invalid. Therefore, cycle C has 2 vertices, which is less than 3, so it is judged as an invalid cycle and removed.
[0051] Cycle A and Cycle B are both at least 3 vertices, so they are considered valid cycles and marked. After traversal, all cycles A and B marked as valid cycles are combined to form a set of valid boundary cycles.
[0052] Therefore, by setting a lower limit threshold for the number of vertices, this embodiment can effectively filter out invalid boundary loops caused by data noise, model defects, or algorithm errors, ensuring the quality of boundary loop data participating in subsequent hole identification and parameter calculation, and improving the robustness of the method and the reliability of the results.
[0053] In some embodiments, step S600, based on the geometric characteristics of the effective boundary rings, identifies the inner boundary ring from the effective boundary rings, specifically including: S610, obtain each valid boundary ring in the set of valid boundary rings, and calculate the perimeter of the valid boundary ring and the area of the region it encloses; S620: Compare the perimeter and area of all valid boundary rings, mark the valid boundary ring with the largest perimeter and area as the outer boundary ring, and mark all the remaining valid boundary rings as inner boundary rings.
[0054] In this embodiment, two valid boundary loops were obtained: the Outer loop and the Inner loop. The Outer loop represents the outer contour of the part, and the Inner loop represents a hole in the part. The perimeter and area enclosed by each boundary loop were calculated: the Outer loop has a perimeter of 150 mm and an area of 1200 mm²; the Inner loop has a perimeter of 31.4 mm and an area of 78.5 mm². Comparison shows that the Outer loop has the largest perimeter and area; therefore, the Outer loop is designated as the outer boundary loop, i.e., the outer contour loop, while the Inner loop is designated as the inner boundary loop. If multiple holes exist in the model, multiple inner boundary loops are obtained accordingly, and all inner boundary loops are used as the analysis objects in subsequent steps.
[0055] Therefore, this embodiment calculates the perimeter and area of the boundary ring and utilizes the geometric feature that the outer contour ring is significantly larger than the inner hole ring to accurately distinguish the hole boundary from the outer boundary of the part, thus realizing the automatic classification of the inner and outer boundaries, which is beneficial for subsequent hole type identification of the inner boundary ring.
[0056] In some embodiments, step S700 involves performing geometric feature analysis on the inner boundary ring to determine the hole type corresponding to the inner boundary ring, specifically including: S710, calculate and determine the circularity, eccentricity, and number of corner points that make up the inner boundary ring; S720, if the roundness is greater than the first preset threshold, then the hole type corresponding to the inner boundary ring is determined to be a round hole; S730, if the roundness is not greater than the first preset threshold and the eccentricity is greater than the second preset threshold, then the hole type corresponding to the inner boundary ring is determined to be an elliptical hole. S740, if the number of corner points is greater than or equal to 3, then the hole type corresponding to the inner boundary ring is determined to be a polygonal hole or an irregular hole.
[0057] In this embodiment, we take an identified inner boundary loop as an example. This loop consists of 30 vertices and its shape is close to a circle. First, we calculate the circularity of the loop. Circularity is defined as C = 4π. (Area) / (Perimeter)^2. The calculated area of the ring is 78.5, and the perimeter is 31.4, therefore its circularity is approximately 4. 3.14 78.5 / (31.4)^2≈1.0.
[0058] Next, the first preset threshold is set to 0.9. Since the calculated roundness of 1.0 is greater than 0.9, the hole type corresponding to the inner boundary ring is determined to be a round hole.
[0059] For the other inner boundary ring, its shape is elliptical. Its circularity is calculated to be approximately 0.6, which is less than 0.9. Further calculation of its eccentricity, defined as the ratio of the focal distance to the major axis length, yields a result of 0.85. Setting a second preset threshold of 0.8, since the eccentricity of 0.85 is greater than 0.8, the hole type corresponding to this inner boundary ring is determined to be an elliptical hole.
[0060] For another inner boundary ring, its shape is quadrilateral. Calculations show that its circularity and eccentricity are relatively small, but a corner detection algorithm identifies four obvious corners on the ring. Since the number of corners is greater than or equal to three, the hole type corresponding to this inner boundary ring is determined to be a polygonal hole.
[0061] Therefore, this embodiment calculates multiple geometric indicators such as roundness, eccentricity, and number of corner points, and sets corresponding judgment thresholds, which can automatically and accurately classify the inner boundary ring into round holes, elliptical holes, polygonal holes, or irregular holes, realizing intelligent identification of hole types, providing differentiated parameter calculation basis for different hole types, and meeting the needs of different process scenarios.
[0062] In some embodiments, step S800 involves calculating geometric parameters based on the hole type to obtain hole characteristic parameters, specifically including: S810, determine the hole type corresponding to each inner boundary ring; S820, if the hole type is a circular hole, then calculate the center coordinates, diameter, area of the circular hole and its normal as the hole characteristic parameters; S830, if the hole type is an elliptical hole, then calculate the major axis length, minor axis length, center point coordinates and normal of the elliptical hole as hole characteristic parameters; S840, if the hole type is a polygonal hole or an irregular hole, calculate its center point coordinates and area as hole feature parameters.
[0063] In some embodiments, the hole characteristic parameters are calculated for the inner boundary ring that has been identified as a circular hole. This circular hole consists of 30 points on the boundary ring. Three points are arbitrarily selected, and the equation of the circle is fitted using a three-point concyclic algorithm, resulting in a circle with center coordinates (50, 50, 0) and a diameter of 10 mm. The area of the circular hole is calculated using the formula π. The result of (diameter / 2)^2 is 78.5 mm².
[0064] For example, the three-point concyclic algorithm specifically involves selecting three non-collinear points from the inner boundary ring as follows: , , The center of the circle is First, by , , Three points determine the equation of a plane, and its normal vector is: ,Right now Then the coplanar constraint is .
[0065] Secondly, by and Two linear equations were obtained respectively: as well as .
[0066] Combining the above two equations with the coplanar constraint, we form a system about... , , Solving the system of three linear equations in three variables yields the coordinates of the circle's center. .
[0067] radius Depend on Calculated.
[0068] Subsequently, diameter Area of circular hole The normal vector is the unit normal vector of the plane. .
[0069] Still exemplarily, the normal to the hole can be obtained by calculating the normal vectors of the facets that make up the hole. Specifically, among the vertices constituting the inner boundary loop, arbitrarily select three non-collinear vertices, denoted as... , and , will point With point Connecting them yields a vector. , will point With point Connecting them yields a vector. .right and Perform the cross product of the vectors to obtain the normal vector. This vector is the normal vector of the plane containing the boundary ring. After normalization, the unit normal vector is obtained, which serves as the normal vector of the hole. In this example, the calculated normal vector is... .
[0070] For example, for the inner boundary ring of a hole that has been determined to be elliptical, the general equation of an ellipse is known to be... Its constraints Using the data extracted from the inner boundary ring discrete points Based on the principle of least squares, the sum of squares of the equation error is minimized. To solve for unknown parameters , , , , , When the number of points is greater than 5, an overdetermined system of equations can be constructed, and the least squares solution can be obtained by solving the linear system of equations, thereby inversely solving for the coordinates of the ellipse's center. Rotation angle and major half-axis short half shaft .
[0071] For example, for the inner boundary ring of a hole identified as a polygon, its geometric center is calculated as the coordinates of the center point, and its area is calculated using the polygon area formula. Finally, the feature parameters of all holes are output in list form, and these holes are highlighted in the original 3D model, for example, by outlining the boundaries of the holes with red lines, to achieve a visual output.
[0072] Therefore, this embodiment adopts corresponding parameter calculation methods according to different hole types, which can output structured hole feature parameters, including type, center point, size, normal, area, etc., and the extraction results are presented intuitively through visual annotation, providing process engineers with comprehensive and accurate hole information data, which facilitates seamless integration with downstream process design, CNC programming and other systems, and greatly enhances the application value of the lightweight model.
[0073] In some embodiments, this application also provides a hole feature extraction system based on triangular facets, comprising: The acquisition module 100 is used to acquire target surface data of the target part, wherein the target surface data includes multiple triangular facets; The processing module 200 is used to extract the vertex coordinates of all triangles from the target face data, and to perform deduplication and indexing processing on all triangle vertex coordinates to obtain unique vertex index data. The extraction module 300 is used to extract the edges of each triangular face based on the unique vertex index data to obtain the set of boundary edges; Module 400 is used to construct the original boundary ring set based on the adjacency relationships in the boundary edge set; Analysis module 500 is used to perform validity analysis on the original set of boundary rings to obtain valid boundary rings; The identification module 600 is used to identify the inner boundary ring from the valid boundary ring based on the geometric features of the valid boundary ring; The determination module 700 is used to perform geometric feature analysis on the inner boundary ring and determine the hole type corresponding to the inner boundary ring. The calculation module 800 is used to calculate geometric parameters based on the hole type to obtain hole characteristic parameters.
[0074] Figure 3 This is a schematic diagram of a hole feature extraction device based on triangular facets provided in an embodiment of the present invention. The hole feature extraction device 900 based on triangular facets can vary considerably due to different configurations or performance. It may include one or more central processing units (CPUs) 910 (e.g., one or more processors) and a memory 920, and one or more storage media 930 (e.g., one or more mass storage devices) storing application programs 933 or data 932. The memory 920 and storage media 930 can be temporary or persistent storage. The program stored in the storage media 930 may include one or more modules (not shown in the diagram), each module including a series of instruction operations on the hole feature extraction device 900 based on triangular facets. Furthermore, the processor 910 may be configured to communicate with the storage media 930 and execute the series of instruction operations in the storage media 930 on the hole feature extraction device 900 based on triangular facets to implement the steps of the hole feature extraction method based on triangular facets provided in the above-described method embodiments.
[0075] The hole feature extraction device 900 based on triangular facets may further include one or more power supplies 940, one or more wired or wireless network interfaces 950, one or more input / output interfaces 960, and / or one or more operating systems 931, such as Windows Server, Mac OS X, Unix, Linux, FreeBSD, etc. Those skilled in the art will understand that... Figure 3 The illustrated hole feature extraction device structure based on triangular facets does not constitute a limitation on hole feature extraction devices based on triangular facets. It may include more or fewer components than illustrated, or combine certain components, or have different component arrangements.
[0076] The present invention also provides a computer-readable storage medium, which can be a non-volatile computer-readable storage medium or a volatile computer-readable storage medium, wherein the computer-readable storage medium stores instructions that, when executed on a computer, cause the computer to perform the steps of a hole feature extraction method based on triangular facets.
[0077] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working process of the system, device, or unit described above can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.
[0078] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0079] The preferred embodiments of the present invention have been described in detail above, but the present disclosure is not limited to the embodiments described. Those skilled in the art can make various equivalent modifications or substitutions without departing from the spirit of the present invention, and these equivalent modifications or substitutions are all included within the scope defined by the claims of the present disclosure.
Claims
1. A hole feature extraction method based on triangular facets, characterized in that: include: Obtain target surface data of the target part, wherein the target surface data includes multiple triangular facets; Extract the vertex coordinates of all triangles from the target face data, and perform deduplication and indexing on all triangle vertex coordinates to obtain unique vertex index data. Based on the unique vertex index data, the edges of each triangular facet are extracted to obtain the set of boundary edges; Construct the original boundary ring set based on the adjacency relationships in the boundary edge set; A validity analysis is performed on the original set of boundary rings to obtain valid boundary rings; Based on the geometric characteristics of the effective boundary rings, the inner boundary rings can be identified from the effective boundary rings; Geometric feature analysis of the inner boundary ring is performed to determine the hole type corresponding to the inner boundary ring; Geometric parameters are calculated based on the hole type to obtain the hole characteristic parameters.
2. The hole feature extraction method based on triangular facets according to claim 1, characterized in that: The process of extracting the vertex coordinates of all triangular faces from the target face data, and then deduplicating and indexing all the triangular vertex coordinates to obtain unique vertex index data, specifically includes: Extract the vertex coordinates of all triangles from the target face data as the original vertices to obtain the original vertex list; Create a unique vertex list and index mapping table; Iterate through each original vertex in the original vertex list and use the extracted original vertices as the current original vertex; Compare the coordinates of the current original vertex with the coordinates of the unique vertex in the unique vertex list; If the coordinate difference between the current original vertex and a certain unique vertex is within the preset tolerance range, then the two are determined to be the same vertex, the original vertex is mapped to the index of the unique vertex, and the mapping relationship is recorded in the index mapping table. If the coordinate difference between the current original vertex and all unique vertices in the unique vertex list exceeds the preset tolerance range, then the current original vertex is determined to be a new unique vertex. The original vertex is added to the unique vertex list as a new unique vertex, a new unique index is assigned to the new unique vertex, the original vertex is mapped to the new unique index, and the mapping relationship is recorded in the index mapping table. After traversal, a list of unique vertices and a mapping from the original vertices to the unique vertex indices are obtained; The mapping relationships are integrated to obtain unique vertex index data.
3. The hole feature extraction method based on triangular facets according to claim 1, characterized in that: The step of extracting edges from each triangular facet based on unique vertex index data to obtain a set of boundary edges specifically includes: Construct an edge count table; Iterate through each triangle, taking each triangle obtained in turn as the current triangle and obtaining the coordinates of the three original vertices of the current triangle; Based on the unique vertex index data, find the unique vertex index corresponding to each original vertex of the current triangle facet to obtain three unique vertex indices; Combine the three unique vertex indices to generate multiple edges; For each generated edge, rearrange the indices of its two unique vertices in ascending order of their values to obtain a canonical edge; Using the normalized edge as the index key, search the edge count table to see if the index key exists. If it exists, increment the count value corresponding to the index key by 1; if it does not exist, add the index key to the edge count table and set the count value to 1. After traversing all the triangular faces, the normalized edges with a count of 1 in the edge count table are marked as boundary edges and integrated to obtain the boundary edge set.
4. The hole feature extraction method based on triangular facets according to claim 1, characterized in that: The step of constructing the original boundary ring set based on the adjacency relationships in the boundary edge set specifically includes: Select a boundary edge from the set of boundary edges as the starting edge, and record the two endpoints of the starting edge, which are denoted as the starting point and the current point, respectively; Using the current point as the search point, find the boundary edge in the boundary edge set that coincides with the coordinates of the current point, and use it as the adjacent edge; Connect the found adjacent edge to the current boundary edge, and update the other endpoint of the adjacent edge that is different from the current point to the new current point; Repeat the search until the new current point coincides with the starting point coordinates, and form an original boundary loop by connecting all the boundary edges traversed during the search process in the order of connection. Remove all boundary edges that form the original boundary ring from the boundary edge set and continue the search until the boundary edge set is empty, thus obtaining the original boundary ring set.
5. The hole feature extraction method based on triangular facets according to claim 1, characterized in that: The validity analysis of the original set of boundary rings to obtain valid boundary rings specifically includes: Traverse each original boundary ring in the set of original boundary rings and count the number of vertices in each original boundary ring; Determine if the number of vertices is less than 3. If so, the original boundary cycle is determined to be invalid and removed; otherwise, the original boundary cycle is determined to be valid and marked. After the traversal is complete, all original boundary cycles marked as valid cycles are taken as valid boundary cycles; Integrate all valid boundary rings to obtain the set of valid boundary rings.
6. The hole feature extraction method based on triangular facets according to claim 1, characterized in that: The step of identifying the inner boundary ring from the effective boundary ring based on the geometric characteristics of the effective boundary ring specifically includes: For each valid boundary ring in the set of valid boundary rings, calculate the perimeter of the valid boundary ring and the area of the region it encloses; Compare the perimeter and area of all valid boundary rings, mark the valid boundary ring with the largest perimeter and area as the outer boundary ring, and mark all the remaining valid boundary rings as inner boundary rings.
7. The hole feature extraction method based on triangular facets according to claim 1, characterized in that: The geometric feature analysis of the inner boundary ring to determine the hole type corresponding to the inner boundary ring specifically includes: Calculate and determine the circularity, eccentricity, and number of corner points that make up the inner boundary ring; If the roundness is greater than the first preset threshold, then the hole type corresponding to the inner boundary ring is determined to be a round hole; If the roundness is not greater than the first preset threshold and the eccentricity is greater than the second preset threshold, then the hole type corresponding to the inner boundary ring is determined to be an elliptical hole. If the number of corner points is greater than or equal to 3, then the hole type corresponding to the inner boundary ring is determined to be a polygonal hole or an irregular hole.
8. The hole feature extraction method based on triangular facets according to claim 1, characterized in that: The calculation of geometric parameters based on the hole type to obtain hole characteristic parameters specifically includes: Determine the hole type corresponding to each inner boundary ring; If the hole type is a circular hole, then calculate the center coordinates, diameter, area of the circular hole, and its normal as the hole characteristic parameters; If the hole type is an elliptical hole, then calculate the major axis length, minor axis length, center point coordinates and normal of the elliptical hole as hole characteristic parameters; If the hole type is a polygonal hole or an irregular hole, then calculate its center point coordinates and area as hole characteristic parameters.
9. A hole feature extraction system based on triangular facets, characterized in that: The acquisition module is used to acquire target surface data of the target part, wherein the target surface data includes multiple triangular facets; The processing module is used to extract the vertex coordinates of all triangles from the target face data, and to perform deduplication and indexing on all triangle vertex coordinates to obtain unique vertex index data. The extraction module is used to extract the edges of each triangle based on the unique vertex index data to obtain the set of boundary edges; The building module is used to construct the original set of boundary rings based on the adjacency relationships in the set of boundary edges; The analysis module is used to perform validity analysis on the original set of boundary rings to obtain valid boundary rings; The identification module is used to identify the inner boundary ring from the valid boundary ring based on the geometric features of the valid boundary ring; The determination module is used to perform geometric feature analysis on the inner boundary ring and determine the hole type corresponding to the inner boundary ring. The calculation module is used to calculate geometric parameters based on the hole type to obtain the hole characteristic parameters.
10. A hole feature extraction device based on triangular facets, characterized in that: The hole feature extraction device based on triangular facets includes: a memory and at least one processor, wherein the memory stores instructions; at least one processor invokes the instructions in the memory to cause the hole feature extraction device based on triangular facets to perform the various steps of the hole feature extraction method based on triangular facets as described in any one of claims 1-8.