Method and device for performing Boolean operation on entity formed by any quadric surface and storage medium
Through the B-rep representation framework and high-precision algorithm based on implicit quadratic surface intersecting, the accuracy and efficiency of Boolean operations between complex quadratic surfaces in CAD are solved, and the stable processing and accurate results of complex intersecting situations are achieved. generate.
Patent Information
- Application Number
- CN202411234309.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-04
- Publication Date
- 2024-12-27
AI Technical Summary
In the field of computer-aided design (CAD), it is difficult for the prior art to achieve accurate and efficient Boolean operations between complex quadratic surfaces, especially when dealing with various complex intersection situations, resulting in limited accuracy and efficiency of Boolean operations.
A Boolean operation structure framework based on implicit quadratic surface interception is designed. Through a highly accurate large integer interception algorithm, a rational coefficient implicit quadratic surface interception algorithm is used, combined with parameterized interception lines and topological judgment methods. Processes boolean operations between various quadratic surfaces to generate the final topological edge.
It realizes efficient and robust Boolean operations on any quadratic surface entity, can handle singular situations stably, improves the calculation accuracy and efficiency of Boolean operations, and ensures the accuracy of the results.
Smart Images

Figure CN119203508A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of industrial software, and relates to a method, a device and a storage medium for performing Boolean operations on an entity composed of arbitrary quadratic surfaces, and is mainly used as an underlying algorithm in industrial software in the field of computer-aided design. Background Art
[0002] Boolean operations play a vital role in the field of Computer Aided Design (CAD) and are considered one of the most critical issues in CAD software. It is one of the basic technologies in the manufacturing, modeling and design processes, and is also an essential component in building CAD / CAM systems.
[0003] Boolean operations can be considered as logical operations on the relationship between geometric bodies, which involve determining the logical relationship between different geometric bodies, such as intersection, inclusion, separation, etc. In CAD, the main purpose of Boolean operations is to create, modify and analyze complex geometric shapes by performing operations such as Boolean union, Boolean intersection and Boolean subtraction on geometric bodies.
[0004] Implementing accurate and efficient Boolean operations is a challenging task because it needs to handle various complex situations, such as overlaps, gaps, and repetitions between geometries. The accuracy and efficiency of Boolean operations directly affect the performance and user experience of CAD software.
[0005] The calculation of intersection lines between surfaces is one of the most basic and core key issues of computer-aided design (CAD) industrial software. It is the "root" technology of key modules of industrial software such as Boolean operations, complex structure / surface modeling, manufacturing process simulation and control, and one of the underlying technologies that must be possessed in building CAD / CAM systems. In academia, robust and efficient surface intersection is still an unresolved technical problem; in industry, domestic CAD kernels still lack effective surface intersection solutions and related modules. Boolean operations can be regarded as one of the direct applications of surface intersection, because it involves determining the logical relationship between geometric bodies, such as intersection, inclusion, and separation. In Boolean operations, the purpose of surface intersection is to find the intersection between two or more geometric bodies, or to determine the inclusion relationship between them, so as to perform operations such as union, intersection, or complement. How to achieve accurate and efficient Boolean calculations is a difficult and important problem with great practical industrial value.
[0006] The intersection of two surfaces is very complex, including closed loops, self-intersections, isolated points, point tangency, line tangency and other ambiguous situations. Detecting and describing all these intersection sets and calculating them correctly and with high precision are key indicators for measuring surface intersection algorithms and the basis for subsequent Boolean operations to obtain correct results. Boolean operations are extremely dependent on correct surface intersection results. If the results of surface intersection are inaccurate, the results of Boolean operations will inevitably be wrong. At present, quadratic surface intersection technologies can be generally divided into four categories:
[0007] Analytical methods: These methods attempt to find the intersection points between surfaces using algebraic analysis. They are usually applicable to certain types of surfaces, such as spheres, cylinders, etc. Analytical methods can provide accurate results, but they are only applicable to simple geometries and are difficult to apply to complex surfaces.
[0008] Numerical methods: Numerical methods use numerical calculation techniques to approximate the intersection points between surfaces. These methods are usually based on numerical optimization, iterative solution and other techniques, can handle more complex surfaces, and are more flexible in calculation. Common numerical methods include Newton's method, gradient descent method, etc.
[0009] Method based on parametric surface: This method represents the surface in parametric form and then uses parametric equations to find the intersection. The parametric surface form makes it relatively simple to solve the intersection point because the parametric equations can be directly brought into the solution. This method works well when dealing with parametric surfaces, but may require additional conversion steps for non-parametric surfaces.
[0010] Sampling and interpolation based methods: This method samples the surface and then interpolates the sampled points to approximate the intersection between the surfaces. This method is usually used to process non-parametric surfaces, and the accuracy and computational efficiency can be controlled by appropriate sampling density.
[0011] Different from the traditional analytical method that can only process specific types of surfaces, the present invention provides an analytical method that is applicable to all types of quadratic surfaces, including not only common spheres (Sphere), planes (Plane), cylinders (Cylinder), cones (Cone), but also uncommon surfaces such as elliptic cylinders (Elliptic Cylinder), hyperbolic cylinders (Hyperbolic Cylinder), parabolic cylinders (Parabolic Cylinder), ellipsoids (Ellipsoid), hyperboloids of one sheet (Hyperboloid of Two Sheets), elliptic paraboloids (Elliptic Paraboloid), and hyperbolic paraboloids (Hyperbolic Paraboloid). Summary of the invention
[0012] In view of the shortcomings of the prior art, the present invention provides a method, device and storage medium for performing Boolean operations on entities composed of arbitrary quadratic surfaces, wherein a B-rep expression Boolean operation structure framework based on implicit quadratic surface intersection is designed, which is intended to be suitable for performing Boolean operations on different types of quadratic surface entities and to balance the calculation accuracy, efficiency and robustness of the algorithm.
[0013] Specifically, the contributions of the present invention can be summarized as follows:
[0014] 1) Overall framework design: A Boolean operation structure framework for representing entities using a B-rep composed of quadratic surfaces is provided to effectively handle Boolean operation tasks of various quadratic surfaces and to efficiently and robustly handle various situations.
[0015] 2) Intersection line generation and processing: An implicit quadratic surface intersection algorithm based on rational coefficients represented by high-precision large integers is implemented. The core idea is to find a ruled quadratic surface from the surface bundle for intersection. This intersection algorithm is applicable to all quadratic surfaces and is extremely efficient. It can stably handle various singular cases (isolated intersection points).
[0016] 3) Generation and processing of intersection points: Based on the parametric intersection line obtained by intersecting the quadratic surface, an algorithm for finding the intersection point between the parametric intersection line and the quadratic surface is proposed. The intersection is judged according to the resultant, and all types of parametric intersection lines, including smooth quartic intersection lines, can be processed.
[0017] 4) Topology judgment: A predicate-based topology judgment method is used. For all the intersection points found, the predicate can be used to determine whether the intersection point should be retained. If retained, the direction of the half edge with the intersection point as the endpoint is determined to provide basic information for subsequent topology edge generation.
[0018] 5) Topological edge generation: For all retained topological vertices, the original intersecting curves are divided into segments of parameter intervals. The present invention proposes a method combining a CSG (Constructive Solid Geometry) tree to generate the final topological edges.
[0019] 6) Handling of some special cases: For some special cases where it is impossible to use predicates to determine the direction of half-edges (such as multiple branches, intersecting rings or rings composed of multiple segments), a correct handling method based on the tangent direction of the intersection line and the normal direction of the surface where the intersection line is located is provided.
[0020] Based on the above contributions 1) to 6), the present invention provides a set of design solutions that can be used for Boolean operations on quadratic surfaces.
[0021] The technical solution adopted by the present invention is as follows:
[0022] A method for performing Boolean operations on a solid body composed of arbitrary quadratic surfaces, comprising:
[0023] First, for all input entities, according to their B-rep data structure, the data structure required by the subsequent algorithm is established, such as converting all surface surfaces related to faces into implicit representations, CSG trees, etc.
[0024] All quadratic surfaces are intersected in pairs. When finding the intersection of quadratic surfaces, first construct a surface bundle between two quadratic surfaces, and then find a new quadratic surface from it. This new quadratic surface is a ruled surface. Parameterize the ruled surface and bring it into the original quadratic surface to get the parameterized intersection line.
[0025] Furthermore, after obtaining all the intersection lines, it is necessary to find all the intersection points. When three quadratic surfaces intersect, we can first find the intersection line of two of the quadratic surfaces, and then intersect the intersection line with the third quadratic surface to get the final intersection point.
[0026] After finding all the intersections and points, we need to determine which intersections and points contribute to the entity after the Boolean operation. The contributing intersections and points are retained as the data of the final entity, and the non-contributing intersections and points are directly discarded.
[0027] After the above stages, it is possible to determine which section of the intersection line contributes to the final entity. The coEdge topological edges that form the final loop have also been added to all Face surfaces. Traverse each Face surface to form the final one or more loops. Start from a coEdge topological edge, find the starting point and end point, and then add the next coEdge topological edge until you return to the original coEdge topological edge.
[0028] When the above process is completed, a complete B-rep structure will be obtained, representing the entity after the Boolean operation.
[0029] A system for performing Boolean operations on a solid composed of arbitrary quadratic surfaces, used to implement any of the methods described above.
[0030] An electronic device, comprising:
[0031] one or more processors;
[0032] A memory for storing one or more programs;
[0033] When the one or more programs are executed by the one or more processors, the one or more processors implement any of the methods described above.
[0034] A computer-readable storage medium stores computer-executable instructions, wherein the instructions are used to implement any of the methods described above when executed.
[0035] The beneficial effects of the present invention are:
[0036] 1. A framework is proposed to solve the Boolean operation problem by solving the intersection points of quadratic surfaces and performing some predicate operations.
[0037] 2. When solving the intersection point, imaginary roots may be encountered. In order to solve this problem, the present invention proposes multiple methods.
[0038] 3. For complete or incomplete annular intersections, the present invention solves the orientation problem. BRIEF DESCRIPTION OF THE DRAWINGS
[0039] Figure 1 It is a schematic diagram of the overall process framework of the method of the present invention;
[0040] Figure 2-Figure 3 To use the method of the present invention to obtain the Boolean union of all intersection points of the four balls;
[0041] Figure 4-Figure 5 The intersection points of the intersection lines that are Boolean for the four balls in the method of the present invention and contribute to the final solid;
[0042] Figure 6-Figure 7To use the method of the present invention to find the intersection points of the Boolean intersection of four balls;
[0043] Figure 8-Figure 9 Find the intersection points of the four balls in the method of the present invention that contribute to the final entity through the Boolean intersection;
[0044] Figure 10-13 It is the result of various Boolean operations. Specific implementation plan
[0045] The technical solution of the present invention is further described in detail below in conjunction with the accompanying drawings and specific embodiments.
[0046] According to a specific embodiment of the present invention, the method of the present invention for performing Boolean operations on a solid composed of arbitrary quadratic surfaces has the following process: Figure 1 As shown, including the following
[0047] 1. Input preprocessing
[0048] First, for all input entities, according to their B-rep data structure, we need to establish the data structure required by the subsequent algorithm. For example, convert all face-related surfaces into implicit representations or CSG trees. Primitives in general geometric modeling engines are modeled by parameters. For example, a cylinder can be modeled by its LCS (Local Coordinate System), height, and radius, while a sphere can be modeled by its LCS, center, and radius. The following are several common examples.
[0049] a) Processing the cylinder primitive: Usually the LCS of the cylinder is defined at the center of the bottom circle. Assume that the origin of this LCS is located at O = (x0, y0, z0), and the Z axis of the LCS is oriented to Z dir =(a,b,c), so the axis of the cylinder can be expressed as
[0050] l=O+t*Z dir (1)
[0051] The equation of a cylinder can be expressed as the distance from a point to the axis is equal to the radius. The distance formula from a point (x, y, z) on the cylinder to the axis is:
[0052]
[0053] Since (a,b,c) is a unit vector, Therefore, the distance formula simplifies to:
[0054]
[0055] And this distance is equal to the radius r of the cylinder, so:
[0056] (x-x0) 2 +(y-y0) 2 +(z-z0) 2 -((x-x0)a+(y-y0)b+(z-z0)c) 2 =r 2 (4)
[0057] Let (x-x0)=X, (y-y0)=Y, (z-z0)=Z, then the above formula becomes:
[0058] X 2 +Y 2 +Z 2 -(Xa+Yb+Zc) 2 =r 2
[0059] X 2 +Y 2 +Z 2 -(X 2 a 2 +Y 2 b 2 +Z 2 c 2 +2XYab+2XZac+2YZbc)=r 2
[0060] X 2 (1-a 2 )+Y 2 (1-b 2 )+Z 2 (1-c 2 )-2XYab-2XZac-2YZbc=r 2 (5)
[0061] Substituting X, Y, and Z back into the above equation and expanding it, we have:
[0062] (x-x0) 2 (1-a 2 )+(y-y0) 2 (1-b 2 )+(z-z0) 2 (1-c 2 )-2(x-x0)(y-y0)ab-2(x-x0)(z-z0)ac-2(y-y0)(z-z0)bc=r 2
[0063]
[0064] Separate each term and arrange the coefficients, and write them in the corresponding positions of the quadratic matrix to obtain the final quadratic matrix Q:
[0065]
[0066] in:
[0067]
[0068] e=-x0(1-a 2 )+aby0+acz0,f=-y0(1-b 2 )+abx0+bcz0,g=-z0(1-c 2 )+acx0+bcy0.
[0069] b) Processing the cone primitive: Usually the LCS of a cone is defined on the cone. Assume that the origin of this LCS is located at O = (x0, y0, z0), and the Z axis of the LCS is oriented to Z dir =(a, b, c), so the axis of the cone can be expressed similarly to the axis of the cylinder in (1). The distance from any point (x, y, z) on the surface of the cone to the vertex of the cone and the distance of the projection of the point on the axis of the cone satisfy a certain relationship. Specifically, the distance formula from the point (x, y, z) to the vertex is: The projection distance of the point in the axial direction is: ((x-x0)a+(y-y0)b+(z-z0)c). According to the geometric relationship, a point on the cone satisfies:
[0070]
[0071] Where θ = arctan (r / h) is the semi-apex angle of the cone, which is determined by the height h and the base radius r of the cone. Further processing of equation (7) yields:
[0072]
[0073] ((x-x0)a+(y-y0)b+(z-z0)c) 2 =((x-x0) 2 +(y-y0) 2 +(z-z0) 2 )cos 2 θ(x-x0) 2 (cos 2 θ-a 2 )+(y-y0) 2 (cos 2 θ-b 2 )+(z-z0) 2 (cos 2 θ-c2 )-2(x-x0)(y-y0)ab-2(x-x0)(z-z0)ac-2(y-y0)(z-z0)bc=0 (8)
[0074] According to the formula obtained above, its coefficients are extracted to assemble the final quadratic matrix.
[0075]
[0076] in:
[0077] e=-x0(cos 2 θ-a 2 )+aby0+acz0,f=-y0(cos 2 θ-b 2 )+abx0+bcz0,g=-z0(cos 2 θ-c 2 )+acx0+bcy0.
[0078] c) Processing the sphere primitive: Usually the LCS of a sphere is defined at the center of the sphere. Assuming the origin of the LCS is at O = (x0, y0, z0), and the radius of the sphere is r, the equation of the sphere can be written as
[0079] (x-x0) 2 +(y-y0) 2 +(z-z0) 2 =r 2 (9)
[0080] Expanding and rearranging the equation yields:
[0081]
[0082] According to the formula obtained above, its coefficients are extracted to assemble the final quadratic matrix.
[0083]
[0084] d) Processing the cube primitive: Usually the LCS of a cube is defined at the lower left vertex of the cube. Assume that the LCS is defined as {O; u1, u2, u3}, where I = (x0, y0, z0), And there are also the lengths of the cube's axes (a, b, c), which correspond to the lengths in the (x, y, z) directions of the local coordinate system. The equations for each face in the local coordinate system are: Face 1 (front): x LCS =0, side 2 (back): x LCS=a, side 3 (left side): y LCS =0, Face 4 (right face): y LCS = b, surface 5 (bottom): z LCS =0, surface 6 (top surface): z LCS =c.
[0085] The normal vector of face 1 (front face) is u1. In the world coordinate system, the plane equation is u1·(X-V0)=0, where Convert to standard form to get u 1x X+u 1y Y+u 1z Z-(u 1x x0+u 1y y0+u 1z z0)=0. So the final quadratic matrix is:
[0086]
[0087] The normal vector of face 2 (back side) is -u1. In the world coordinate system, the plane equation is u1·(X-V0)=0, where Convert to standard form to get u 1x X+u 1y Y+u 1z Z-(u 1x (x0+au 1x )+u 1y (y0+au 1y )+u 1z (z0+au 1z ))=0. After simplification, it is
[0088] So the final quadratic matrix is:
[0089]
[0090] Similarly, the quadratic matrix of face 3 (left face) is:
[0091]
[0092] The quadratic matrix of face 4 (right face) is:
[0093]
[0094] The quadratic matrix of surface 5 (bottom) is:
[0095]
[0096] The quadratic matrix of surface 6 (top surface) is:
[0097]
[0098] 2. Algorithm for finding the intersection line of two quadratic surfaces, generation and processing of intersection lines:
[0099] In this step, the main task is to generate the intersection of two quadratic surfaces and process the intersection. Assume that the quadratic matrices corresponding to the two quadratic surfaces are denoted as Q s ,Q T ,in We want to get the parameterized intersection line C between them ST (u), You can directly s and Q T By parameterizing one of the surfaces and bringing the result of the parameterization to the other surface, the final parametric curve representation can be obtained. Generally speaking, the parameterized curve obtained in this way is not the optimal parameterized representation, that is, the coefficients and degrees may be very different from the optimal parameterization, and it is not possible to detect singular situations well, because the general quadratic surface is nonlinear in two parameters. In geometry, if there is at least one straight line passing through any point on a surface, the surface is called a ruled surface. Ruled surfaces have very good properties. When the ruled surface is parameterized, it is linear in at least one of the parameters. Some quadratic surfaces are ruled surfaces, such as planes, hyperbolic paraboloids, parabolic cylinders, etc. If Q s or Q T If one of them is a ruled surface, then the ruled surface parameterization is substituted into the other surface, and then the final result can be obtained. s and Q T None of them are ruled surfaces. We know that any two surfaces in the surface bundle intersect on the same intersection line, so we can use Q s and Q T Find a suitable ruled surface Q in the generated surface bundle equation R , assuming Q R ≠Q S , (otherwise let Q s =Q T ), then C ST (u) = Q s ∩Q T =Q R ∩Q T In summary, the following is the process of finding the intersection line of two quadratic surfaces. We know that any two surfaces in a surface bundle intersect on the same intersection line, so we can use Q s and Q T Generate a surface bundle equation:
[0100] R(λ,μ)=λQ s +μQ T (11)
[0101] Furthermore, by setting α = λ / μ, the surface beam equation can be transformed from a two-variable equation to a single-variable equation:
[0102] R(α)=αQ s +Q T (12)
[0103] How to find a suitable surface from the surface bundle needs to be determined based on the determinant of the surface bundle. Definition:
[0104] D(α)=|R(α)| (13)
[0105] a) If D(α)≡0, then let Q R =Q S , at this time the inertia of the quadratic surface is not (2, 2).
[0106] b) Otherwise, calculate the real root interval of D(α). Take a rational number α0 in each interval, and assume that D(α0)>0, then calculate the inertia of the corresponding quadratic surface. If one of the inertias is (4, 0), terminate the algorithm directly and output Q s and Q T If one of the inertias is (2, 2), then Q s and Q T The intersection line is a quartic curve, which will be specially processed later.
[0107] c) If it does not belong to the above two situations (i.e. and for every α, D(α)≤0): Compute the greatest common divisor gcd(α) of D(α) and the derivative D′(α) of D(α). If gcd(α) has a rational root α0, let Q R =R(α0).
[0108] d) If it does not belong to the above three cases (that is, D(α) has two non-rational double real roots): then Q s ∩Q T are two intersection points. The inertia of the quadratic surface corresponding to one of the two roots is (2, 0), which is a pair of imaginary planes, but the singular line of this pair of imaginary planes is real, and it can be easily parameterized even if it is not rational. By intersecting this singular line with any input quadratic surface, we can get two intersection points.
[0109] By analyzing D(α), some of the intersection cases have already been concluded that (Q s and Q TDisjoint or Q s and Q T Intersect at two points), there are two remaining cases to be handled separately:
[0110] a) When Q R When the inertia is not (2, 2): If Q R It is not in standard form, so first find a corresponding transformation matrix and transform Q R Transform into standard form and then apply the ruled surface Q R By parameterizing, we can get a parameterized surface X R .
[0111] b) When Q R When the inertia is (2, 2): At this time, the ruled surface is a hyperbolic paraboloid or a single-leaf hyperboloid, and the standard equation is: ax 2 +by 2 -cz 2 -dw 2 = 0. There is a theoretical guarantee that R In the neighborhood of , there exists a quadratic surface Q with rational coefficients R′ , so that Q R′ ∩Q T =Q R ∩Q T =Q s ∩Q T . And Q R′ The parameterization coefficients are First, Q R Perform Gaussian elimination, if or Any one of the R If the parameterization of is rational, then parameterize directly. Otherwise, compute Q by taking arbitrary values of the parameters (e.g., (u,v) = (0,1) and (s,t) = (0,1)). R Any point on Then we approximate point p as being not in Q s ∩Q T Point on Then calculate So that p′ belongs to the quadratic surface in the surface bundle When p′ is close enough to p, α′0 and α0 are also close enough, so that R′=R(α′0) is also close enough to R, and therefore has the same inertia (2, 2). R′ A rational line tangent to the plane, which further intersects Q at another rational point p″ R′ Intersect. Compute the rational transformation P that maps p′, p″ to (1,±1,0,0). Apply this transformation to R′, and then apply Gaussian elimination to R′. In the local coordinate system, QR′ The equation (multiplied by a constant factor) is
[0112] x 2 -y 2 +αz 2 +βw 2 =0 (14)
[0113] Where αβ<0. Now consider the linear transformation, whose matrix is
[0114]
[0115] Applying P′ to the simplified quadratic surface equation (15) yields the equation
[0116] x 2 +y 2 -z 2 -δw 2 =0 (15)
[0117] Where δ=-αβ>0. The quadratic surface represented by the equation can be parameterized as
[0118]
[0119] in Then substitute the result of the surface parameterization onto another surface to get the parametric equation of the intersection line.
[0120] 3. The intersection algorithm of three quadratic surfaces, the generation and processing of intersection points:
[0121] Furthermore, after obtaining all the intersection lines, we need to find all the intersection points. Suppose there is a third quadratic surface, denoted by Q U , and the previous two quadratic surfaces Q s ,Q T Intersect. S ∩Q T ∩Q U =(Q S ∩Q T )∩Q U =C ST ∩Q U , then the problem can be transformed into solving the parametric curve CST and the quadratic surface Q U Find the intersection. This algorithm has two different cases:
[0122] a) For the parameterized curve C ST In the case of a non-smooth quartic curve, the parameterized curve C ST Substitute the quadratic surface Q U In, order If h(ξ)≡0, then the parameterized curve C ST There are three quadratic surfaces Q s , Q T , Q U Otherwise, solve h(ξ) and obtain the roots ξ1,...,ξ n Substitute the parameterized curve C ST In the figure, there are three quadratic surfaces Q s , Q T , Q U The intersection of .
[0123] b) For the parameterized curve C ST In the case of a smooth quartic curve, first let X R (ξ,τ) is the ruled surface Q R Parameterization of Q R =λQ s +μQ T . Q R Substitute (ξ,τ) into Q s (Assume Q R ≠Q S , otherwise let Q s =Q T ) and Q U have to Order 01 (ξ)=a0(ξ)b1(ξ)-a1(ξ)b0(ξ),s 02 (ξ)=a0(ξ)b2(ξ)-a2(ξ)b0(ξ),s 12 (ξ)=a1(ξ)b2(ξ)-a2(ξ)b1(ξ). Finally, the resultant of f and g is defined as:
[0124] res(ξ)=s 02 (ξ)s 02 (ξ)-s 01 (ξ)s 12 (ξ) (17)
[0125] The resultant is a polynomial related to the coefficients of these polynomials. Its definition is based on the determinant of the Sylvester matrix of these polynomials. The Sylvester matrix is a matrix composed of the coefficients of two polynomials. By calculating its determinant, we can get the resultant. Suppose there are two polynomials P(x) = a0 + a1x + a2x 2 +…+a m x m and Q(x)=b0+b1x+b2x 2 +…+bn x n The Sylvester matrix is a ((m+n)×(m+n)) matrix. The first m rows of the matrix consist of the coefficients of P(x), which are arranged in descending order; the last n rows consist of the coefficients of Q(x), which are arranged in descending order.
[0126]
[0127] If res(ξ)≡0, then the parameterized curve C ST There are three quadratic surfaces Q s , Q T , Q U Otherwise, res(ξ) is first decomposed without squares, and then each factor is rooted. Substituting the root into the corresponding parameter equation will obtain the final intersection coordinates.
[0128] 4. Predicate-based topology judgment method, and finally generate topological edges:
[0129] After finding all the intersections and points, we need to determine which intersections and points contribute to the entity after the Boolean operation. Since the intersection and point algorithms for quadratic surfaces are based on implicit quadratic surfaces, it is natural to simultaneously build a CSG tree to determine whether the intersections and points contribute to the final entity, and define some new functions for the subsequent orientation of the Loop structure in the B-rep structure. Use a Boolean value function f to represent a Boolean entity operation on n Boolean inputs, f:{0,1} n →{0,1}; is the indicator function of the entity, whose value reflects the point Whether it is on the i-th entity or inside the entity. The indicator vector of a point x is defined as a tuple of its n indicator functions: And it means that the Boolean operation occurs on its indicator vector, that is
[0130] For each intersection point:
[0131] a) If the point is already in the entity, such as the vertex of a cone or a cube, the CSG tree is used to determine whether the intersection is inside or outside the final entity. If it is inside or outside, the intersection does not contribute to the final entity. Otherwise, the final entity must contain the intersection. Then, the second test is performed. Assume that point x is located on the i-th entity. Let
[0132]
[0133] That is, the indicator vector flips between 0 and 1 at the i-th position. If the intersection contributes to the final entity, then b0≠b1 must be true. In the two cases of b0=0, b1=1 and b0=1, b1=0, the coEdge that passes through the intersection has different directions, and each coEdge eventually forms a loop, where when b0=0, b1=1, the topological edge and the parametric curve have the same direction when the parameter value increases; when b0=1, b1=0, the topological edge and the parametric curve have opposite directions when the parameter value increases.
[0134] b) If the intersection point is obtained by intersecting two entities, such as the point where an edge of one entity intersects with the face of another entity. Assume that point x is located on the i-th and j-th entities, let
[0135]
[0136] That is, the indicator vector flips between 0 and 1 at the i-th and j-th positions. If the intersection contributes to the final entity, then there must be ((b 00 ,b 01 )≠(b 10 ,b 11 )∧(b 00 ,b 10 )≠(b 01 ,b 11 )), at the same time, according to b 00 , b 01 , b 10 , b 11 The coEdge passing through the intersection has different directions due to different values, and each coEdge eventually forms a loop. One criterion for determining the direction of the coEdge is as follows: 00 =0,b 01 = 0, which means that the indicator vector of the i-th entity is always 0, then the topological edge on the i-th entity and the parametric curve have the same direction when the parameter value increases; when b 00 =1,b 01 =1, the topological edge on the i-th entity is in the opposite direction to the parametric curve when the parameter value increases.
[0137] c) If the intersection point is obtained by intersecting three entities, such as the point obtained by intersecting the faces of three entities. Assume that point x is located on the i-th, j-th, and k-th entities.
[0138]
[0139] That is, the indicator vector flips between 0 and 1 at the i-th, j-th, and k-th positions. If the intersection contributes to the final entity, then there must be: ((b 000,b 001 ,b 010 ,b 011 )≠(b 100 ,b 101 ,b 110 ,b 111 )∧(b 000 ,b 001 ,b 100 ,b 101 )≠(b 010 ,b 011 ,b 110 ,b 111 )∧(b 000 ,b 010 ,b 100 ,b 110 )≠(b 001 ,b 011 ,b 101 ,b 111 )), according to b 000 , b 001 , ..., b 111 Different values result in different directions of the coEdge passing through the intersection, and each coEdge eventually forms a loop. One criterion for determining the direction of the coEdge is as follows: 000 =0,b 001 =0,b 010 =0,b 011 = 0, which means that the indicator vector of the i-th entity is always 0, then the topological edge on the i-th entity and the parametric curve have the same direction when the parameter value increases; when b 000 =1,b 001 =1,b 010 =1,b 011 =1, the topological edge on the i-th entity is in the opposite direction to the parametric curve when the parameter value increases.
[0140] For each intersection line:
[0141] a) If a complete intersection line contributes to the final entity, then this intersection line is a complete ring. For such a complete intersection line, since there is no indicator vector information for the intersection point mentioned above, another method is used to determine the direction of the coEdge. First, take a point on the intersection line. Since an edge must be composed of the intersection of two surfaces, take the normal vectors of the two surfaces at this point, and make a mixed product with the tangent vector of the curve at this point. The direction of the coEdge is determined according to the result of the mixed product. Specifically: if the mixed product is greater than 0, the topological edge and the parametric curve have the same direction when the parameter value increases. If the mixed product is less than 0, the topological edge and the parametric curve have opposite directions when the parameter value increases. If a tangent situation is encountered, such as two cylinders and spheres with the same radius are tangent to a complete arc, special processing will be performed. In this case, a complete topological edge edge, that is, two topological half edges coEdge with opposite directions, can be added to divide the cylinder and the sphere into two parts, that is, divide the complete arc into two parts, and each part is processed according to the above method.
[0142] b) If it is not a complete intersection line, then the endpoints of the intersection line must have been found in the previous stage of finding the intersection point. Assume that the parameter values of the two end points on the intersection line are ξ0 and ξ1 respectively, and take the parameter ξ=(ξ0+ξ1) / 2 to determine whether the point is on the boundary of the final entity. If so, then the intersection line is on the boundary of the entity.
[0143] After the above stages, we have completed the determination of which section of the intersection line contributes to the final entity. We have also added the coEdge that constitutes the final loop to all faces. We traverse each face to form one or more final loops. Starting from a coEdge, find the starting point and end point, and then add the next coEdge until we return to the original coEdge.
[0144] When the above process is completed, a complete B-rep structure will be obtained, representing the entity after the Boolean operation.
[0145] Figure 2 This shows four spheres with the same radius but different centers, rendered in libigl after a Boolean union operation. Figure 3 Indicated in Figure 2 In this case, all the intersection points of the intersection lines are found. Figure 4 yes Figure 2 The desired intersection point of the intersection line retains the part that finally contributes to the entity. Figure 5 yes Figure 3 The intersection point of the intersection lines sought in the above method retains the part that finally contributes to the entity.
[0146] Figure 6This shows four spheres with the same radius but different centers, rendered in libigl after a Boolean intersection operation. Figure 7 Indicated in Figure 6 In this case, all the intersection points of the intersection lines are found. Figure 8 yes Figure 6 The desired intersection point of the intersection line retains the part that finally contributes to the entity. Fig. 9 yes Figure 7 The intersection point of the intersection lines sought in the above method retains the part that finally contributes to the entity.
[0147] Fig.10 Represents two spheres with the same radius but different centers, after a Boolean union operation and rendering in a Poisson geometry engine.
[0148] Fig.11 Represents a sphere with a large radius and a cylinder with a small radius, after a Boolean subtraction operation and rendered in a Poisson geometry engine.
[0149] Fig.12 Representation of a cube and a sphere, after a Boolean subtraction operation and rendered in a Poisson geometry engine.
[0150] Fig.13 Representation of a cube and a cylinder, after a Boolean subtraction operation and rendered in a Poisson geometry engine.
[0151] According to a specific embodiment of the present invention, there is also provided a system for performing Boolean operations on a solid composed of arbitrary quadratic surfaces, for implementing the steps of any of the aforementioned methods.
[0152] According to a specific embodiment of the present invention, there is also provided an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of any of the aforementioned methods when executing the program.
[0153] According to a specific embodiment of the present invention, there is further provided a computer-readable storage medium on which a computer program is stored, and when the program is executed by a processor, the steps of any of the above methods are implemented.
[0154] The foregoing description of specific exemplary embodiments of the present invention is for the purpose of illustration and demonstration. These descriptions are not intended to limit the present invention to the precise form disclosed, and the general principles defined herein can be implemented in other embodiments without departing from the spirit or scope of the present invention. Obviously, the present invention is not limited to the above-mentioned specific embodiments, and those skilled in the art can make various changes or modifications within the scope of the claims, which do not affect the essence of the present invention. The purpose of selecting and describing exemplary embodiments is to explain the specific principles of the present invention and its practical application, so that those skilled in the art can realize and utilize various different exemplary embodiments of the present invention and various different options and changes. The scope of the present invention is intended to be limited by the claims and their equivalents.
Claims
1. A method for performing Boolean operations on a solid consisting of arbitrary quadratic surfaces, characterized in that: These include: First, for all input entities, all face-related surfaces are converted into implicit representations or CSG trees according to their B-rep data structures; Intersect all quadratic surfaces in pairs. When finding the intersection of quadratic surfaces, first construct a surface bundle between two quadratic surfaces, and find a new quadratic surface from them. This new quadratic surface is a ruled surface. Parameterize the ruled surface and bring it into the original quadratic surface to obtain the parameterized intersection line. After obtaining all the intersection lines, we need to find all the intersection points. For the intersection of three quadratic surfaces, we first find the intersection line of two of the quadratic surfaces, and then intersect the intersection line with the third quadratic surface to get the final intersection point. After finding all the intersections and points, it is necessary to determine which intersections and points contribute to the entity after the Boolean operation. The contributing intersections and points are retained as the data of the final entity, and the non-contributing intersections and points are directly discarded. After the above stages, the range of intersection lines that contribute to the final entity is obtained, and the coEdge topological edges that constitute the final Loop ring are added to all faces. Each face is traversed to form the final one or more Loop rings. Starting from a coEdge topological edge, the starting point and end point are found, and then the next coEdge topological edge is added until it returns to the original coEdge topological edge. When the above process is completed, a complete B-rep structure is obtained, which represents the entity after the Boolean operation.
2. The method for performing Boolean operations on a solid body composed of arbitrary quadratic surfaces according to claim 1, characterized in that: The method for finding the intersection line of two quadratic surfaces includes the following: For the quadratic matrix Q corresponding to the two quadratic surfaces s and Q T , generating a surface bundle equation: R(α)=αQ s +Q T definition: D(α)=|R(α)| a) If D(α)≡0, then let Q R =Q S , at this time the quadratic surface inertia is not (2, 2); b) Otherwise, calculate the real root interval of D(α); take a rational number α0 in each interval, assuming D(α0)>0, then calculate the inertia of the corresponding quadratic surface. If one of the inertias is (4, 0), then its parameterized intersection line Q s and Q T do not intersect; if one of the inertias is (2, 2), then Q s and Q T The intersection of is a quartic curve, which needs special treatment; c) If it does not belong to the above two cases a) and b), calculate the greatest common divisor of D(α) gcd(α) and the derivative D′(α) of D(α). If gcd(α) has a rational root α0, let Q R =R(α0); d) If it does not belong to the above three cases a), b), c), then Q s ∩Q T There are two intersection points. The inertia of the quadratic surface corresponding to one of the two roots is (2, 0). This is a pair of imaginary planes. The singular lines of this pair of imaginary planes are intersected with any input quadratic surface to obtain two intersection points.
3. The method for performing Boolean operations on a solid body composed of arbitrary quadratic surfaces according to claim 2, characterized in that: By analyzing D(α), the following two situations are processed respectively: a) When Q R When the inertia is not (2, 2): If Q R It is not a standard form. First, Q R Transform into standard form and then apply the ruled surface Q R Parameterize and get a parameterized surface X R ; b) When Q R When the inertia is (2, 2): At this time, the ruled surface is a hyperbolic paraboloid or a single-leaf hyperboloid, and the standard equation is: ax 2 +by 2 -cz 2 -dw 2 =0; first, Q R Perform Gaussian elimination, if or Any one of the R If the parameterization of is rational, then parameterize directly; otherwise, calculate Q by taking arbitrary values of the parameters R Any point on Then we approximate point p as being not in Q s ∩Q T Point on Then calculate So that p′ belongs to the quadratic surface in the surface bundle When p′ is close enough to p, α′0 and α0 are also close enough, so that R′=R(α′0) is also close enough to R, and therefore has the same inertia (2, 2); by considering any p′ not in Q R′ A rational line tangent to the plane, which further intersects Q at another rational point p″ R′ Intersect, calculate the rational transformation P to map p′, p″ to (1,±1,0,0), apply this transformation to R′, and then apply Gaussian elimination to R′; in the local coordinate system, Q R′ The equation is x 2 -y 2 +αz 2 +βw 2 =0 Where αβ<0, considering linear transformation, its matrix is Applying P′ to the simplified quadratic surface equation yields x 2 +y 2 -z 2 -δw 2 =0 Where δ=-αβ>0, the quadratic surface represented by the equation is parameterized as in Then substitute the result of the surface parameterization onto another surface to obtain the parametric equation of the intersection line.
4. The method for performing Boolean operations on a solid body composed of arbitrary quadratic surfaces according to claim 1, characterized in that: After getting all the intersection lines, we need to find all the intersection points. Assume there is a third quadratic surface, denoted as Q U , and the previous two quadratic surfaces Q s ,Q T Intersect, transform the problem into solving the parameterized curve C ST With the quadratic surface Q U Request for intersection, including: a) For the parameterized curve C ST Not a smooth quartic curve: parameterize the curve C ST Substitute the quadratic surface Q U In, order If h(ξ)≡0, then the parameterized curve C ST There are three quadratic surfaces Q s , Q T , Q U Otherwise, solve h(ξ) and get the roots ξ1,...,ξ n Substitute the parameterized curve C ST In the figure, there are three quadratic surfaces Q s , Q T , Q U The intersection of b) For the parameterized curve C ST For the case of a smooth quartic curve: First, let X R (ξ,τ) is the ruled surface Q R Parameterization of ,Q R =λQ s +μQ T ; X R Substitute (ξ,τ) into Q s and Q U ,have to: Order 01 (ξ)=a0(ξ)b1(ξ)-a1(ξ)b0(ξ),s 02 (ξ)=a0(ξ)b2(ξ)-a2(ξ)b0(ξ),s 12 (ξ)=a1(ξ)b2(ξ)-a2(ξ)b1(ξ), and finally define the equivalent of the resultant about f and g as: res(ξ)=s 02 (ξ)s 02 (ξ)-s 01 (ξ)s 12 (x) If res(ξ)≡0, then the parameterized curve C ST There are three quadratic surfaces Q s , Q T , Q U Otherwise, res(ξ) is first decomposed without squares, and then each factor is rooted. Substituting the root into the corresponding parameter equation will get the final intersection coordinates.
5. The method for performing Boolean operations on a solid body composed of arbitrary quadratic surfaces according to claim 1, characterized in that: After finding all the intersections and points, we need to determine which intersections and points contribute to the entity after the Boolean operation. We build a CSG tree to determine whether the intersections and points contribute to the final entity, and define functions for the subsequent orientation of the Loop structure in the B-rep structure, including: using a Boolean value function f to represent a Boolean entity operation on n Boolean inputs, f: {0,1} n →{0,1}, remember is the indicator function of the entity, whose value reflects the point Whether it is on or inside the ith entity, the indicator vector of the point x is defined as a tuple of its n indicator functions: And it means that the Boolean operation occurs on its indicator vector, that is 6. The method for performing Boolean operations on a solid body composed of arbitrary quadratic surfaces according to claim 5, characterized in that: For each intersection point, we have: a) If the entity already exists, determine whether the intersection is inside or outside the final entity based on the CSG tree. If it is outside or inside, the intersection does not contribute to the final entity. Otherwise, the final generated entity must contain the intersection. Assume that point x is located on the i-th entity, let If the intersection contributes to the final entity, then b0≠b1 is certain. When b0=0 and b1=1, the topological edge and the parametric curve have the same direction when the parameter value increases; when b0=1 and b1=0, the topological edge and the parametric curve have opposite directions when the parameter value increases; that is, in the two cases, the topological edges that finally pass through the intersection have different directions, and each topological edge eventually forms a ring; b) If the intersection point is obtained by intersecting two entities, assuming that point x is located on the i-th and j-th entities, let If the intersection contributes to the final entity, then ((b 00 ,b 01 )≠(b 10 ,b 11 )∧(b 00 ,b 10 )≠(b 01 ,b 11 )), at the same time, according to b 00 , b 01 , b 10 , b 11 The topological edges passing through the intersection point have different directions due to different values, and each topological edge eventually forms a ring. 00 =0,b 01 = 0, the topological edge on the i-th entity has the same direction as the parametric curve when the parameter value increases; when b 00 =1,b 01 =1, the topological edge on the i-th entity is in the opposite direction to the parametric curve when the parameter value increases; c) If the intersection point is obtained by intersecting three entities, assuming that point x is located on the i-th, j-th, and k-th entities, let If the intersection contributes to the final entity, then there must be: ((b 000 ,b 001 ,b 010 ,b 011 )≠(b 100 ,b 101 ,b 110 ,b 111 )∧(b 000 ,b 001 ,b 100 ,b 101 )≠(b 010 ,b 011 ,b 110 ,b 111 )∧(b 000 ,b 010 ,b 100 ,b 110 )≠(b 001 ,b 011 ,b 101 ,b 111 )), according to b 000 , b 001 , ..., b 111 The topological edges passing through the intersection point have different directions due to different values, and each topological edge eventually forms a ring. 000 =0,b 001 =0,b 010 =0,b 011 = 0, the topological edge on the i-th entity has the same direction as the parametric curve when the parameter value increases; when b 000 =1,b 001 =1,b 010 =1,b 011 =1, the topological edge on the i-th entity is in the opposite direction to the parametric curve when the parameter value increases.
7. The method for performing Boolean operations on a solid body composed of arbitrary quadratic surfaces according to claim 5, characterized in that: For each intersection line, we have: a) If a complete intersection line contributes to the final entity, then this intersection line is a complete ring. First, take a point on the intersection line. Since an edge is definitely formed by the intersection of two surfaces, take the normal vectors of the two surfaces at this point and make a mixed product with the tangent vector of the curve at this point. The direction of the topological edge is determined according to the result of the mixed product. If the mixed product is greater than 0, the direction of the topological edge and the parametric curve is the same when the parameter value increases. If the mixed product is less than 0, the direction of the topological edge and the parametric curve is opposite when the parameter value increases. b) If it is not a complete intersection line, then the intersection line has two endpoints. In the previous stage of finding the intersection point, the endpoints of the intersection line are found. Suppose the parameter values of the two end points on the intersection line are ξ0 and ξ1 respectively, and the parameter is ξ=(ξ0+ξ1) / 2. Determine whether the point is on the boundary of the final entity. If so, then the intersection line is on the boundary of the entity.
8. A system for performing Boolean operations on entities consisting of arbitrary quadratic surfaces, characterized in that: Used to implement the method according to any one of claims 1 to 7.
9. An electronic device, characterized in that: include: one or more processors; A memory for storing one or more programs; When the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1 to 7.
10. A computer-readable storage medium storing computer-executable instructions, wherein the instructions are used to implement the method according to any one of claims 1 to 7 when executed.
Citation Information
Patent Citations
Curved planar reconstruction method for cardiac scattered-point cloud data
CN102999937A
Automatic construction method for three-dimensional geographic entity based on curved surface slice
CN104715507A
Re-parameterization-based cutting free-form surface isoparametric processing path generation method
CN117420788A
Universal parametric curved surface intersection method
CN118569004A
Accurate boolean operations for subdivision surfaces and relaxed fitting
US20040001060A1
