Unstructured PHT spline storage and calculation method and system
By using parameterization methods and half-edge data structures to generate initial mesh in PHT spline fitting, updating Bezier vertical marks and subdividing cell cavity layer by layer, the problem of large consumption of closed surface fitting computing resources in traditional methods is solved, efficient non-structural PHT spline storage and calculation is achieved, and the global continuity of the surface is ensured.
Patent Information
- Application Number
- CN202510205196.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-24
- Publication Date
- 2025-06-06
AI Technical Summary
Traditional PHT splines require multiple boundary reparameterization and stitching when fitting a closed surface, resulting in excessive consumption of computing resources and lack of efficient storage and calculation methods.
By inputting the complex surfaces that need to be fitted, selecting the appropriate parameterization method, mapping them to the cube or rectangular parameter domain, generating an initial mesh based on the half-edge data structure, calculating geometric information and updating the Bezier vertical mark, subdividing the cell cavity that does not meet the requirements layer by layer, and finally outputting the PHT spline is STEP format.
It realizes efficient storage and calculation of non-structural PHT splines, unifies the algorithm process of open and closed surface fitting, avoids boundary discontinuity, ensures the global continuity of the fitted surface, and provides an efficient conversion algorithm from PHT spline to NURBS.
Smart Images

Figure CN120107527A_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the field of computer-aided geometric design, and in particular relates to a non-structured PHT spline storage and calculation method and system. Background Art
[0002] PHT splines (Polynomial splines over Hierarchical T-meshes, PHT-splines) is a new geometric modeling method based on hierarchical T-mesh. It has stronger flexibility and adaptability than non-uniform rational B-splines (NURBS), and overcomes the limitations of traditional geometric modeling methods in dealing with complex modeling gap problems, control point redundant design problems, and unified representation of design and analysis. Unstructured PHT splines are an extension of PHT splines. They allow singular points in the mesh and can adapt to complex shapes or structures more flexibly.
[0003] When fitting open surfaces, PHT splines can quickly obtain fitting results through interpolation theorems due to the completeness of the spline space. However, for the fitting of closed surfaces, traditional methods usually need to divide the surface into six parts and process them separately, and then reparameterize and stitch them at the boundaries. Since the boundaries need to be adjusted and aligned multiple times, the stitching process increases the consumption of computing resources. Therefore, there is an urgent need for an efficient storage and calculation method for unstructured PHT splines. Summary of the invention
[0004] In order to solve the above technical problems, the present invention provides a method for storing and calculating unstructured PHT splines, comprising the following steps:
[0005] Step S1: Input the complex surface to be fitted ; Select an appropriate parameterization method and Mapping to a cubic parameter domain or a rectangular parameter domain;
[0006] Step S2: Generate initial mesh based on half-edge data structure ;
[0007] Step S3: Calculation In the initial grid Geometric information at the base point, using interpolation theorem to update the mesh Bezier ordinates of the cell cavity;
[0008] Step S4: Considering the fitting accuracy and the number of mesh layers comprehensively, the cells in the current layer that do not meet the requirements are subdivided layer by layer, and the Bezier vertical scale is updated to finally obtain the optimized mesh. ;
[0009] Step S5: The corresponding PHT spline output is in STEP format.
[0010] Beneficial effects:
[0011] The present invention provides a non-structured PHT spline storage and calculation method, which only needs to record the Bezier ordinates in the cell cavity, effectively simplifying the storage information of the spline surface; unifying the algorithm flow of PHT spline fitting open and closed surfaces, without the need for boundary reparameterization and stitching operations, simplifying the fitting steps of complex surfaces; avoiding the boundary discontinuity problem that may occur in traditional methods, ensuring the global continuity of the fitting surface; providing an efficient PHT spline to NURBS conversion algorithm, providing a convenient solution for downstream tasks of complex surface modeling (such as CNC machining, physical simulation). The present invention is suitable for various fields such as industrial design, computer graphics, engineering simulation, etc., and has broad application prospects. BRIEF DESCRIPTION OF THE DRAWINGS
[0012] Figure 1 A schematic diagram of a flow chart of a non-structured PHT spline storage and calculation method of the present invention;
[0013] Figure 2 Schematic diagram of fitting closed surface layer by layer with unstructured PHT spline;
[0014] Figure 3 Schematic diagram of unstructured PHT spline fitting open surface layer by layer;
[0015] Figure 4 Schematic diagram of the design of non-structural PHT splines in industrial parts;
[0016] Figure 5 Design a cartoon image of the unstructured PHT spline;
[0017] Figure 6 It is a structural block diagram of an unstructured PHT spline storage and calculation system of the present invention. DETAILED DESCRIPTION
[0018] In order to make the purpose, technical solutions and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention. In addition, the technical features involved in the various embodiments of the present invention described below can be combined with each other as long as they do not conflict with each other.
[0019] Embodiment 1
[0020] like Figure 1 As shown, an unstructured PHT spline storage and calculation method provided by an embodiment of the present invention includes the following steps:
[0021] Step S1: Input the complex surface to be fitted ; Select an appropriate parameterization method and Mapping to a cubic parameter domain or a rectangular parameter domain;
[0022] Step S2: Generate initial mesh based on half-edge data structure and parameter domain ;
[0023] Step S3: Calculation In the initial grid The geometric information at the base point is updated using the interpolation theorem Bezier ordinates of the cell cavity;
[0024] Step S4: Considering the fitting accuracy and the number of mesh layers comprehensively, the cells in the current layer that do not meet the requirements are subdivided layer by layer, and the Bezier vertical scale is updated to finally obtain the optimized mesh. ;
[0025] Step S5: The corresponding PHT spline output is in STEP format.
[0026] In one embodiment, in the above step S1: input the complex surface to be fitted ; Select an appropriate parameterization method and Mapping to a cubic parameter domain or a rectangular parameter domain, including:
[0027] Step S11: If For a closed surface, select a suitable parameterization method and map it to The six surfaces of the cubic parameter domain of ;
[0028] Step S12: If To open the surface, select a suitable parameterization method and map it to The rectangular parameter domain of .
[0029] Complex curved surface input by the embodiment of the present invention Supports STEP format, VTK format, OFF format, etc.
[0030] In one embodiment, the above step S2: generating an initial grid based on the half-edge data structure and the parameter domain , specifically including:
[0031] Step S21: If For a closed surface, initialize Initial cube mesh on the parameter domain ,in, Contains 6 faces, namely Z_TOP, Z_BOTTOM, Y_TOP, Y_BOTTOM, X_TOP, X_BOTTOM, and the normal vector of each face is facing outward; It contains 26 vertices in total, including 8 singular vertices with degree 3, 12 cross vertices with degree 4 located at the junction of two faces, and 6 cross vertices with degree 4 located inside the face; It contains 24 cavities in total;
[0032] Step S22: If To open the surface, initialize Rectangular initial grid over the parameter domain ,in, It contains 4 L-shaped vertices with degree 2 and 1 cell.
[0033] The half-edge data structure of the embodiment of the present invention is as follows:
[0034] Vertex structure:
[0035] property:
[0036] position: The coordinates of the vertex in three-dimensional space.
[0037] half_edge: A reference to an associated half edge.
[0038] type: vertex type, including cross point / singular point / T point / L point.
[0039] Structure HalfEdge:
[0040] property:
[0041] from_vertex: A reference to the starting vertex.
[0042] pair: A reference to the opposite half.
[0043] prev: A reference to the previous half-edge.
[0044] next: A reference to the next half-edge.
[0045] edge: A reference to the associated edge.
[0046] face: A reference to the associated face.
[0047] direction: The parameter direction of the half edge.
[0048] Structure edge:
[0049] property:
[0050] half_edge: A reference to one of the half edges.
[0051] param_length: parameter length of the edge.
[0052] Structural face (Face):
[0053] property:
[0054] half_edge: A reference to the starting half edge of the face.
[0055] bezier_extraction: Bezier ordinates inside the surface.
[0056] In one embodiment, the above step S3: calculating In the initial grid The geometric information at the base point is updated using the interpolation theorem The Bezier ordinates of the cell cavity include:
[0057] Step S31: If For a closed surface, select The 26 vertices of are the initial base points, and the numerical calculation results are Geometric information at the corresponding parameter coordinates ; According to the interpolation theorem, the 3D coordinates of the 4 control points corresponding to each base point are calculated and assigned to the 16 vertical scales of the cell cavity in sequence. The calculation formula is as follows:
[0058] ,
[0059] ,
[0060] ,
[0061] ,
[0062] in, , Respectively represent the base point The distance between the front and back edges of the direction, , Respectively represent the base point The distance between the front and rear edges in the direction; for the Z_TOP surface, Direction and Direction as parameter domain Direction and direction; for the Z_BOTTOM face, Direction and Direction as parameter domain Direction and direction; for the Y_TOP face, Direction and Direction as parameter domain Direction and direction; for the Y_BOTTOM face, Direction and Direction as parameter domain Direction and direction; for the X_TOP face, Direction and Direction as parameter domain Direction and direction; for the X_BOTTOM face, Direction and Direction as parameter domain Direction and direction;
[0063] For a cross vertex located at the junction of two faces, it is necessary to integrate the geometric information of the two faces. and get , the calculation formula is as follows:
[0064] 1) If the two sides Same direction:
[0065] ;
[0066] 2) If the two faces Opposite direction:
[0067] ;
[0068] 3) If the second side Direction and first face Same direction:
[0069] ;
[0070] 4) If the second side Direction and first face Same direction:
[0071] ;
[0072] Step S32: If For an open surface, select The four L-shaped vertices with degree 2 are used as the initial base points, and the numerical calculation results are The geometric information at the corresponding parameter coordinates is calculated according to the interpolation theorem to obtain the 3D coordinates of the 4 control points corresponding to each base point, and assigned to the 16 vertical scales of the cell in sequence. Direction and Direction as parameter domain Direction and direction.
[0073] In one embodiment, the above step S4: comprehensively considers the fitting accuracy and the number of mesh layers, subdivides the cells in the current layer that do not meet the requirements layer by layer, and updates the Bezier vertical scale to finally obtain an optimized mesh. , specifically including:
[0074] Step S41: Select the cells to be subdivided: For the cells of the current layer, select appropriate test points and calculate the current spline value and If the error is greater than the fitting accuracy, the cell needs to be subdivided;
[0075] Step S42: performing cross subdivision on the selected cell: for the cell to be subdivided, insert a new vertex at the center of the cell, and connect the midpoints of the four sides of the cell to divide the cell into four equal parts;
[0076] Step S43: Update the Bezier ordinates in the cell: First, the subdivision algorithm is used to calculate the Bezier ordinates of the four cells after the quartering based on the ordinates of the cells before the subdivision; secondly, for all the base points added after the subdivision operation, that is, the cross vertices with a degree of 4 or the T-shaped vertices with a degree of 3 belonging to only one face, the interpolation algorithm in step S41 is used to update the ordinates of the corresponding cells;
[0077] Step S44: Considering the fitting accuracy and the number of mesh layers comprehensively, the fitting operation is stopped when subdivision is no longer required, and the optimized mesh is finally obtained. ;like There are singular points in the model. According to the Bezier ordinates of the cells around the singular points, the geometric information at the singular points is modified to make the PHT spline G1 continuous near the singular points.
[0078] Figure 2 It is a schematic diagram of the unstructured PHT spline fitting closed surface layer by layer. Figure 3 It is a schematic diagram of unstructured PHT spline fitting an open surface layer by layer.
[0079] In one embodiment, the above step S5: The corresponding PHT spline output is in STEP format, including:
[0080] Step S51: If For a closed surface, The six faces Z_TOP, Z_BOTTOM, Y_TOP, Y_BOTTOM, X_TOP, and X_BOTTOM are processed separately, that is, for each face, the tensor product grid obtained by the parameter coordinates of all base points is obtained ,because All vertices in are base points. The 3D coordinates of the four control points at each base point can be obtained by the interpolation theorem. Furthermore, the control points are equivalent to the control points of the NURBS surface with a multiplicity of 2. Therefore, the unstructured PHT spline can be exported as 6 seamlessly connected and overall continuous NURBS surfaces and stored in STEP format.
[0081] Step S52: If For open surfaces, , using the conversion algorithm in step S51, it can be exported as a piece of overall continuous NURBS surface and stored in STEP format.
[0082] Two typical examples of embodiments of the present invention are as follows:
[0083] Example 1 demonstrates the application of unstructured PHT splines in industrial parts modeling. First, the industrial part model is imported into the test program implemented in C++ language, and the surface fitting and export are performed according to the unstructured PHT spline fitting algorithm and conversion algorithm proposed in the present invention. Figure 4 As shown in the figure, the unstructured PHT spline provides high-precision fitting effect on local details. In addition, after conversion to NURBS form, the fitting results can be used for further surface processing and simulation analysis.
[0084] Example 2 demonstrates the application of unstructured PHT spline in cartoon character design. First, the cartoon model is imported into the test program implemented in C++ language, and the surface fitting and export are performed according to the unstructured PHT spline fitting algorithm and conversion algorithm proposed in the present invention. Figure 5 As shown in Figure 2, the unstructured PHT spline ensures the consistency and continuity of the surface design. In addition, after conversion to NURBS form, the fitting results can be used for further surface modification.
[0085] Embodiment 2
[0086] like Figure 6 As shown, an embodiment of the present invention provides an unstructured PHT spline storage and calculation system, including the following modules:
[0087] Parameterization module 61, used to input complex surfaces that need to be fitted ; Select an appropriate parameterization method and Mapping to a cubic parameter domain or a rectangular parameter domain;
[0088] Initialization grid module 62, used to generate an initial grid based on the half-edge data structure and parameter domain ;
[0089] Update cell module 63 for calculation In the initial grid Geometric information at the base point, using interpolation theorem to update the mesh Bezier ordinates of the cell cavity;
[0090] The cell optimization module 64 is used to comprehensively consider the fitting accuracy and the number of mesh layers, subdivide the cells that do not meet the requirements in the current layer layer by layer, and update the Bezier vertical scale to finally obtain the optimized mesh ;
[0091] Output PHT spline module 65, used to convert The corresponding PHT spline output is in STEP format.
[0092] A non-structured PHT spline storage and calculation device comprises one or more electronic devices, wherein the one or more electronic devices are used to implement a non-structured PHT spline storage and calculation method, system and device.
[0093] An electronic device includes: one or more processors; a memory for storing one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors implement a non-structured PHT spline storage and calculation method, system and device.
[0094] A computer-readable storage medium stores executable instructions, which, when executed by a processor, enable the processor to implement a non-structured PHT spline storage and calculation method, system and device.
[0095] A non-transitory computer-readable storage medium stores a computer program, which, when executed by a processor, implements a non-structured PHT spline storage and calculation method, system and device.
[0096] The foregoing is merely a specific embodiment of the present invention, which enables those skilled in the art to understand or implement the present application. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present application. Therefore, the present invention will not be limited to the embodiments shown herein, but will conform to the widest scope consistent with the principles and novel features applied herein.
Claims
1. A method for storing and calculating unstructured PHT splines, characterized in that: include: Step S1: Input the complex surface to be fitted ; Select an appropriate parameterization method and Mapping to a cubic parameter domain or a rectangular parameter domain; Step S2: Generate initial mesh based on half-edge data structure and parameter domain ; Step S3: Calculation In the initial grid The geometric information at the base point is updated using the interpolation theorem Bezier ordinates of the cell cavity; Step S4: Considering the fitting accuracy and the number of mesh layers comprehensively, the cells in the current layer that do not meet the requirements are subdivided layer by layer, and the Bezier vertical scale is updated to finally obtain the optimized mesh. ; Step S5: The corresponding PHT spline output is in STEP format.
2. The unstructured PHT spline storage and calculation method according to claim 1, characterized in that: Step S1: Input the complex surface to be fitted ; Select an appropriate parameterization method and Mapping to a cubic parameter domain or a rectangular parameter domain, including: Step S11: If For a closed surface, select a suitable parameterization method and map it to The six surfaces of the cubic parameter domain of ; Step S12: If To open the surface, select a suitable parameterization method and map it to The rectangular parameter domain of .
3. The unstructured PHT spline storage and calculation method according to claim 2, characterized in that: Step S2: generating an initial grid based on the half-edge data structure and parameter domain , specifically including: Step S21: If For a closed surface, initialize Initial cube mesh on the parameter domain ,in, Contains 6 faces, namely Z_TOP, Z_BOTTOM, Y_TOP, Y_BOTTOM, X_TOP, X_BOTTOM, and the normal vector of each face is facing outward; It contains 26 vertices in total, including 8 singular vertices with degree 3, 12 cross vertices with degree 4 located at the junction of two faces, and 6 cross vertices with degree 4 located inside the face; It contains 24 cavities in total; Step S22: If To open the surface, initialize Rectangular initial grid over the parameter domain ,in, It contains 4 L-shaped vertices with degree 2 and 1 cell.
4. The unstructured PHT spline storage and calculation method according to claim 3, characterized in that: Step S3: Calculation In the initial grid The geometric information at the base point is updated using the interpolation theorem The Bezier ordinates of the cell cavity include: Step S31: If For a closed surface, select The 26 vertices of are the initial base points, and the numerical calculation results are Geometric information at the corresponding parameter coordinates ; According to the interpolation theorem, the 3D coordinates of the 4 control points corresponding to each base point are calculated and assigned to the 16 vertical scales of the cell cavity in sequence. The calculation formula is as follows: , , , , in, , Respectively represent the base point The distance between the front and back edges of the direction, , Respectively represent the base point The distance between the front and rear edges in the direction; for the Z_TOP surface, Direction and Direction as parameter domain Direction and direction; for the Z_BOTTOM face, Direction and Direction as parameter domain Direction and direction; for the Y_TOP face, Direction and Direction as parameter domain Direction and direction; for the Y_BOTTOM face, Direction and Direction as parameter domain Direction and direction; for the X_TOP face, Direction and Direction as parameter domain Direction and direction; for the X_BOTTOM face, Direction and Direction as parameter domain Direction and direction; For a cross vertex located at the junction of two faces, it is necessary to integrate the geometric information of the two faces. and get , the calculation formula is as follows: 1) If the two sides Same direction: ; 2) If the two faces Opposite direction: ; 3) If the second side Direction and first face Same direction: ; 4) If the second side Direction and first face Same direction: ; Step S32: If For an open surface, select The four L-shaped vertices with degree 2 are used as the initial base points, and the numerical calculation results are The geometric information at the corresponding parameter coordinates is calculated according to the interpolation theorem to obtain the 3D coordinates of the 4 control points corresponding to each base point, and assigned to the 16 vertical scales of the cell in sequence. Direction and Direction as parameter domain Direction and direction.
5. The unstructured PHT spline storage and calculation method according to claim 4, characterized in that: Step S4: comprehensively consider the fitting accuracy and the number of mesh layers, subdivide the cells in the current layer that do not meet the requirements layer by layer, and update the Bezier vertical scale to finally obtain the optimized mesh , specifically including: Step S41: Select the cells to be subdivided: For the cells of the current layer, select appropriate test points and calculate the current spline value and If the error is greater than the fitting accuracy, the cell needs to be subdivided; Step S42: performing cross subdivision on the selected cell: for the cell to be subdivided, insert a new vertex at the center of the cell, and connect the midpoints of the four sides of the cell to divide the cell into four equal parts; Step S43: Update the Bezier ordinates in the cell: First, the subdivision algorithm is used to calculate the Bezier ordinates of the four cells after the quartering based on the ordinates of the cells before the subdivision; secondly, for all the base points added after the subdivision operation, that is, the cross vertices with a degree of 4 or the T-shaped vertices with a degree of 3 belonging to only one face, the interpolation algorithm in step S41 is used to update the ordinates of the corresponding cells; Step S44: Considering the fitting accuracy and the number of mesh layers comprehensively, the fitting operation is stopped when subdivision is no longer required, and the optimized mesh is finally obtained. ;like There are singular points in the model. According to the Bezier ordinates of the cells around the singular points, the geometric information at the singular points is modified to make the PHT spline G1 continuous near the singular points.
6. The unstructured PHT spline storage and calculation method according to claim 5, characterized in that: Step S5: The corresponding PHT spline output is in STEP format, including: Step S51: If For a closed surface, The six faces Z_TOP, Z_BOTTOM, Y_TOP, Y_BOTTOM, X_TOP, and X_BOTTOM are processed separately, that is, for each face, the tensor product grid obtained by the parameter coordinates of all base points is obtained ,because All vertices in are base points, and the 3D coordinates of the four control points at each base point can be obtained by the interpolation theorem. Furthermore, the control points are equivalent to the control points of the NURBS surface with a multiplicity of 2; therefore, the unstructured PHT spline can be exported as 6 seamlessly connected and overall continuous NURBS surfaces, and stored in STEP format; Step S52: If For open surfaces, , using the conversion algorithm in step S51, it can be exported as a piece of overall continuous NURBS surface and stored in STEP format.
7. An unstructured PHT spline storage and calculation system, characterized in that: Includes the following modules: Parametric module, used to input complex surfaces that need to be fitted ; Select an appropriate parameterization method and Mapping to a cubic parameter domain or a rectangular parameter domain; Initialize mesh module, used to generate initial mesh based on half-edge data structure and parameter domain ; Updated cell module for calculation In the initial grid Geometric information at the base point, using interpolation theorem to update the mesh Bezier ordinates of the cell cavity; The cell optimization module is used to comprehensively consider the fitting accuracy and the number of mesh layers, subdivide the cells that do not meet the requirements in the current layer layer by layer, and update the Bezier vertical scale to finally obtain the optimized mesh ; Output PHT spline module, used to convert The corresponding PHT spline output is in STEP format.
8. An unstructured PHT spline storage and calculation device, characterized in that: The method comprises one or more electronic devices, wherein the one or more electronic devices are used to implement the method according to any one of claims 1 to 6.
9. An electronic device, characterized in that: include: one or more processors; A memory for storing one or more programs, wherein 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 6.
10. A computer-readable storage medium, characterized in that: Executable instructions are stored thereon, and when the instructions are executed by a processor, the processor implements the method according to any one of claims 1 to 6.