A section filling method and system suitable for a complex structure triangular mesh model
By calculating the directed line segments where the triangular mesh model intersects the section surface, and using multivariate information to extract and distinguish the inner and outer contours, the problem of poor filling effect of complex model sections in the existing technology is solved, and accurate filling of surface fitting and structure nesting is achieved.
Patent Information
- Application Number
- CN202510968948.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-15
- Publication Date
- 2025-10-10
- Estimated Expiration
- 2045-07-15
AI Technical Summary
Existing triangular mesh model cross-section filling methods cannot effectively handle complex models with surface fitting or multi-layer nested structures, and cannot accurately extract boundary overlapping contours and identify multi-layer nested relationships, resulting in poor visual effects and filling errors.
By calculating the directed line segments where the model triangular facets intersect with the cutting surface, and using multivariate information such as angle, spacing, and number of overlaps, the inner and outer contours are extracted and distinguished, and based on the spatial relationship of the contours, the regions are identified and associated step by step to construct a triangular mesh.
It achieves surface fitting of complex structural triangular mesh models and accurate cross-section filling of structural nesting, improves computing efficiency and visual effects, and can accurately identify multi-layer nesting relationships.
Smart Images

Figure CN120472123B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of model section filling, and in particular to a section filling method and system suitable for complex structure triangular mesh models. Background Art
[0002] The triangular mesh model is a discretized mesh structure composed of triangular faces, which is used to represent the surface of three-dimensional objects or spatial areas. Due to its strong geometric representation capabilities, simple and efficient data structure, and good compatibility, it is widely used in computer graphics, mechanical simulation, digital twins and other fields.
[0003] Model sectioning is a fundamental application in 3D model visualization research. It can intuitively display information such as the size, shape, and relative position of an object's internal structures, and is widely integrated into platforms such as 3D simulation, game development, and BIM design. Because triangular mesh models use discrete triangles to simulate the surface of an object, and its interior is hollow, directly cutting the model with a cutting plane will only reveal holes formed by the outlines, making it impossible to clearly distinguish between the object's solid body and the hollow parts, resulting in a confusing visual experience.
[0004] To address these issues, researchers have proposed a series of methods for filling cross-sections in triangular mesh models. Patent application publication number CN118229907A discloses a dynamic sectioning and section filling method for three-dimensional geological models based on the Cesium engine. After calculating the intersection of the vertical section plane and the model mesh, the Cesuim engine function "CesuimWall" is directly called to construct a vertical panel to block the section area. While this method achieves basic cross-section filling in solid geological models, it imposes strict restrictions on the section direction and application platform. The paper "Algorithm for Generating Arbitrary Directional Sections of Complex Goaf Triangulated Mesh Models" intersects triangular facets and the section plane to obtain a series of line segments. Line segments whose end distances are less than a set threshold are then connected one by one to form a contour. An improved ear-cutting method is then used to construct a mesh within the contour to fill the section. While this method achieves arbitrary direction section filling, the contour construction is based on a priori distance thresholds, making it less versatile. Furthermore, it does not consider the nesting of complex model cross-section contours and is therefore only applicable to models without holes and with a single structure. The paper "Research on Cutting Simulation of Surface Models with Internal Holes" extracts the cut contours based on a closed loop detection algorithm. It first selects contours not contained by other contours as outer contours, while treating all other contours as inner contours. After constructing a triangular mesh of the outer contour, it then "hollows out" the contours using the inner contours, thus filling the cross-section of the model containing internal holes. However, the closed loop detection algorithm used in this method connects line segments by determining whether the coordinates of intersecting segments are consistent, resulting in a low error tolerance. While this method enables simple cross-section filling of contours containing holes by distinguishing between inner and outer contours, it is limited to scenarios where a single outer contour is nested within a layer of inner contours and cannot handle multiple outer contours or multiple layers of nested contours. The paper "Arbitrary Cutting Algorithm Based on 3D Surface Models" further optimizes the contour relationship extraction process. It simultaneously extracts multiple outer contours based on the assumption that contours not contained by other contours are outer contours, but still only considers one layer of nested contour relationships. To achieve cross-section filling of multi-layered nested contours, the paper "Research on Automatic and Interactive Implicit Regional 3D Geological Modeling and Sectioning Analysis" proposes extracting contour nesting levels by iteratively determining contour containment relationships, thereby distinguishing and associating outer surface contours with inner hole contours. However, this method directly identifies contours contained in 2 or more layers of contours as outer surface contours, and therefore cannot identify the inner and outer relationships of 4 or more nested contours, and cannot handle more complex nested models.
[0005] Unlike the aforementioned methods, which achieve solid cross-section filling through contour extraction, nested recognition, and cross-section mesh construction, the paper "Research and Implementation of Dynamic Sectioning and Section Closure Display Methods for Solid Surface Models" directly colorizes the pixels on the mesh surface facing away from the camera during the rendering phase to achieve visual cross-section filling. However, this method cannot assign corresponding materials to the cross-sections, and the single-color rendering lacks realism. Furthermore, since the model cross-sections are not meshed, it is impossible to cut the model into multiple independent units, making it only useful for display purposes.
[0006] Currently, several commercial software programs, such as BIMFace, BIMe, Black Hole Engine, and Unreal Engine, have added model sectioning capabilities, but these methods can only fill in contour sections without holes and are ineffective when it comes to nested contours. Furthermore, all of these methods assume clear separation between contours and minimal spacing between adjacent section segments during the contour extraction phase. These methods are not suitable for situations where the model surfaces fit together, resulting in overlapping contours, or where the contours diverge, resulting in the shortest-spacing segments not being on the same three-dimensional surface.
[0007] In summary, the existing triangular mesh model cross-section filling methods are unable to achieve surface fitting or solid cross-section filling of multi-layer nested models. It is very necessary to develop a complex model cross-section filling method that can extract boundary overlapping contours and identify multi-layer nested relationships. Summary of the Invention
[0008] The purpose of the present invention is to address the defects of the existing technology and provide a section filling method and system suitable for complex structure triangular mesh models. It can realize automatic filling of sections of complex models with surface fitting or structural nesting through section segment direction correction, multi-information driven contour extraction and step-by-step area identification from the inside to the outside.
[0009] In order to solve the above technical problems, in a first aspect, the present invention provides a cross-section filling method applicable to a triangular mesh model of a complex structure, comprising:
[0010] S1. Calculate the directed line segments where the triangular facets of the model intersect with the cutting plane and save them to the list ListE1. The directions of the directed line segments corresponding to the inner and outer contours of the model are opposite.
[0011] S2, map the coordinates of the directed line segments in ListE1 to the two-dimensional plane coordinate system where the section plane is located, forming a list ListE2;
[0012] S3. Based on the angle, spacing, and overlap times of the directed line segments in ListE2, extract the cross-sectional profile of the model from ListE2 and store it in ListC.
[0013] S4. Determine the contour type of each cross-sectional contour in the list ListC, where the contour type includes an outer contour and an inner contour, and associate the outer contour with the corresponding inner contour based on the contour spatial relationship;
[0014] S5. Construct a triangular mesh based on the associated inner and outer contours and reversely map it to three-dimensional space.
[0015] In some embodiments, step S3 includes:
[0016] S31. Initialize the list ListC to an empty list;
[0017] S32. Traverse the directed line segments in the list ListE2, and execute steps S321 to S323;
[0018] S321. Initialize the contour C to an empty coordinate list, store the endpoints of the current directed line segment into the contour C in sequence, and remove the current directed line segment from the list ListE2;
[0019] S322. Based on the spacing and angle information between contour C and the directed line segments in ListE2, determine one or more directed line segments from ListE2 as candidate extension line segments for contour C. Determine the extension line segments of contour C based on the overlap count information of each candidate extension line segment. Extend contour C using the extended line segments and remove the extended line segments from ListE2.
[0020] S323. Determine whether the distance from the start point to the end point of contour C is less than τ1. If so, remove the end point and add contour C to list ListC. If not, execute step S322; wherein τ1 is the global distance threshold.
[0021] Furthermore, step S322 includes:
[0022] S3221. Get the starting point P of the contour C s , end point P e and the point P before the end point p , construct an empty list ListId, which is used to store the sequence numbers of the candidate extension segments in the list ListE2;
[0023] S3222. For any directed line segment in ListE2, if it satisfies:
[0024] (a) Headend to P e The distance is less than τ1;
[0025] (b) Direction and P p to P e The direction angle is not greater than α;
[0026] (c) Headend to P e The distance from the tail end to P e distance;
[0027] The serial number of the directed line segment is stored in the list ListId; where τ1 is the global distance threshold and α is the angle threshold;
[0028] S3223. Assign τ2 to all directed line segments from the beginning to P corresponding to the list ListId. e The shortest distance is multiplied by σ. If τ2> τ1, then τ2 is assigned to τ1; where σ is the threshold coefficient;
[0029] S3224. For any directed line segment corresponding to the list ListId, if its head end reaches P e If the distance is greater than τ2, the sequence number of the directed line segment is removed from ListId;
[0030] S3225. For all directed line segments corresponding to the list ListId, if there are two line segments E1 and E2 such that the distance between the end of E1 and the beginning of E2 is less than the distance between the beginning of E1 and the beginning of E2, then remove the sequence number corresponding to E2 from the list ListId.
[0031] S3226. If the list ListId is empty, terminate the loop and jump to step S323; if the list ListId has only one element, the directed line segment corresponding to the list ListId is the extended line segment of the contour C;
[0032] S3227. Add the tail end of the extended line segment of contour C to the tail of contour C, and remove the extended line segment from list ListE2; if list ListE2 is empty or the distance between the beginning and the end of contour C is less than τ1, terminate the loop.
[0033] Furthermore, step S3226 includes: if ListId has multiple elements, for each directed line segment E corresponding to ListId, count the number of directed line segments in ListE2 whose direction is greater than α from the direction of E and whose tail ends at P e The number of overlapping line segments n whose distance is less than τ2 E , select the corresponding line segment with the largest number of overlapping line segments in ListId as the extension line segment of contour C. If there are multiple line segments with the largest number of overlapping segments, select the line segment with the largest number of overlapping line segments from the beginning to P e The line segment with the smallest distance is taken as the extended line segment of contour C;
[0034] In some embodiments, step S3 includes:
[0035] S33. For each contour in the list ListC, merge short line segments and collinear line segments.
[0036] Furthermore, step S33 includes:
[0037] S31 defines a line segment length threshold λ, and for each contour in ListC, traverses its vertices and executes steps S311 to S312 during the traversal process;
[0038] S311. Get the current vertex P c2 The preceding vertex P c1 and subsequent vertex P c3 , if P c2 is the starting point of the contour, then P c1 For the end point of the contour, if P c2is the end point of the contour, then P c3 is the starting point of the contour;
[0039] S312. If P c1 、P c2 、P c3 Meet any of the following conditions:
[0040] (a)P c1 to P c2 The distance is less than λ;
[0041] (b)P c2 to P c3 The distance is less than λ;
[0042] (c)P c1 to P c2 The direction of P c2 to P c3 consistent direction;
[0043] Then remove point P from contour C c1 .
[0044] In some embodiments, in step S4, the method of determining the profile type of each cross-sectional profile in the list ListC includes:
[0045] S41. Calculate the directed area of the region enclosed by each contour in ListC based on Green's formula. A positive directed area indicates that the contour points are sorted counterclockwise, otherwise they are sorted clockwise.
[0046] S42. Search for the contour C with the largest absolute value of the directed area in ListC max , get the sign of its directed area;
[0047] S43 constructs a mapping table MapC, whose key value is the sequence number of the outer contour in ListC, and the corresponding data is a set of sequence numbers of the inner contour in ListC;
[0048] S44. Build the outer contour number list ListIdOut, build the inner contour number list ListIdIn, for any contour in ListC, if its directed area symbol is the same as C max If they are the same, add them to the list ListIdOut, otherwise add them to the list ListIdIn.
[0049] In some embodiments, in step S4, the method of associating each outer contour with one or more corresponding inner contours includes:
[0050] S45. Traverse the list ListIdOut elements and execute steps S451~S454 during the traversal process;
[0051] S451. For the current outer contour C o , if there exists other outer contour in C o , skip the current element traversal, otherwise execute step S452;
[0052] S452. Remove the current index idOut from ListIdOut and construct data <idOut, listIdInCur>, where listIdInCur is an empty index list;
[0053] S453. For any index IdIn in ListIdIn, if its corresponding contour C i is in C o , and does not have a containing relationship with any contour corresponding to listIdInCur, add IdIn to listIdInCur and remove it from ListIdIn;
[0054] S454. Store data <idOut, listIdInCur> in index mapping table MapC.
[0055] In some embodiments, in step S1, before calculating the directed line segment of the intersection of the triangular patch of the model and the section plane, the intersection is judged:
[0056] Calculate the spatial relationship between the bounding box of the model and the section plane. If the bounding box does not intersect the section plane, end the process. If the bounding box intersects the section plane, calculate the spatial relationship between all triangular patches of the model and the section plane. If the current triangular patch does not intersect the section plane, skip the current triangular patch. If the current triangular patch intersects the section plane, calculate the directed line segment corresponding to the intersection line of the current triangular patch and the section plane and save it to the list ListE1.
[0057] In some embodiments, in step S1, the method for calculating the directed line segment of the intersection of the triangular patch of the model and the section plane includes:
[0058] Calculate the intersection points P1 and P2 of the three edges of the triangular patch and the section plane M;
[0059] If the inequality cross(N t , P2-P1) * N m < 0 is satisfied, exchange the coordinate values of P1 and P2, where cross represents the cross product of vectors, * represents the dot product of vectors, N t and N m represent the normal vectors of the triangular patch and the section plane, respectively;
[0060] Use the coordinate pair (P1, P2) to represent the directed line segment of the intersection of the triangular patch and the section plane.
[0061] In a second aspect, the present application provides a system for implementing the profile filling method for complex triangular mesh models, comprising:
[0062] An intersection line calculation module for calculating the directed line segments intersecting the triangular facets of the model and the section plane and saving to a list ListE1;
[0063] A two-dimensional mapping module for mapping the coordinates of the directed line segments in ListE1 to the two-dimensional plane coordinate system in which the section plane is located, forming a list ListE2;
[0064] A contour extraction module for extracting the profile contours of the model from ListE2 and saving to a list ListC;
[0065] A contour association module for determining the contour types of each profile contour in ListC and associating each outer contour with one or more corresponding inner contours;
[0066] A three-dimensional mapping module for constructing a triangular mesh based on the associated inner and outer contours and reverse mapping to the three-dimensional space.
[0067] In a third aspect, the present application provides a non-transitory computer readable storage medium for storing a computer program or instructions, which when executed by a computer, causes the profile filling method for complex triangular mesh models to be implemented.
[0068] In a fourth aspect, the present application provides a computer program product comprising computer instructions; when part or all of the computer instructions are run on a computer, the profile filling method for complex triangular mesh models is executed.
[0069] The present application has the following advantages:
[0070] 1. The present application can realize automatic profile filling of complex triangular mesh models with surface fitting or structure nesting through profile cutting line segment direction correction, multi-element information driven contour extraction, and inside-out step-by-step region identification.
[0071] 2. The present application avoids unnecessary calculations by intersecting the bounding box of the model with the section plane to preliminarily determine the model section state, and merging short line segments and collinear line segments, thereby improving the operation efficiency without losing accuracy.
[0072] 3. The present application corrects the intersection line segment direction by the normal of the section plane and the normal of the triangular facet, thereby constraining the model surface section intersection line segment direction to be consistent, and distinguishing the inner and outer contours, providing a priori basis for subsequent contour extraction and region identification.
[0073] 4. The present invention drives the screening of contour extension segments based on multivariate information such as dynamic and static distance thresholds, direction angles and overlapping statistics. It can effectively avoid the interference of contour line overlap and extremely short intersection segments on the selection of contour extension segments, and realize the accurate extraction of the profile contour of the model surface fitting.
[0074] 5. The present invention divides the inner contour and the outer contour based on the area and clockwise direction, and extracts the filling area step by step from the inside to the outside, which can accurately identify the multi-layer nested model of the structure and distinguish the cross-section filling. BRIEF DESCRIPTION OF THE DRAWINGS
[0075] Figure 1 is a flow chart of the method of the present invention;
[0076] Figure 2 A schematic diagram of the difficulties in cutting and filling a complex triangular mesh model;
[0077] Figure 3 A schematic diagram of directed line segments where triangular facets and cutting planes intersect in the computational model of the present invention;
[0078] Figure 4 Schematic diagram of three conditions used for screening extended line segments of the contour overlap area of the present invention;
[0079] Figure 5 This is a schematic diagram of candidate extended line segments excluding the tail of a non-continuous contour through distance calculation in the present invention;
[0080] Figure 6 This is a schematic diagram of the present invention filtering extended line segments by using overlapping times information;
[0081] Figure 7 Schematic diagram of the causes of redundant contour segments and the simplified solution of the present invention;
[0082] Figure 8 This is a schematic diagram of the contour matching solution extracted step by step from the inside to the outside of the present invention;
[0083] Figure 9 This is a comparison chart of the sectioning and filling results of the present invention, the Black Hole Engine, and the native function of the Unreal Engine based on the same model. DETAILED DESCRIPTION
[0084] In order to make the technical problems, technical solutions and beneficial effects to be solved by this application more clearly understood, the present application is further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain this application and are not intended to limit this application.
[0085] A specific implementation flow chart of a cross-section filling method for a complex structure triangular mesh model provided by the present invention is as follows: Figure 1This method aims to solve the problem that the existing methods have poor sectioning and filling effects on complex models with fitted surfaces and nested structures. The difficulties of sectioning and filling on complex models with fitted surfaces and nested structures are as follows: Figure 2 As shown in the figure, the gaps between adjacent intersection segments are too large, contour lines are nested in multiple layers, and contour lines overlap. The existing distance-based contour connection method and simple filling area recognition method are difficult to correctly extract contours and identify filling areas.
[0086] The method of the present invention comprises the following steps:
[0087] S1. Calculate the directed line segments where the triangular facets of the model intersect with the cutting plane and save them to the list ListE1. The directions of the directed line segments corresponding to the inner and outer contours of the model are opposite.
[0088] The method for calculating the directed line segments where the triangular facets of the model intersect with the cutting plane includes:
[0089] Calculate the intersection points P1 and P2 of the three edges of the triangle and the cutting plane M;
[0090] If the inequality cross(N t ,P2-P1) * N m < 0, then swap the coordinate values of P1 and P2, where cross means to find the vector cross product, * means to find the vector dot product, N t and N m Represent the normal vectors of the triangle and the cutting surface respectively, such as Figure 3 As shown;
[0091] The coordinate pair (P1, P2) represents the directed line segment where the triangle intersects the cutting plane.
[0092] In the above process of calculating the directed line segments corresponding to the intersection of the triangle patch and the cutting plane, the direction of the intersection line segment is corrected based on the cutting plane normal vector and the triangle normal vector, so that when observing the cutting plane, the direction of the directed line segment corresponding to the outer contour of the model is always counterclockwise, and the direction of the directed line segment corresponding to the inner contour is always clockwise, as shown in the following example: Figure 3 Constraining the direction of the intersection line provides information support for subsequent contour extraction, such as ensuring that adjacent contour segments should connect end to end and not reverse direction. Furthermore, during the infill region recognition phase, contour direction can be used to distinguish inner and outer contours.
[0093] It should be noted that the process of calculating the intersection line between the model and the cutting surface can be decomposed into the task of finding the intersection between each triangle of the model and the cutting surface. Complex models have many triangles, and the amount of intersection calculation for each one is large, and there may be a large number of invalid intersection calculations. Therefore, in step S1, before calculating the directed line segments where the triangles of the model intersect with the cutting surface, an intersection judgment should be performed. The intersection judgment method includes:
[0094] S11. The plane formula for obtaining the section plane M is ax+by+cz+d=0. Substitute the coordinates of the eight vertices of the bounding box of the model into the function f m (x,y,z)=ax+by+cz, if the function f m If the return value is positive or negative, the bounding box intersects the cutting plane; otherwise, the bounding box and the cutting plane do not intersect, and the filling of the model based on the cutting plane ends;
[0095] S12. Construct a list ListE1 for storing directed line segments corresponding to the intersection of the model and the section plane M. For each triangle in the model, execute step S13;
[0096] S13. Substitute the coordinates of the three vertices of the triangle into the function f m If the three return values are neither positive nor negative, skip the current triangle processing process; otherwise, calculate the directed line segment where the triangle intersects the cutting plane and save it to the list ListE1.
[0097] The present invention first preliminarily determines whether the model and the cutting plane intersect based on the intersection relationship between the bounding box of the model and the cutting plane. If the bounding box and the cutting plane do not intersect, the task is terminated directly, avoiding invalid intersection operations of a large number of triangular facets and the cutting plane.
[0098] S2. Map the coordinates of the directed line segments in ListE1 to the two-dimensional plane coordinate system where the section plane is located to form ListE2.
[0099] S3. Based on the angle, spacing, and overlap times of the directed line segments in ListE2, extract the cross-sectional profile of the model from ListE2 and store it in ListC.
[0100] Step S3 specifically includes:
[0101] S31. Initialize the list ListC to an empty list;
[0102] S32. Traverse the directed line segments in the list ListE2, and execute steps S321 to S323;
[0103] S321. Initialize the contour C to an empty coordinate list, store the endpoints of the current directed line segment into the contour C in sequence, and remove the current directed line segment from the list ListE2;
[0104] S322. Based on the spacing and angle information between contour C and the directed line segments in ListE2, determine one or more directed line segments from ListE2 as candidate extension line segments for contour C. Determine the extension line segments of contour C based on the overlap count information of each candidate extension line segment. Extend contour C using the extended line segments and remove the extended line segments from ListE2.
[0105] Step S322 specifically includes:
[0106] To improve the accuracy of extended segment screening when contours overlap, the subsequent segment screening conditions can be set from three dimensions: 1. Distance. The distance from the beginning of the extended segment to the end of the current contour should be close enough. This can be determined by calculating the distance between the two and comparing it with the set threshold. However, multiple intersecting segments may meet the preset distance threshold, which is not accurate enough. 2. Direction. The intersecting segment from another overlapping contour will go in the opposite direction to the current contour. It can be excluded by eliminating the reverse direction segment. 3. Direction. The distance from the beginning of the extended segment to the end of the contour should be closer than the distance from the end of the extended segment to the end of the contour. This can be determined by calculating and comparing the distances between the two.
[0107] S3221. Get the starting point P of the contour C s , end point P e and the point P before the end point p , construct an empty list ListId, which is used to store the sequence numbers of the candidate extension segments in the list ListE2;
[0108] S3222. For any directed line segment in ListE2, if it satisfies:
[0109] (a) Headend to P e The distance is less than τ1;
[0110] (b) Direction and P p to P e The direction angle is not greater than α;
[0111] (c) Headend to P e The distance from the tail end to P e distance;
[0112] The serial number of the directed line segment is stored in the list ListId; where τ1 is the global distance threshold and α is the angle threshold;
[0113] Figure 4 This is an example of using the three conditions in step S3222 to perform screening. Figure 4 In the two cases on the left, the two checked directed line segments both meet the condition (a) that the first end reaches P e The distance is less than τ1, τ1 can be 1cm, Pe Refers to the right endpoint of the directed line segment corresponding to the exclamation mark; on this basis, it is necessary to use conditions (b) and (c) to filter again; for Figure 4 In the upper left corner, since the directions of the two checked directed segments are completely opposite to the directions of the directed segments corresponding to the exclamation marks, the direction of the two checked segments is completely opposite to the direction of the directed segments corresponding to the exclamation marks. Therefore, the direction of the two checked segments is completely opposite to the direction of the exclamation marks corresponding to the exclamation marks. p to P e The direction angle is not greater than α (where α is 179°), the correct extension line segment can be screened out; Figure 4 In the lower right corner, since the directions of the two checked directed segments are 90° to the directed segment corresponding to the exclamation mark, condition (b) still cannot be filtered, so condition (c) is used to filter the first end to P. e The distance from the tail end to P e The correct extended line segment can be selected by measuring the distance.
[0114] Although the above steps have screened candidate extension segments using the global distance threshold τ1, a single threshold is not fully applicable to models of different sizes in different regions, making it difficult to avoid multiple extension segments meeting the distance requirement. To further reduce the number of candidate extension segments, it is necessary to dynamically adjust the local distance threshold τ2 and screen the candidate extension segments again.
[0115] S3223. Assign τ2 to all directed line segments from the beginning to P corresponding to the list ListId. e The shortest distance is multiplied by σ. If τ2> τ1, then τ2 is assigned to τ1; where σ is the threshold coefficient;
[0116] It should be noted that the gap size of directed line segments of different models may be different. For example, in a rough dam model, the gap between adjacent directed line segments in the cut-out outline may be 0.8 cm, while in a fine electromechanical model, it may be only 0.05 cm, and the length of some line segments may be only 0.3 cm. During the execution of the algorithm, no matter how large the model scale is or how fine the surface is, the global distance threshold of 1 cm is first used to determine whether the intersecting line segments are connected. For large-scale, rough models, a 1 cm spacing threshold may be sufficient to filter out connected line segments. However, for small-scale or fine models, the 1 cm threshold is too large, and the 1 cm threshold may filter out multiple extended line segments that meet the conditions. Therefore, the present invention proposes a local distance threshold τ2, which is calculated based on the distance from the head end of multiple directed line segments to P e The shortest distance is calculated, which is consistent with the actual situation of the model, and the threshold coefficient σ can be set to 3.
[0117] S3224. For any directed line segment corresponding to the list ListId, if its head end reaches P e If the distance is greater than τ2, the sequence number of the directed line segment is removed from ListId;
[0118] S3225. For all directed line segments corresponding to the list ListId, if there are two line segments E1 and E2, and the distance between the end of E1 and the beginning of E2 is less than the distance between the beginning of E1 and the beginning of E2, then remove the sequence number corresponding to E2 from the list ListId; Figure 5 As shown, when there is a shorter E1, so that the head ends of E1 and E2 are both within the range of τ2, it is necessary to screen E1 and E2.
[0119] S3226. If the list ListId is empty, terminate the loop and jump to step S323; if the list ListId has only one element, the directed line segment corresponding to the list ListId is the extended line segment of the contour C;
[0120] If ListId has multiple elements, for each directed line segment E corresponding to ListId, count the elements in ListE2 whose direction is greater than α from the direction of E and whose tail ends at P. e The number of overlapping line segments n whose distance is less than τ2 E , select the corresponding line segment with the largest number of overlapping line segments in ListId as the extension line segment of contour C. If there are multiple line segments with the largest number of overlapping segments, select the line segment with the largest number of overlapping line segments from the beginning to P e The line segment with the smallest distance is taken as the extended line segment of contour C;
[0121] It should be noted that if Figure 6 As shown, at the boundaries of the overlapping contours, there are divergent directions. The multivariate information screening and local dynamic thresholding described above are insufficient to make the correct selection. Since the overlapping direction is generally the correct direction of the contours, we can use the number of overlaps of candidate extension segments (i.e., candidate extension line segments) as a screening criterion.
[0122] S3227. Add the tail end of the extended line segment of contour C to the tail of contour C, and remove the extended line segment from list ListE2; if list ListE2 is empty or the distance between the beginning and the end of contour C is less than τ1, terminate the loop.
[0123] S323. Determine whether the distance from the start point to the end point of contour C is less than τ1. If so, remove the end point and add contour C to list ListC. If not, execute step S322; wherein τ1 is the global distance threshold.
[0124] The present invention extracts a directed line segment from the list ListE2 into the contour C, and then uses the angle, spacing and overlap times information between the contour C and other directed line segments in the list ListE2 to screen the other directed line segments in the list ListE2, selects the extended line segment of the contour C, and extends the contour C until the contour C forms a complete contour, thereby completing the extraction of a complete contour. After the complete contour is saved in the list ListC, the next complete contour can be extracted, thereby reorganizing the directed line segments in the list ListE2 into multiple corresponding complete contours in the list ListC, which can then be associated and filled according to the internal and external relationships of each complete contour.
[0125] like Figure 7 As shown in (a) and (b) in the figure, when the triangular facets of the model are divided too finely, the contour line segments are redundant. When the section plane is too close to the triangular facet vertices, the length of the directed line segments is extremely short. In order to improve the efficiency of the subsequent steps while ensuring the calculation accuracy, it is necessary to simplify the contour line structure and reduce the number of line segments, such as Figure 7 Therefore, step S3 further includes:
[0126] S33. For each contour in the list ListC, merge short line segments and collinear line segments.
[0127] Step S33 specifically includes:
[0128] S31 defines a line segment length threshold λ, and for each contour in ListC, traverses its vertices and executes steps S311 to S312 during the traversal process;
[0129] S311. Get the current vertex P c2 The preceding vertex P c1 and subsequent vertex P c3 , if P c2 is the starting point of the contour, then P c1 For the end point of the contour, if P c2 is the end point of the contour, then P c3 is the starting point of the contour;
[0130] S312. If P c1 、P c2 、P c3 Meet any of the following conditions:
[0131] (a)P c1 to P c2 The distance is less than λ;
[0132] (b)P c2 to P c3 The distance is less than λ;
[0133] (c)Pc1 to P c2 The direction of P c2 to P c3 consistent direction;
[0134] Then remove point P from contour C c1 .
[0135] S4. Determine the contour type of each cross-section contour in the list ListC. The contour type includes an outer contour and an inner contour. Associate the outer contour with the corresponding inner contour based on the contour spatial relationship.
[0136] like Figure 2 As shown in (b), the cross-section contours of a complex triangular mesh model may have multiple nested layers. It is necessary to establish a correspondence between the outer and inner contours to distinguish different cross-section filling areas. Since the directions of the inner and outer contours have been constrained in the intersection calculation stage of step S1, the inner and outer contours can be quickly distinguished based on the contour direction. Step S4 specifically includes:
[0137] S41. Calculate the directed area of the region enclosed by each contour in ListC based on Green's formula. A positive directed area indicates that the contour points are sorted counterclockwise, otherwise they are sorted clockwise.
[0138] S42. Search for the contour C with the largest absolute value of the directed area in ListC max , get the sign of its directed area;
[0139] S43 constructs a mapping table MapC, whose key value is the sequence number of the outer contour in ListC, and the corresponding data is a set of sequence numbers of the inner contour in ListC;
[0140] S44. Build the outer contour number list ListIdOut, build the inner contour number list ListIdIn, for any contour in ListC, if its directed area symbol is the same as C max If they are the same, add them to the list ListIdOut, otherwise add them to the list ListIdIn;
[0141] S45. Traverse the elements of the list ListIdOut and execute steps S451 to S454 during the traversal process; a sectioned fill area corresponds to one outer contour and one or more inner contours, that is, no other outer contours can exist inside the outer contour of the fill area. Based on this, the correspondence between the inner and outer contours can be extracted step by step from the inside out;
[0142] S451. For the current outer contour C o If there are other outer contours corresponding to the list ListIdOut in C o If the current element is within the range, the current element traversal is skipped, otherwise step S452 is executed;
[0143] S452. Remove the current sequence number idOut from ListIdOut and build the data<idOut,listIdInCur> , where listIdInCur is an empty serial number list;
[0144] S453. For any sequence number IdIn in ListIdIn, if it corresponds to contour C i In C o If the inner contours are not contained within any contours in listIdInCur, then IdIn is added to listIdInCur and removed from ListIdIn. When there are overlapping structures in the model, inner contours from different structures may be inside the same outer contour. If two overlapping inner contours are associated with the same outer contour, the meshing of the cut and fill area will crash. At the same time, the outer contour that has lost the inner contour will lack the holes that should be there after the cut and fill. To this end, it is necessary to avoid matching overlapping inner contours with outer contours.
[0145] S454.Data<idOut,listIdInCur> Stored in the serial number mapping table MapC.
[0146] S5. Construct a triangular mesh based on the associated inner and outer contours and reversely map it to three-dimensional space.
[0147] like Figure 9 The figure shows a comparison of the cross-section filling results of the same model using the Black Hole Engine, the native Unreal Engine functionality, and the proposed method. It can be seen that for complex models with aligned surfaces and nested structures, existing commercial software suffers from numerous holes and filling errors. In contrast, the proposed method achieves accurate cross-section filling and achieves the best visual effect.
[0148] The present invention also provides a system for implementing the cross-section filling method applicable to a complex structure triangular mesh model, comprising:
[0149] Intersection line calculation module: used to calculate the directed line segments where the triangular facets of the model intersect with the cutting plane and save them to the list ListE1;
[0150] Two-dimensional mapping module: used to map the coordinates of the directed line segments in ListE1 to the two-dimensional plane coordinate system where the section plane is located, forming a list ListE2;
[0151] Contour extraction module: used to extract the cross-sectional contour of the model from the list ListE2 and store it in the list ListC;
[0152] Contour association module: used to determine the contour type of each section contour in the list ListC and associate each outer contour with one or more corresponding inner contours;
[0153] 3D mapping module: used to construct a triangular mesh based on the associated inner and outer contours and reversely map it to 3D space.
[0154] The present invention also provides a non-transitory computer-readable storage medium for storing a computer program or instruction. When the computer program or instruction is executed by a computer, the cross-section filling method applicable to a complex structure triangular mesh model is implemented.
[0155] The present invention also provides a computer program product, which includes computer instructions; when part or all of the computer instructions are run on a computer, the cross-section filling method applicable to a complex structure triangular mesh model is executed.
[0156] In the above embodiments, all or part of the embodiments may be implemented by software, hardware, firmware, or any combination thereof. When implemented using software, all or part of the embodiments may be implemented in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of the present application are generated. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions may be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via a wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) method. The computer-readable storage medium may be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more available media integrated therein. The available medium may be a magnetic medium (eg, a floppy disk, a hard disk, a magnetic tape), an optical medium (eg, a high-density digital video disc (DVD)), or a semiconductor medium (eg, a solid state disk (SSD)).
[0157] The above-described embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. These modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the various embodiments of the present application, and should all be included in the scope of protection of the present application.
Claims
1. A cross-section filling method suitable for complex structure triangular mesh models, characterized in that: include: S1. Calculate the directed line segments where the triangular facets of the model intersect with the cutting plane and save them to the list ListE1. The directions of the directed line segments corresponding to the inner and outer contours of the model are opposite. S2, map the coordinates of the directed line segments in ListE1 to the two-dimensional plane coordinate system where the section plane is located, forming a list ListE2; S3. Based on the angle, spacing, and overlap times of the directed line segments in ListE2, extract the cross-sectional profile of the model from ListE2 and store it in ListC. S4. Determine the contour type of each cross-sectional contour in the list ListC, where the contour type includes an outer contour and an inner contour, and associate the outer contour with the corresponding inner contour based on the contour spatial relationship; S5. construct a triangular mesh based on the associated inner contour and outer contour and reversely map it to three-dimensional space; Step S3 includes: S31. Initialize the list ListC to an empty list; S32. Traverse the directed line segments in the list ListE2, and execute steps S321 to S323; S321. Initialize the contour C to an empty coordinate list, store the endpoints of the current directed line segment into the contour C in sequence, and remove the current directed line segment from the list ListE2; S322. Based on the spacing and angle information between contour C and the directed line segments in ListE2, determine one or more directed line segments from ListE2 as candidate extension line segments for contour C. Determine the extension line segments of contour C based on the overlap count information of each candidate extension line segment. Extend contour C using the extended line segments and remove the extended line segments from ListE2. S323. Determine whether the distance from the start point to the end point of contour C is less than τ1. If so, remove the end point and add contour C to the list ListC. If not, execute step S322; where τ1 is the global distance threshold; Step S322 includes: S3221. Get the starting point P of the contour C s , end point P e and the point P before the end point p , construct an empty list ListId, which is used to store the sequence numbers of the candidate extension segments in the list ListE2; S3222. For any directed line segment in ListE2, if it satisfies: (a) Headend to P e The distance is less than τ1; (b) Direction and P p to P e The direction angle is not greater than α; (c) Headend to P e The distance from the tail end to P e distance; The serial number of the directed line segment is stored in the list ListId; where τ1 is the global distance threshold and α is the angle threshold; S3223. Assign τ2 to all directed line segments from the beginning to P corresponding to the list ListId. e The shortest distance is multiplied by σ. If τ2 > τ1, then τ2 is assigned to τ1; where σ is the threshold coefficient; S3224. For any directed line segment corresponding to the list ListId, if its head end reaches P e If the distance is greater than τ2, the sequence number of the directed line segment is removed from ListId; S3225. For all directed line segments corresponding to the list ListId, if there are two line segments E1 and E2 such that the distance between the end of E1 and the beginning of E2 is less than the distance between the beginning of E1 and the beginning of E2, then remove the sequence number corresponding to E2 from the list ListId. S3226. If the list ListId is empty, terminate the loop and jump to step S323; if the list ListId has only one element, the directed line segment corresponding to the list ListId is the extended line segment of the contour C; S3227. Add the tail end of the extended segment of contour C to the tail of contour C and remove the extended segment from list ListE2; if list ListE2 is empty or the distance between the beginning and the end of contour C is less than τ1, terminate the loop; Step S3226 includes: if ListId has multiple elements, for each directed line segment E corresponding to ListId, count the number of directed line segments in ListE2 whose direction is greater than α from the direction of E and whose tail ends at P. e The number of overlapping line segments n whose distance is less than τ2 E , select the corresponding line segment with the largest number of overlapping line segments in ListId as the extension line segment of contour C. If there are multiple line segments with the largest number of overlapping segments, select the line segment with the largest number of overlapping line segments from the beginning to P e The line segment with the smallest distance is taken as the extended line segment of contour C.
2. The cross-section filling method for a complex structure triangular mesh model according to claim 1, characterized in that: Step S3 includes: S33. For each contour in the list ListC, merge short line segments and collinear line segments.
3. The cross-section filling method for a complex structure triangular mesh model according to claim 2, characterized in that: Step S33 includes: S31 defines a line segment length threshold λ, and for each contour in ListC, traverses its vertices and executes steps S311 to S312 during the traversal process; S311. Get the current vertex P c2 The preceding vertex P c1 and subsequent vertex P c3 , if P c2 is the starting point of the contour, then P c1 For the end point of the contour, if P c2 is the end point of the contour, then P c3 is the starting point of the contour; S312. If P c1 、P c2 、P c3 Meet any of the following conditions: (a)P c1 to P c2 The distance is less than λ; (b)P c2 to P c3 The distance is less than λ; (c)P c1 to P c2 The direction of P c2 to P c3 The direction is consistent; Then remove point P from contour C c1 .
4. The cross-section filling method for a complex structure triangular mesh model according to claim 1, characterized in that: In step S4, the method for determining the profile type of each cross-sectional profile in the list ListC includes: S41. Calculate the directed area of the region enclosed by each contour in ListC based on Green's formula. A positive directed area indicates that the contour points are sorted counterclockwise, otherwise they are sorted clockwise. S42. Search for the contour C with the largest absolute value of the directed area in ListC max , get the sign of its directed area; S43 constructs a mapping table MapC, whose key value is the sequence number of the outer contour in ListC, and the corresponding data is a set of sequence numbers of the inner contour in ListC; S44. Build the outer contour number list ListIdOut, build the inner contour number list ListIdIn, for any contour in ListC, if its directed area symbol is the same as C max If they are the same, add them to the list ListIdOut, otherwise add them to the list ListIdIn.
5. The cross-section filling method applicable to a complex structure triangular mesh model according to claim 4, characterized in that: In step S4, the method of associating each outer contour with one or more corresponding inner contours includes: S45. Traverse the list ListIdOut elements and execute steps S451~S454 during the traversal process; S451. For the current outer contour C o If there are other outer contours corresponding to the list ListIdOut in C o If the current element is within the range, the current element traversal is skipped, otherwise step S452 is executed; S452. Remove the current sequence number idOut from ListIdOut and build the data<idOut,listIdInCur> , where listIdInCur is an empty serial number list; S453. For any sequence number IdIn in ListIdIn, if it corresponds to contour C i In C o If it is inside and does not contain any contour corresponding to listIdInCur, IdIn is added to listIdInCur and removed from ListIdIn; S454.Data<idOut,listIdInCur> Stored in the serial number mapping table MapC.
6. The cross-section filling method for a complex structure triangular mesh model according to claim 1, characterized in that: In step S1, before calculating the directed line segments where the triangular facets of the model intersect with the cutting plane, an intersection check is performed: Calculate the spatial relationship between the bounding box of the model and the cutting plane. If the bounding box does not intersect with the cutting plane, end the process. If the bounding box intersects with the cutting plane, calculate the spatial relationship between all the triangles of the model and the cutting plane. If the current triangle does not intersect with the cutting plane, skip the current triangle. If the current triangle intersects with the cutting plane, calculate the directed line segment corresponding to the intersection of the current triangle and the cutting plane and save it to the list ListE1.
7. The cross-section filling method applicable to a complex structure triangular mesh model according to claim 1, characterized in that: In step S1, the method for calculating the directed line segments where the triangular facets of the model intersect with the cutting plane includes: Calculate the intersection points P1 and P2 of the three edges of the triangle and the cutting plane M; If the inequality cross(N t ,P2-P1) * N m < 0, then swap the coordinate values of P1 and P2, where cross means to find the vector cross product, * means to find the vector dot product, N t and N m Represent the normal vectors of the triangle and the cutting surface respectively; The coordinate pair (P1, P2) represents the directed line segment where the triangle intersects the cutting plane.
8. A system for implementing the cross-section filling method for a complex structure triangular mesh model according to any one of claims 1 to 7, characterized in that: include: Intersection line calculation module: used to calculate the directed line segments where the triangular facets of the model intersect with the cutting plane and save them to the list ListE1; Two-dimensional mapping module: used to map the coordinates of the directed line segments in ListE1 to the two-dimensional plane coordinate system where the section plane is located, forming a list ListE2; Contour extraction module: used to extract the cross-sectional contour of the model from the list ListE2 and store it in the list ListC; Contour association module: used to determine the contour type of each section contour in the list ListC and associate each outer contour with one or more corresponding inner contours; 3D mapping module: used to construct a triangular mesh based on the associated inner and outer contours and reversely map it to 3D space.
9. A non-transitory computer-readable storage medium, characterized in that: Used to store computer programs or instructions, when the computer program or instructions are executed by a computer, the cross-section filling method applicable to a complex structure triangular mesh model according to any one of claims 1 to 7 is implemented.
10. A computer program product, characterized in that The computer program product includes computer instructions; when part or all of the computer instructions are run on a computer, the cross-section filling method applicable to a complex structure triangular mesh model according to any one of claims 1 to 7 is executed.
Citation Information
Patent Citations
Three-dimensional geologic model dynamic sectioning and profile filling method based on Cesium engine
CN118229907A
A triangular mesh model-based automatic surface patching algorithm for a sectioned contour
CN109685914A