CN114399598A - Method for solving contour of closable unordered line segment group based on Boolean operation - Google Patents
Method for solving contour of closable unordered line segment group based on Boolean operation Download PDFInfo
- Publication number
- CN114399598A CN114399598A CN202210049789.4A CN202210049789A CN114399598A CN 114399598 A CN114399598 A CN 114399598A CN 202210049789 A CN202210049789 A CN 202210049789A CN 114399598 A CN114399598 A CN 114399598A
- Authority
- CN
- China
- Prior art keywords
- line segment
- contour
- line
- closable
- rectangle
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T17/00—Three dimensional [3D] modelling, e.g. data description of 3D objects
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F7/00—Methods or arrangements for processing data by operating upon the order or content of the data handled
- G06F7/06—Arrangements for sorting, selecting, merging, or comparing data on individual record carriers
- G06F7/08—Sorting, i.e. grouping record carriers in numerical or other ordered sequence according to the classification of at least some of the information they carry
Landscapes
- Engineering & Computer Science (AREA)
- Physics & Mathematics (AREA)
- Theoretical Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Computer Graphics (AREA)
- Geometry (AREA)
- Software Systems (AREA)
- General Engineering & Computer Science (AREA)
- Image Generation (AREA)
Abstract
The invention discloses a method for solving the outline of a closable unordered line segment group based on Boolean operation, which comprises the following steps: inputting a random and disordered line segment group in a plane; making normal vectors of each line segment at two end points of the line segment, wherein the directions of the two normal vectors are opposite and are in the same plane with the line segment; respectively translating each line segment by a tiny distance delta along two directions of a normal vector, and taking the two translated line segments as a characteristic rectangle of a wide construction straight-line segment of which the length is equal to the length of the rectangle and the value of two times of delta is equal to the width of the rectangle; performing Boolean union operation on the rectangles generated by all the line segments; and selecting the inner contour or the outer contour of the union set as the contour of the closable disordered line segment group for filling. By using the method, the contour line needing directed closure can be obtained, the sequencing of the line segment groups is avoided, the calculated amount is reduced, the time complexity of solving the contour algorithm is reduced, and the contour searching efficiency is effectively improved.
Description
Technical Field
The invention relates to the field of computer-aided geometric design, in particular to a method for solving the outline of a closable unordered line segment group based on Boolean operation.
Background
The application of solving the outline of the polygon with the disordered line segment group connected end to end in the plane is widely applied to computer-aided geometric design, such as a slicing algorithm for three-dimensional printing, a connection algorithm in laser trepanning and the like. The most widely used geometric model format in industrial geometric algorithms is the STL format, i.e., the discrete triangular patch model. The STL model simulates an approximate three-dimensional solid model by using a large number of irregular, spatially triangulated patches. Therefore, in the geometric calculation process, the model contour is often surrounded by a large number of unordered tiny line segments. If an available directed closed contour curve is obtained, a correlation algorithm is required to process the closable unordered line segment group.
In the existing literature, there are three contour solving algorithms. The first is an algorithm based on the topological information of the triangular patch, the focal coordinates j1 and j2 of a target triangular patch intersected with a tangent plane are firstly obtained, the next triangular patch linked with the target triangular patch is found, intersection is carried out again, the steps are repeated, and finally the target triangular patch is sequentially connected according to the focal sequence. The second is an algorithm based on the geometric features of the model, which separates the "classes" and "classes" by defining the "potentials" and "energies" of the triangular patches. The algorithm has limited applicability. The third is an algorithm based on geometric continuity of the model, the core of the algorithm is to utilize the continuity of the STL model, the principle is similar to that of the first algorithm, and the defect is that the processing difficulty is high.
In conclusion, the three slicing algorithms have high solving difficulty and long time consumption, and the time complexity of the three slicing algorithms is close to O (n) along with the increase of the number of line segments2)。
Disclosure of Invention
The invention provides a method for solving the polygon outline of a closable unordered line segment group based on Boolean operation, which is used for solving the polygon outline of a closable line segment group which is arranged in an unordered manner in a plane, so that the precision is ensured and the better overall efficiency is realized.
The purpose of the invention is realized by the following technical scheme:
a method for solving the outline of a closable unordered line segment group based on Boolean operation specifically comprises the following steps:
s1: inputting a random and disordered line segment group in a plane;
s2: making normal vectors of each line segment at two end points of the line segment, wherein the directions of the two normal vectors are opposite and are in the same plane with the line segment;
s3: respectively translating each line segment by a tiny distance delta along two directions of a normal vector, and taking the two translated line segments as a characteristic rectangle of a wide construction straight-line segment of which the length is equal to the length of the rectangle and the value of two times of delta is equal to the width of the rectangle;
s4: performing Boolean union operation on the rectangles generated by all the line segments;
s5: and selecting the inner contour or the outer contour of the union set as the contour of the closable disordered line segment group for filling.
Further, the line segment translation distance Δ is small enough to ensure intersection between adjacent feature rectangles.
Further, after S4 is executed, a bias profile with the inner contour of the union set biased outward by Δ or a bias profile with the outer contour of the union set biased inward by Δ is selected and filled as the profile of the closable disordered line segment group.
The invention has the following beneficial effects:
compared with the traditional disordered scattered line segment connection algorithm, the method for solving the polygonal contour of the closable disordered line segment group based on Boolean operation avoids the complex calculation of sequencing line segment groups by generating a plurality of rectangles, and the directional closed polygonal contour connected end to end can be obtained. Has the following advantages:
(1) the topological link information of the unordered scattered line segment group does not need to be established;
(2) the solution speed is faster. The method avoids sequencing the line segment groups, reduces the calculated amount and effectively improves the slicing efficiency.
(3) The algorithm time complexity is O (n), while the traditional algorithm time complexity by ordering the line segment groups is O (n)2) The complexity is greatly reduced.
(4) The method can be applied to solving the slicing outline after three-dimensional printing and slicing, solving the connection path by laser trepanning and other practical problems.
Drawings
FIG. 1 is a flow chart of a method for solving a contour of a closable unordered line segment group based on Boolean operation according to the present invention;
FIG. 2 is a schematic diagram of the STL model three-dimensional slicing process; wherein, the left graph is an STL grid model, and the middle graph is intersected with the STL model by a cutting plane; the right image is a disordered line segment ancestor obtained by slicing;
FIG. 3 is a schematic diagram of feature rectangle generation for line segment groups; the right upper graph is a partial enlarged view of the disordered line segment group, and the right middle graph is a normal vector of each line segment; the lower right graph is a characteristic rectangle of each produced line segment;
FIG. 4 is a Boolean union profile of the target line segment group feature rectangles; the left graph is a characteristic rectangle of each line segment, the middle graph is a result obtained by taking and collecting the characteristic rectangles, and the right graph is an inner contour and an outer contour which generate the target line segment group.
FIG. 5 is a target polygon joining profile for a set of line segments;
fig. 6 is an application diagram of a segment group connecting polygon in a subsequent link of slicing.
Detailed Description
The present invention will be described in detail below with reference to the accompanying drawings and preferred embodiments, and the objects and effects of the present invention will become more apparent, it being understood that the specific embodiments described herein are merely illustrative of the present invention and are not intended to limit the present invention.
The implementation steps of the invention are shown in figure 1, and comprise the following steps:
s1: inputting the random and disordered line segment group in the plane and recording as Vector<Segment>{Seg1、Seg2、…、Segn};
The line segment groups which are scattered and disordered belong to the same plane, and the line segment groups can be connected end to form a closed polygon.
S2: making normal vectors of each line segment at two end points of the line segment, wherein the directions of the two normal vectors are opposite and are in the same plane with the line segment; notation as { n1,n2,…,nk};
S3: respectively translating each line segment by a tiny distance delta along two directions of a normal vector, and taking the two translated line segments as a characteristic rectangle of a wide construction straight-line segment of which the length is equal to the length of the rectangle and the value of two times of delta is equal to the width of the rectangle;
to ensure the accuracy of the generated contour, the line segment translation distance Δ is small enough while ensuring intersection between rectangles.
S4: performing Boolean union operation on the rectangles generated by all the line segments;
s5: and selecting the inner contour or the outer contour of the union as the contour of the closable disordered line segment group.
Because the translation distance delta is small enough, the difference between the inner contour and the outer contour of the rectangular union set is not large, and the required target contour can be selected according to the actual situation.
And deleting redundant parts of the target contour to finally obtain the directed closed contour line. The obtained contour is ensured to have no redundant points and repeated intersecting line segments, and the finally generated closed contour has no problems of circular self-crossing and intersection.
In this embodiment, a three-dimensional slice of a three-dimensional printed STL model is used as a specific engineering application scenario, when a plane and the STL model are used for intersection operation, a group of lines which can be closed and unordered is obtained, and for generating a filling path of the layer of processing area, the inner and outer contours need to be converted into polygons from the line group, as shown in fig. 2. The method for solving the outline of the closable unordered line segment group based on the Boolean operation in the embodiment comprises the following steps:
(1) after the plane intersects with the STL model, a contour model with the set of unordered line segments as a data structure is obtained, which can be expressed as: vector<Segment>{Seg1、Seg2、…、SegnIn which the adjacent elements SegiAnd Segi+1The line segments are not necessarily adjacent in space, if a brute force traversal algorithm is adopted, the space complexity of the polygon outline which is connected end to end is found to be O (n)2)。
(2) Make the normal vector of each line segment, and record as { n1,n2,…,nkAnd the normal vector is to be in the same plane with the line segment group. Segment group Vector generated by slicing<Segment>The normal direction coplanar with the line segment group can be generated segment by segmentBy volume, each segment of line segment can generate two normal vectors in opposite directions, as shown in FIG. 3.
(3) Each line segment is translated by a small distance delta along two directions of a normal vector, the two translated line segments are used as characteristic rectangles of a straight line segment with the length of the rectangle and the value of two times delta being the width of the rectangle, the translation distance delta of the line segments is small enough to ensure the accuracy of the required contour, and meanwhile, the intersection of the rectangles is ensured, and the characteristic rectangles are shown in figure 3.
(4) And performing Boolean union operation on the rectangle group generated by the line segment group to obtain the inner contour and the outer contour of the target section selection characteristic rectangle, as shown in FIG. 4.
(5) The inner contour or the outer contour of the union set is selected as a target polygon contour, and the difference between the inner contour and the outer contour of the rectangular union set is not large due to the fact that the translation distance delta is small enough, and the required target contour can be selected according to actual conditions.
(6) And (3) deleting redundant parts except the target contour, ensuring that redundant points and repeated intersecting line segments do not exist in the finally generated closed contour and the problem of circular self-intersection and intersection does not exist, and finally obtaining the directed contour line as shown in figure 5. When the translation distance delta meets the precision requirement, the polymorphic outer contour can be used as a filling area for STL model three-dimensional printing. The fill path may be a ring bias path (as shown in fig. 6) or a zigzag path.
It will be understood by those skilled in the art that the foregoing is only a preferred embodiment of the present invention, and is not intended to limit the invention, and although the invention has been described in detail with reference to the foregoing examples, it will be apparent to those skilled in the art that various changes in the form and details of the embodiments may be made and equivalents may be substituted for elements thereof. All modifications, equivalents and the like which come within the spirit and principle of the invention are intended to be included within the scope of the invention.
Claims (2)
1. A method for solving the outline of a closable unordered line segment group based on Boolean operation is characterized by comprising the following steps:
s1: inputting a random and disordered line segment group in a plane;
s2: making normal vectors of each line segment at two end points of the line segment, wherein the directions of the two normal vectors are opposite and are in the same plane with the line segment;
s3: respectively translating each line segment by a tiny distance delta along two directions of a normal vector, and taking the two translated line segments as a characteristic rectangle of a wide construction straight-line segment of which the length is equal to the length of the rectangle and the value of two times of delta is equal to the width of the rectangle;
s4: performing Boolean union operation on the rectangles generated by all the line segments;
s5: and selecting the inner contour or the outer contour of the union set as the contour of the closable disordered line segment group for filling.
2. The method of claim 1, wherein the line translation distance Δ is small enough to ensure intersection between adjacent feature rectangles.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210049789.4A CN114399598A (en) | 2022-01-17 | 2022-01-17 | Method for solving contour of closable unordered line segment group based on Boolean operation |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210049789.4A CN114399598A (en) | 2022-01-17 | 2022-01-17 | Method for solving contour of closable unordered line segment group based on Boolean operation |
Publications (1)
Publication Number | Publication Date |
---|---|
CN114399598A true CN114399598A (en) | 2022-04-26 |
Family
ID=81230672
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202210049789.4A Pending CN114399598A (en) | 2022-01-17 | 2022-01-17 | Method for solving contour of closable unordered line segment group based on Boolean operation |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN114399598A (en) |
-
2022
- 2022-01-17 CN CN202210049789.4A patent/CN114399598A/en active Pending
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US9171400B2 (en) | Creating a surface from a plurality of 3D curves | |
KR102580012B1 (en) | System and method for generating multi-material mesh from FILL-FRACTION VOXEL DATA | |
US10974446B2 (en) | B-rep of the result of a two-axis 3D printing process | |
EP1710720B1 (en) | Method of computer-aided design of a modeled object having several faces | |
EP3483755A1 (en) | Additive manufacturing of a 3d part | |
US10796497B2 (en) | Distance field coupled fitted deformation lattices for shape modification | |
JP2013507679A (en) | Method and system capable of 3D printing of 3D object model | |
KR101323082B1 (en) | Applying effects to a merged text path | |
AU769960B2 (en) | Mesh generator for and method of generating meshes in an extrusion process | |
US20220156430A1 (en) | Topological message passing for three dimensional models in boundary representation format | |
JP3988925B2 (en) | Numerical analysis system using mixed grid type solution adaptive grid method | |
CN110001066B (en) | Method for determining filling direction of minimum partition in three-dimensional printing | |
US7388584B2 (en) | Method and program for determining insides and outsides of boundaries | |
CN114399598A (en) | Method for solving contour of closable unordered line segment group based on Boolean operation | |
US20170017741A1 (en) | Computational modelling for engineering analysis | |
JP2022072158A (en) | Information processing method and information processing device | |
TWI837115B (en) | Non-transitory medium, system and method for multi-material mesh generation from fill- fraction voxel data | |
Dannenhoffer et al. | Automated creation of 3-D overset grids directly from solid models | |
CN116910834B (en) | CAD model construction method based on NURBS curved surface rapid intersection algorithm | |
JP7345821B2 (en) | Machining simulation system and machining simulation program | |
Rorris et al. | The ANSA/LS-DYNA approach for IGA Simulations | |
JP7338322B2 (en) | Three-dimensional shape data editing device and three-dimensional shape data editing program | |
JP2005056288A (en) | Numerical analysis device using mixed lattice type solution-adaptive lattice approach | |
JP4067083B2 (en) | Three-dimensional shape processing apparatus, draft generation method, program, and storage medium | |
CN117708904A (en) | Mixed unit grid generation method oriented to semiconductor numerical simulation |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination |