A B-spline type line space closed loop search method and system based on pre-mapping optimization
By constructing an effective topological map and processing singular regions, the problems of topological chaos and omission of small closed loops in the identification of B-spline closed loops were solved, achieving more efficient and accurate closed loop search and improving the automation level of ship 3D modeling.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- 中国船舶集团海舟系统技术有限公司
- Filing Date
- 2026-05-18
- Publication Date
- 2026-07-21
AI Technical Summary
In ship 3D design, existing technologies for identifying closed loops using B-spline profiles are inefficient and prone to errors, especially in complex areas such as bulbous bows and stern sills, where they suffer from topological confusion, repeated loop searches, and omissions of small closed loops.
An effective topological graph is constructed through a first global breadth-first search, and candidate closed loops are extracted through a second breadth-first search. Singular regions are then subjected to left-search processing. The next candidate edge is determined by combining local tangent plane projection and geometric iteration. Normal transfer and orientation correction are then performed to verify the integrity of the closed loops and the correctness of the topology.
It improves the reliability of identifying closed loops in complex B-spline spatial configurations, reduces topological chaos and omissions of small closed loops, and enhances the automation level and surface patch generation quality of ship 3D modeling.
Smart Images

Figure CN122435211A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of ship three-dimensional design and construction technology, and in particular to a B-spline spatial closed loop search method and system based on pre-built map optimization. Background Technology
[0002] In ship 3D design and hull surface construction, complex surfaces such as the bulbous bow, stern plate, and bilge transition area are typically defined by multiple spatial B-splines. Different B-splines are topologically connected through start points, end points, or spatial intersections, forming closed loops used to generate hull surface patches. Existing methods for identifying closed loops mainly include manual line selection, semi-automatic topology specification, and automatic loop search based on graph traversal.
[0003] Manual line selection relies on designers to select each line individually and specify the connection order, which is inefficient and prone to omissions and errors. The semi-automatic method still requires inputting the initial topology order or search direction. When the input order is inconsistent with the actual spatial topology, it can easily lead to the failure of closed loop recognition.
[0004] While breadth-first search-based graph traversal methods can abstract endpoints and intersections of the profile into nodes and profile segments into edges, and search for closed paths within adjacency relationships, they still suffer from insufficient stability in complex profile regions. Specifically, in regions such as the bulbous bow and stern sill, B-spline profiles often exhibit characteristics such as multiple bifurcations, multiple path connections, shared edges, difficulty in distinguishing local directions, and large loops covering small loops.
[0005] If existing methods perform loop search while constructing topological relationships, they are prone to topological confusion, repeated loop searches, and erroneous closures because the topological relationships are not yet stable. When both large and small loops exist in a local region, large loops that cover multiple small loops may be identified first, resulting in the omission of small closed loops that are actually used for surface patch construction.
[0006] Therefore, a method is needed to first stably construct an effective topological map, then perform closed loop search on the effective topological map, and be able to determine the search direction in spatial singular regions based on directed edge tangent, local reference normal, and geometric iteration, so as to improve the reliability of spatial closed loop identification of complex B-spline lines. Summary of the Invention
[0007] The purpose of this invention is to address the shortcomings of existing technologies by providing a B-spline spatial closed loop search method and system based on pre-built graph optimization, thereby solving the technical problems mentioned in the background section.
[0008] To achieve the above objectives, the present invention provides the following technical solution: A spatial closed loop search method for B-spline lines based on pre-built graph optimization includes the following steps: S1. Read the B-spline profile data, extract the start point, end point and intersection of the profile as topological nodes, take the profile segments between adjacent topological nodes as topological edges, establish the connection relationship between topological nodes and topological edges, calculate the endpoint tangent vector and initial normal of the topological edges, perform the first global breadth-first search, delete dangling edges, and form an effective topological graph. S2. Perform a second breadth-first search based on the effective topology graph. Take the untraversed or unprocessed topology nodes as the search starting point, query the in-degree edges or associated directed edges of the current topology nodes, expand the candidate paths under the condition that the same topology edge is not used repeatedly in the same path, generate candidate closed loops, and determine the singularity based on whether there are multiple path connections, large loops covering small loops, or closed loops belonging to different regions in the local topology, to obtain ordinary candidate closed loops and singular regions. S3. Perform left search processing on the singular region. Determine the local tangent plane using the unit tangent vector of the current directed edge and the local reference normal at the current node. Project the tangent vector of the candidate directed edge connected to the current node into the local tangent plane. Determine the candidate next edge based on the directed angle between the current directed edge tangent vector and the candidate directed edge tangent vector. When the angle difference between multiple candidate next edges is less than the angle threshold, perform geometric iteration along the candidate edge until the candidate direction can be distinguished, forming a singular closed loop. S4. Identify transition edges where the two end nodes do not form a fork selection and only connect the consecutive boundary segments before and after, and merge the consecutive transition edges into consecutive edges to participate in the search. Perform normal transfer and direction correction along the search path, and perform local geometric search for complex regions with multiple candidate closed paths, non-unique local topological affiliation, or where the left search cannot uniquely determine the next side, to determine the minimum closed loop. S5. Perform integrity, topological correctness, non-self-intersection, and non-overlap quality verification on ordinary candidate closed loops, singular closed loops, and minimum closed loops, and output a list of qualified closed loops.
[0009] The beneficial effects of this invention are as follows: This invention constructs an effective topology graph through a first global breadth-first search, and then performs a second breadth-first search based on the effective topology graph to extract candidate closed loops. This decouples topology construction from loop search, avoiding topology confusion, repeated loop searches, and erroneous closures caused by building the graph while searching for loops.
[0010] This invention determines the singularity of candidate closed loops and performs left search processing on singular regions, thereby identifying closed paths that better conform to local boundary directions in complex regions with multiple path connections and large loops covering small loops, reducing the problems of missing small closed loops and misidentifying large loops.
[0011] This invention determines the candidate next side by using local tangent plane projection, tangent vector angle judgment and geometric iteration mechanism, avoiding the need to rely solely on two-dimensional projection area or curvature continuity for judgment. It is applicable to scenarios where the spatial B-spline profile is complex, the local tangent is close, or the parameter directions are inconsistent.
[0012] This invention improves the search efficiency and boundary accuracy of complex hull lines by identifying transition edges and performing equivalent merging, while simultaneously performing normal transfer and direction correction along the search path, thereby reducing invalid path expansion and search backtracking.
[0013] This invention verifies integrity, topological correctness, non-self-intersection, and non-overlapping quality, and can output a list of qualified closed loops that can be directly used for the construction of hull surface patches, thereby improving the automation level of ship 3D modeling and the quality of surface patch division. Attached Figure Description
[0014] Figure 1 This is a schematic diagram of a B-spline spatial closed loop search method based on pre-built graph optimization according to the present invention. Detailed Implementation
[0015] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0016] Example 1: As Figure 1 As shown, this embodiment provides a B-spline spatial closed loop search method based on pre-built graph optimization, including the following steps: S1. Read the B-spline profile data, extract the start point, end point and intersection of the profile as topological nodes, form topological edges according to the connection relationship of the topological nodes, calculate the topological edge tangent vector, initial normal and connection relationship between topological nodes and topological edges, perform the first global breadth-first search, delete dangling edges, and form an effective topological graph. S2. Perform a second breadth-first search based on the effective topology graph. Starting from the untraversed topology node, query the in-degree edge or associated directed edge of the current node. Expand the candidate loop when the closure condition is met. Then, determine the singularity based on the cases of multi-path connection, large loop covering small loop, and local topology where the minimum boundary cannot be uniquely determined. Obtain ordinary candidate closed loops and singular loops. S3. Perform a precise left-search method on the singular loop. Determine the local tangent plane using the current directed edge tangent vector and the local reference normal constructed or passed at the current node. Project the tangent vector of the candidate directed edge connected to the current node onto the local tangent plane. Determine the next candidate edge based on the directed angle between the current directed edge tangent vector and the candidate edge tangent vector. When the angle between the projected tangent vectors of multiple candidate edges is less than a preset threshold, perform geometric iteration along the candidate edges to obtain points or recalculate the local tangent until a distinguishable angle appears in the candidate direction. Then determine the next valid topological edge to form a singular closed loop. S4. Identify transition edges that do not affect the bifurcation selection and merge them equivalently to reduce the search hierarchy. Perform normal transfer and direction correction along the search path. For complex regions with multiple candidate closed paths, non-unique topological affiliation, or where the left search method cannot uniquely determine the next side, perform complex region processing based on topological closure, directional continuity, and local geometric constraints to locate the target closed loop. S5. Perform integrity, correctness, non-self-intersection, and non-overlap quality verification on the closed loops obtained from ordinary candidate closed loops, singular closed loops, and complex regions, and output a list of qualified closed loops.
[0017] S1. Input B-spline data and complete node extraction, edge segment division, hanging edge deletion and complete topology map construction.
[0018] Specifically, this includes reading B-spline profile data of complex hull surfaces from a ship 3D design system, hull surface modeling software, or surface construction preprocessing module. B-spline profiles are spatial spline curves determined by control points, node vectors, and curve degree, used to represent boundary lines, intersection lines, and auxiliary segmentation lines in the bulbous bow, stern plate, bilge transition area, or other complex hull surface areas.
[0019] B-spline profile data should include at least the profile number, three-dimensional coordinates of control points, node vectors, curve degree, start parameters, end parameters, start coordinates, end coordinates, and intersection records between profiles. When the input data does not directly contain profile intersection records, the intersection points are obtained through B-spline curve intersection calculation, and the intersection points, start points, and end points are used together as candidate topological nodes.
[0020] In one specific embodiment, 12 B-spline profiles are input into the bulbous bow region of the ship. Each B-spline profile is a cubic B-spline curve with 6 to 14 control points. The profile parameter range is 0 to 1, and the geometric precision of the input data is [insert value here]. rice.
[0021] For two spatial lines, if the coordinates of the intersection point obtained by finding the intersection of the curves are respectively If the spatial distance between (2.315620,1.084230,0.526910) and (2.315624,1.084228,0.526913) is less than the node merging threshold, then the two intersection points will be merged into the same topological node.
[0022] For the i-th B-spline, its spatial coordinates are represented as: ; in, This represents the three-dimensional coordinates of the i-th B-spline at parameter u; u represents the curve parameter of the B-spline. Let r be the r-th B-spline basis function of degree p; The r-th control point has three-dimensional coordinates; m represents the upper limit of the control point number; and p represents the degree of the B-spline curve.
[0023] For multiple candidate topological nodes on the same profile, the topological edges between adjacent nodes can be determined based on the geometric connection relationship and the continuity relationship of the profile itself, without using parameter value sorting as a necessary constraint; when the data source has already given the node adjacency relationship or edge connection relationship, the connection relationship is directly used to establish the topological edges.
[0024] The candidate topological edge record includes the starting point number, ending point number, corresponding profile number, direction information, endpoint tangent vector, initial normal, and adjacency relationship. Optionally, the original profile correspondence or the curvature at the endpoint is also recorded as an auxiliary attribute; the curvature at the endpoint is only used to assist in analysis or verification and is not a necessary condition for determining the next edge, judging loop singularity, or outputting a qualified closed loop.
[0025] For any two candidate topology nodes and Calculate the spatial distance between the two: ; in, Indicates candidate topology nodes With candidate topology nodes Spatial distance between them; Indicates candidate topology nodes 3D coordinates; Indicates candidate topology nodes 3D coordinates; This represents the magnitude of the vector.
[0026] like If so, then the two candidate topology nodes will be merged into a single topology node; where, This represents the node merging threshold. The node merging threshold is set based on the accuracy of the ship's 3D model.
[0027] After candidate topological nodes and edges are formed, the first global breadth-first search is performed. Breadth-first search (BFS) is a graph traversal method that visits adjacent nodes level by level in a queue. The first global BFS traversal is only used to construct the complete topological graph; no closed-cycle search is performed at this stage.
[0028] The system starts from an unvisited candidate topology node and adds it to the traversal queue. After retrieving the current node from the traversal queue, it reads all candidate topology edges connected to the current node and adds the candidate topology node at the other end of each edge to the traversal queue. After traversing a connected component, the system continues to select a new starting node from the unvisited candidate topology nodes and perform traversal until all candidate topology nodes have been visited.
[0029] After the first global BFS traversal is completed, a complete topological graph is generated: ; Where G represents the complete topology graph; V represents the set of topological nodes; E represents the set of topological edges; A represents the set of node adjacency relationships; and M represents the set of geometric attributes, which include node coordinates, edge length, curvature, parameter range, initial tangent, and initial normal.
[0030] Then, dangling edges are identified and deleted. A dangling edge is a topological edge that connects to a valid topological structure at only one end, and the other end cannot participate in any closed loop enclosure. A valid topological node is a topological node formed by the start point, end point, or intersection of a profile line, and is connected to at least one valid topological edge; a valid topological edge is a topological edge located between two valid topological nodes, retaining the original B-spline profile parameter range, and potentially participating in closed loop enclosure. If one endpoint of a topological edge has a connectivity of 1, and the topological edge does not appear in any formed or potentially formed closed path, then the topological edge is marked as a dangling edge; if the topological edge belongs to the design-specified boundary or the set of edges to be forcibly retained, then deletion is not performed.
[0031] Dangling edge deletion is performed iteratively. After deleting the first dangling edge, the connectivity of its adjacent topological nodes is updated. If the updated adjacent topological edges still satisfy the dangling edge condition, deletion continues until all remaining topological edges can potentially participate in closed loop encirclement. In a specific embodiment, the first global BFS traversal yields 18 topological nodes and 12 topological edges, of which 3 edges only connect to the main linear network at one end and do not participate in any closed path. After deleting these 3 edges, 15 valid topological nodes and 9 valid topological edges are retained, forming an effective topological graph for subsequent loop search.
[0032] S2. Perform a second BFS traversal based on the effective topological graph to extract candidate loops and complete the singularity determination.
[0033] Specifically, this includes: performing a second BFS traversal based on the valid topological graph formed by S1 to search for and extract all candidate cycles. A candidate cycle is a closed path in the valid topological graph formed by connecting at least three valid topological edges end-to-end, with the starting and ending nodes being the same or their distance being less than the closure threshold. The second BFS traversal does not modify the valid topological graph formed by S1; it only performs cycle search based on already stable nodes, edges, and adjacency relationships, thus avoiding topological chaos caused by building the graph while searching for cycles.
[0034] The system sequentially selects untraversed topological nodes as starting points and queries the in-degree edges, out-degree edges, or associated directed edges of these starting points. When the current node has two or more associated directed edges that can form a closed path, the system uses the connection relationship of adjacent associated directed edges as the basis for expansion, forms the current search path, and continues to expand candidate loops along the valid topological graph.
[0035] During path expansion, in the same search path, only the starting node is allowed to reappear as the closing endpoint; other topological nodes must not appear repeatedly. The same valid topological edge must not be reused. If the number of edges in a candidate path exceeds the maximum number of edges... If the path remains unclosed, terminate the path expansion. Maximum number of edges. This can be set to the total number of valid topological edges within the current connected subgraph, or it can be set to the total number of valid topological edges within the local search window. For example, in a bulbous bow local region containing 9 valid topological edges, If the value is 9, the search stops when any path is extended beyond 9 edges and still not closed.
[0036] When the current search path returns to the starting node, or the distance between the current node coordinates and the starting node coordinates is not greater than the closure threshold. A candidate loop is determined when the number of valid topological edges in the path is not less than 3. The closure threshold is set according to the geometric accuracy of the ship's three-dimensional design model.
[0037] A standardized code is generated for each candidate cycle to avoid repeated cycle searches. The standardized code is formed as follows: the node number sequence of the candidate cycle is read, and the lexicographically smallest circular permutation is selected as the baseline sequence; simultaneously, the reverse node number sequence of the candidate cycle is generated and processed in the same way; the forward and reverse baseline sequences are compared, and the one with the smaller lexicographical order is taken as the unique code for the candidate cycle. If the newly generated unique code already exists, the candidate cycle is determined to be a duplicate cycle and discarded; if it does not exist, the candidate cycle is added to the candidate cycle set. In a specific embodiment, the node sequences "3-5-8-3" and "5-8-3-5" generate the same unique code, and the system retains only one of the candidate cycles.
[0038] After the candidate loop set is formed, each candidate loop undergoes a singularity check. Singularity refers to situations where the local topology region containing the candidate loop contains multiple paths, a large loop covers a small loop, or the local topology cannot uniquely determine the minimum boundary, causing ordinary BFS to be unable to directly determine the closed boundary to be output. Singular loops are candidate loops that, after the singularity check, are marked as requiring further precise searching.
[0039] Singularity determination is performed within the local subgraph. A local subgraph is a local topology consisting of the candidate cycle's own nodes, the candidate cycle's own nodes, and first-order adjacent edges directly connecting to the candidate cycle's nodes. Path count only includes simple paths that do not repeatedly traverse the same valid topological edge.
[0040] If there are two or more simple paths between any two candidate cycle nodes in a local subgraph, or if the edge attribution relationship between multiple candidate closed paths cannot be uniquely determined, or if there is a situation where a larger closed path covers multiple smaller closed paths and ordinary BFS cannot distinguish the minimum boundary, then the candidate cycle is marked as a singular cycle.
[0041] In one specific embodiment, the second BFS traversal yields 6 candidate cycles. Among them, all edges of 3 three-edge candidate cycles are referenced by only one cycle, and there is only one simple path between any two vertices. These are directly retained as ordinary candidate closed cycles. The other 3 candidate cycles share edges, with one large cycle covering two small cycles. The system marks these 3 candidate cycles as singular cycles and proceeds to S3 for processing.
[0042] S3. Perform a precise left-search method on the singular loop to determine a closed path with a unique direction.
[0043] Specifically, this includes performing a precise left-search method on singular loops marked with S2. The left-search method involves projecting the tangent vectors of the current directed edge and candidate directed edges onto a local tangent plane, given the current directed edge, the current node, and the local reference normal. The left candidate direction is determined based on the projected directed angle, and candidate edges with indistinguishable directions are processed through geometric iteration, thus continuously searching for closed paths along the left side of the topology. This method addresses the problem that ordinary BFS cannot uniquely determine closed boundaries in regions with multiple branches, multiple paths, and large loops covering small loops.
[0044] The local reference normal is not an arbitrary normal, but a reference normal constructed or passed together by the current directed edge, adjacent edges, and the searched path at the current node. Specifically, the initial reference normal can be obtained by the cross product of the tangent vector of the current directed edge and the tangent vector of the adjacent candidate edge, or the corrected normal of the previous edge can be passed to the current node as the reference normal; when both methods are available, the reference normal that is continuous with the direction of the searched path is preferred.
[0045] The system selects a valid topological edge from singular loops that has not yet completed left search processing as the starting directed edge. A directed edge is a valid topological edge with a definite start point, end point, and search direction. The direction of the starting directed edge is determined according to the original search direction of the candidate loop or the local topological connection relationship; if the same valid topological edge has opposite directions in different candidate loops, it is processed as two directed edge branches respectively.
[0046] Using the endpoint of the initial directed edge as the current node, all candidate next edges connected to this current node are read. When filtering candidate next edges, the system removes back edges that directly return to the previous node and do not form a closure, dangling edges that have been deleted in S1, edges that have been marked as invalid branches, and edges that cause non-starting nodes to appear repeatedly in the same path. Normal information can serve as an auxiliary reference for directional continuity, but it is not used as a strong exclusion rule based on a fixed angle threshold.
[0047] For the remaining candidate next edges, the system establishes a local tangent plane at the current node. This local tangent plane uses the local reference normal as its normal direction. The system projects the unit tangent vector of the current directed edge at the current node and the unit tangent vectors of each candidate next edge at the current node onto the local tangent plane, and calculates the directed angle between the projected tangent vector of the current directed edge and the projected tangent vector of the candidate edge.
[0048] When at least one candidate next edge satisfies the left-side direction condition, the candidate next edge with the smallest directional angle in the left-side direction and maintaining path continuity is selected first. When the angle between the projected tangent vectors of multiple candidate next edges is less than the angle tolerance threshold, making it impossible to distinguish them based on a single angle comparison at the current node, the system no longer uses curvature change, normal deviation, or local projected area as necessary criteria, but instead performs geometric iterations along each candidate edge.
[0049] The geometric iteration includes: selecting one or more local points forward along the candidate edge, recalculating the tangent vector of the candidate edge at the local point; projecting the recalculated tangent vector onto the corresponding local tangent plane; and comparing the directed angles of each candidate direction relative to the current search direction. When the angle between at least one set of candidate directions is greater than a preset resolvable threshold, the system determines the next valid topological edge based on the left direction after the resolvable angle appears.
[0050] If the candidate edges still have the same direction after the first iteration, continue iterating forward along the candidate edges to find points or local tangents until the candidate directions show a distinguishable angle, the candidate edge reaches the next topological node, or the preset maximum number of iterations is reached. If the candidate cannot be distinguished after reaching the maximum number of iterations, the candidate branch is marked as a branch to be backed up, and further processed by the candidate branch back-up mechanism.
[0051] The candidate branch rollback mechanism includes: recording all unexcluded candidate branches at the current node and their search status; when the preferred branch cannot form a closed path or enters a non-initial visited node, rolling back to the most recent node with an untried candidate branch and selecting the next candidate branch to continue the search; when all candidate branches cannot form a stable closed path, the corresponding local area is marked as a complex region to be processed, and further judgment is made by subsequent complex region processing steps.
[0052] The left search path continues to expand until one of the following termination conditions is met: First, the search path returns to the starting node, and the number of valid topological edges in the path is not less than 3, then a singular closed loop is output; Second, the search path enters a non-starting visited node, then a local loop is determined to have occurred, the current branch is marked as an invalid branch and backtracks; Third, the number of edges in the search path reaches the maximum number of edges but is still not closed, then the current branch is terminated and backtracks.
[0053] In one specific embodiment, a singular loop contains 6 valid topological edges, two of which are shared edges between adjacent smaller loops. A standard BFS can form a large loop bounded by 6 edges, or two smaller loops bounded by 3 and 4 edges, respectively. Using a left-search method, the system projects the tangent vectors of candidate edges onto the local tangent plane at nodes in the shared region. If the two candidate directions are almost identical at the current node, the system iteratively calculates the local tangent vectors along both candidate edges until the angle between their projections is distinguishable. Then, it selects the next edge according to the left direction, ultimately obtaining two unique small closed loops in each direction, thus avoiding the mistaken merging of two smaller loops into a large loop.
[0054] S4. Perform edge filtering, normal transfer, and local geometry search to locate the minimum closed loop in the complex region.
[0055] Specifically, this includes: during the loop search processes in S2 and S3, performing edge filtering on transition edges, performing normal transfer on the search path, and enabling local geometric search in complex regions. A transition edge is a valid topological edge that does not form a bifurcation choice between its two endpoints, only connects consecutive boundary segments, and does not change the boundary selection relationship of the closed loop. Normal transfer refers to correcting the normal direction edge by edge along the search path, based on the normal of the initial edge, to ensure that the boundary normals on the same closed loop remain consistent.
[0056] Local geometric search refers to the process of combining topological closure, directional continuity, and local geometric constraints in complex regions to filter multiple candidate closed paths in order to obtain a target closed loop that conforms to the local boundary attribution relationship.
[0057] During edge filtering, the system reads the connectivity of the two endpoints of each valid topological edge, as well as the in-degree and out-degree in the search direction. If neither endpoint of a valid topological edge forms a fork, and the valid topological edge only connects consecutive boundary segments, it is determined to be a transition edge; if the valid topological edge connects at least one fork node, or is a shared edge between two candidate loops, it is not determined to be a transition edge.
[0058] For multiple consecutive transition edges, the system can merge them into a single continuous edge to participate in the search, thereby reducing the search level and the number of branches; at the same time, it retains the correspondence between the equivalent continuous edge and the original topological edge sequence, so that subsequent outputs can be traced back to the original profile data.
[0059] During normal propagation, the system uses the normal at the initial vertex of the starting directed edge as the reference normal. For the j-th edge in the search path, the corrected normal of the (j-1)-th edge is propagated to the local reference plane where the j-th edge is located, and this is used as the reference normal for the j-th edge. Then, the dot product of the initial normal of the j-th edge and the reference normal is calculated. If the dot product is negative, it means that the two directions are opposite, and the system inverts the initial normal of the j-th edge; if the dot product is non-negative, the direction of the initial normal of the j-th edge remains unchanged. In this way, adjacent edges on the search path are kept consistent in the reference direction.
[0060] Complex region processing is enabled when a candidate cycle meets any of the following conditions: there are more than two candidate closed paths in the local subgraph; the topological affiliation of multiple candidate closed paths is not unique; the large cycle extracted by ordinary BFS may cover one or more small cycles; the left search method cannot uniquely determine the next valid topological edge at the current node; the directions of multiple candidate edges are still difficult to distinguish after geometric iteration; and there are still multiple possible closed results after candidate branch backtracking.
[0061] When processing complex regions, a local search window is established centered on the singular loop or complex region to be processed. The local search window includes the nodes, edges, first-order adjacent edges directly connected to the nodes in the region, and second-order adjacent edges connected to the first-order adjacent edges when necessary. The system enumerates candidate paths that can form closed paths within the local search window and eliminates paths that do not meet the requirements of closure distance, topological connectivity, directional continuity, and non-self-intersection.
[0062] For the remaining candidate paths, the system makes a judgment based on local topology affiliation, inclusion relationships between candidate paths, whether a candidate path repeatedly covers other closed loops that have passed quality verification, and whether a candidate path can form a unique boundary within the current local region. If necessary, the system may use optional evaluation rules to rank the candidate paths, but such evaluation rules are not a necessary step in this method.
[0063] In one specific embodiment, the local search window contains one larger candidate closed path and two smaller candidate closed paths. The larger candidate closed path covers the two smaller candidate closed paths, and the two smaller candidate closed paths have stable topological connectivity and distinguishable directional continuity, respectively. The system retains the two smaller candidate closed paths and marks the large loop covering these two smaller candidate closed paths as a repeated covered path, thereby adapting the search results to the actual partitioning requirements of the ship hull surface.
[0064] S5. Perform integrity, correctness and non-overlap quality verification on the closed loop, and output a list of qualified closed loops.
[0065] Specifically, this includes uniformly performing quality verification on the ordinary candidate closed loops directly retained in S2, the singular closed loops obtained by the left search method in S3, and the minimum closed loops obtained by the local geometric search in S4. A qualified closed loop refers to a closed path that simultaneously passes integrity checks, correctness checks, non-self-intersection checks, and non-overlap checks, and can be directly used as boundary data for hull surface patches.
[0066] Integrity checks are used to determine whether a closed loop is truly closed. The system reads the start and end nodes of the closed loop, calculates the spatial distance between them, and obtains the closure error. ; in, This represents the closure error of the closed loop R; Represents the three-dimensional coordinates of the starting node of the closed loop; Represents the three-dimensional coordinates of the terminating node of the closed loop; This represents the magnitude of the vector. If... If the closed loop passes the integrity check, then the closed loop is deemed to have passed the integrity check; if If the condition is not met, the closed loop is determined to be unclosed, and it is either returned to the local geometric search or directly deleted. Closure threshold. Based on the geometric accuracy settings of a certain ship's three-dimensional design model, the value is taken as follows: Meters. For example, the distance between the starting node and the ending node of a closed loop is... meters, less than If the distance is meters, then the integrity check is passed; if the distance is... If the value is less than 1 meter, it will not pass the integrity check.
[0067] The correctness check is used to determine whether the topological connections and closure relationships of a closed loop are reasonable. The system checks each valid topological node in the closed loop to see if it has two consecutive inner edges connected to it, checks for breaks between adjacent valid topological edges, checks if the edge sequence can form a closed path with consistent beginning and end, and checks for erroneous closures caused by the repeated use of the same topological edge. If a node is connected to only one inner edge, or if two adjacent edges cannot be connected through the same topological node, or if the same topological edge is reused in the same closed loop, leading to an erroneous closure, then the closed loop fails the correctness check.
[0068] The correctness check is used to determine whether the topological connections and closure relationships of closed loops are reasonable. The system checks one by one whether each valid topological node in the closed loop has two consecutive inner edges connected to it, whether there are breaks between adjacent valid topological edges, whether the edge sequence can form a closed path with consistent beginning and end, and whether there are erroneous closures caused by the repeated use of the same topological edge. Smaller, clearly defined closed loops are retained; if two closed loops only share boundary edges but their enclosed regions are different and their topological affiliation is clear, both are retained.
[0069] After quality verification, a list of qualified closed loops is output. The list of qualified closed loops includes at least the closed loop number, node sequence, edge sequence, closure error, whether it is a normal closed loop, whether it is the result of singular loop processing, whether it has undergone complex region processing, and the quality verification result. Optionally, the original profile correspondence is output for subsequent use in hull surface patch fitting or surface partitioning construction.
[0070] In one specific embodiment, 12 B-spline lines in the bulbous bow region of a ship are input. S1 generates 15 valid topological nodes and 9 valid topological edges. S2 uses a second BFS traversal to obtain 6 candidate loops, of which 3 ordinary triangular loops are directly retained, and 3 candidate loops are marked as singular loops. S3 performs a left-hand search on the singular loops to obtain 2 small closed loops unique in each direction. S4 performs edge filtering, normal transfer, and local geometric search on the complex polygonal region, merging 2 transition edges and locating 2 minimum closed loops. S5, after checks for completeness, correctness, non-self-intersection, and non-overlap, finally outputs 5 qualified closed loops. These 5 qualified closed loops all contain the original line number and parameter range, and can be directly used as boundary inputs for hull surface patch fitting or surface partitioning construction.
[0071] Example 2: This example provides a B-spline spatial closed loop search system based on pre-built map optimization, including: The topology graph construction module is used to read B-spline profile data, extract the start point, end point and intersection of the profile as topology nodes, take the profile segments between adjacent topology nodes as topology edges, calculate the edge length, curvature and initial normal of the topology edges, and perform the first global breadth-first search to delete dangling edges and form an effective topology graph. The candidate loop extraction module is used to perform a second breadth-first search based on the effective topology graph, extract candidate loops without reusing the same topology edge, and determine singularity based on shared edges, multi-path connections, nested loops, or large loops covering small loops, to obtain ordinary candidate closed loops and singular loops. The singular loop search module is used to perform a precise left search method for singular loops. It determines the next side based on the local tangent plane projection, the angle between tangent vectors, and geometric iteration. When candidate directions are difficult to distinguish, a singular closed loop is formed through a candidate branch back-off mechanism. The complex region processing module is used to identify transition edges and merge them into continuous edges, perform normal transfer and direction correction along the search path, and perform local geometric search on complex regions based on topological closure, normal consistency, curvature continuity and local area constraints to locate the minimum closed loop. The quality verification output module is used to perform integrity, correctness, non-self-intersection, and non-overlap quality verification on ordinary candidate closed loops, singular closed loops, and minimum closed loops, and outputs a list of qualified closed loops.
[0072] All the above formulas are performed using dimensionless numerical calculations; the relevant formulas are based on empirical models that approximate the real situation, obtained through extensive data collection and software simulation fitting. The preset parameters and thresholds involved in the formulas can be conventionally set and adjusted by those skilled in the art according to the physical constraints of the actual application scenario.
[0073] Those skilled in the art will recognize that the modules and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0074] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
[0075] In conclusion, the above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the protection scope of the present invention.
Claims
1. A method for searching spatial closed loops of B-spline lines based on pre-built graph optimization, characterized in that, Includes the following steps: S1. Read the B-spline profile data, extract the start point, end point and intersection of the profile as topological nodes, take the profile segments between adjacent topological nodes as topological edges, establish the connection relationship between topological nodes and topological edges, calculate the endpoint tangent vector and initial normal of the topological edges, perform the first global breadth-first search, delete dangling edges, and form an effective topological graph. S2. Perform a second breadth-first search based on the effective topology graph. Take the untraversed or unprocessed topology nodes as the search starting point, query the in-degree edges or associated directed edges of the current topology nodes, expand the candidate paths under the condition that the same topology edge is not used repeatedly in the same path, generate candidate closed loops, and determine the singularity based on whether there are multiple path connections, large loops covering small loops, or closed loops belonging to different regions in the local topology, to obtain ordinary candidate closed loops and singular regions. S3. Perform left search processing on the singular region. Determine the local tangent plane using the unit tangent vector of the current directed edge and the local reference normal at the current node. Project the tangent vector of the candidate directed edge connected to the current node into the local tangent plane. Determine the candidate next edge based on the directed angle between the current directed edge tangent vector and the candidate directed edge tangent vector. When the angle difference between multiple candidate next edges is less than the angle threshold, perform geometric iteration along the candidate edge until the candidate direction can be distinguished, forming a singular closed loop. S4. Identify transition edges where the two end nodes do not form a fork selection and only connect the consecutive boundary segments before and after, and merge the consecutive transition edges into consecutive edges to participate in the search. Perform normal transfer and direction correction along the search path, and perform local geometric search for complex regions with multiple candidate closed paths, non-unique local topological affiliation, or where the left search cannot uniquely determine the next side, to determine the minimum closed loop. S5. Perform integrity, topological correctness, non-self-intersection, and non-overlap quality verification on ordinary candidate closed loops, singular closed loops, and minimum closed loops, and output a list of qualified closed loops.
2. The B-spline spatial closed loop search method based on pre-built graph optimization according to claim 1, characterized in that, In S1: The B-spline data comes from a ship 3D design system, hull surface modeling software, or surface construction preprocessing module. The B-spline data includes one or more of the following: spline number, spline geometry data, start coordinates, end coordinates, tangent vectors of the first and last endpoints, and spline intersection records. When there are no intersection records of the profile lines, the intersection point is obtained by finding the intersection using B-spline curves, and the intersection point, the start point, and the end point are used together as topological nodes.
3. The B-spline spatial closed loop search method based on pre-built graph optimization according to claim 1, characterized in that, In S1: Based on the connection relationship of the topological nodes on the B-spline, the line segments located between adjacent topological nodes are determined as topological edges; Topological nodes whose spatial distance is less than the node merging threshold are merged; the topological edge records the starting point number, ending point number, belonging line number, endpoint tangent vector, initial normal, and adjacency relationship; Optionally, only the curvature at the endpoints of the topological edges can be calculated as an auxiliary geometric property.
4. The B-spline spatial closed loop search method based on pre-built graph optimization according to claim 1, characterized in that, In S1: The first global breadth-first search is used to collect topological nodes, topological edges, adjacency relationships and geometric attributes, and to construct a complete topological graph, without performing a closed-loop search; After traversal, topological edges that connect only one end to a valid topological structure and cannot participate in a closed path are marked as dangling edges, and valid topological graphs are formed by iteratively deleting dangling edges.
5. The B-spline spatial closed loop search method based on pre-built graph optimization according to claim 1, characterized in that, In S2: The second breadth-first search starts with a valid topology node and queries the in-degree edge or associated directed edge of the current topology node. When the current topology node has at least two associated directed edges that can form a closed candidate relationship, the candidate path is expanded based on the associated directed edge. In the same path, no topological node is passed repeatedly except for the starting node which is the closing endpoint, and the same topological edge is not used repeatedly. A candidate closed loop is generated when the search path returns to the starting node or meets the closure threshold and contains no fewer than three valid topological edges.
6. The B-spline spatial closed loop search method based on pre-built graph optimization according to claim 1, characterized in that, In S2: Generate a unique code for each candidate closed loop, determined by a sequence of node numbers, to remove duplicate candidate closed loops; Singularity determination is performed in the local subgraph consisting of the candidate closed loop's own nodes, the candidate closed loop's own edges, and the first-order adjacent edges directly connected to the candidate closed loop's nodes. When the local subgraph contains multi-path connections, large loops covering small loops, or candidate closed loops whose affiliation cannot be uniquely determined by ordinary breadth-first search, the corresponding region is marked as a singular region.
7. The B-spline spatial closed loop search method based on pre-built graph optimization according to claim 1, characterized in that, In S3: For singular regions, select valid topological edges that have not been fully processed as starting directed edges, and remove back edges, dangling edges, invalid branch edges, and edges that cause non-starting nodes to appear repeatedly in the same path; For the remaining candidate next edge, calculate the directed angle between its projected tangent vector and the projected tangent vector of the current directed edge, and determine the candidate next edge according to the left-side priority principle.
8. The B-spline spatial closed loop search method based on pre-built graph optimization according to claim 1, characterized in that, In S3: When the angle between the projected tangent vectors of multiple candidate next sides is less than the angle threshold, select iterative parameter points forward along the multiple candidate next sides respectively, and recalculate the corresponding local tangent vector and its projection direction. If the angle between the recalculated projection directions is still less than the angle threshold, the iteration continues until the angle between the candidate directions is greater than the angle threshold or the maximum number of iterations is reached. If the maximum number of iterations is still insufficient to distinguish the regions, the local area is marked as a complex region to be reviewed.
9. The B-spline spatial closed loop search method based on pre-built graph optimization according to claim 1, characterized in that, In S4: Valid topological edges that do not form a fork selection at both ends and only connect consecutive boundary segments before and after are identified as transition edges. Continuous transition edges are equivalently merged into continuous edges to participate in the search, while the correspondence between the equivalent continuous edges and the original topological edges is preserved. Using the normal of the initial directed edge as the reference normal, the normal is transferred edge by edge along the search path. When the normal directions of adjacent edges are opposite, the normal is inverted for correction.
10. The B-spline spatial closed loop search method based on pre-built graph optimization according to claim 1, characterized in that, In S4 and S5: When multiple candidate closed paths exist in the local subgraph, candidate closed loops have overlapping relationships, candidate directions cannot be uniquely determined by a single left search, or the left search branch cannot be stably closed, local geometric search is enabled. The minimum closed loop is determined based on topological closure, directional continuity, normal consistency, and the inclusion relationship of candidate paths. Subsequently, the integrity, topological correctness, non-self-intersection, and non-overlap quality of ordinary candidate closed loops, singular closed loops, and minimum closed loops are verified, and a list of qualified closed loops containing node sequences, edge sequences, closure errors, processing types, and quality verification results is output.
11. A B-spline spatial closed-loop search system based on pre-built graph optimization, employing the B-spline spatial closed-loop search method based on pre-built graph optimization as described in any one of claims 1 to 10, characterized in that, include: The topology graph construction module is used to read B-spline profile data, extract the start point, end point and intersection point of the profile as topology nodes, take the profile segments between adjacent topology nodes as topology edges, establish the connection relationship between topology nodes and topology edges, calculate the tangent vector and initial normal of the topology edge endpoints, and delete dangling edges to form an effective topology graph. The candidate loop extraction module is used to perform a second breadth-first search based on the effective topology graph, expand the candidate path based on the topology node and its in-degree edge or associated directed edge, extract candidate closed loops and perform singularity determination. The singular loop search module is used to perform left search processing on singular regions, and determines the candidate next side based on local tangent plane projection, tangent vector angle and geometric iteration; The complex region processing module is used to identify transition edges and merge them into continuous edges, perform normal transfer and direction correction along the search path, and perform local geometric search in complex regions to determine the minimum closed loop; The quality verification output module is used to perform integrity, topological correctness, non-self-intersection, and non-overlap quality verification on ordinary candidate closed loops, singular closed loops, and minimum closed loops, and outputs a list of qualified closed loops.