Effective room identification method and device, equipment and storage medium
By converting the building floor plan into a set of line segments and an undirected weighted graph structure, combined with incremental updates and the minimum ring basis algorithm, the problem of low computational efficiency caused by full reconstruction in existing technologies is solved, and efficient room recognition and real-time interactive design are achieved.
Patent Information
- Application Number
- CN202510778597.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-11
- Publication Date
- 2025-09-09
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
Existing room recognition methods require full reconstruction when processing architectural floor plan editing, resulting in low computational efficiency and unable to meet the needs of real-time interactive design.
The wall elements in the building plan are converted into a set of line segments, and an undirected weighted graph structure is constructed. The structure is incrementally updated in response to user editing operations, and the minimum ring basis algorithm is applied for ring detection and validity identification to identify valid rooms.
Through incremental updates and local processing, the computational overhead of full reconstruction is avoided, and the computational efficiency and real-time performance of room recognition are significantly improved. It is suitable for the interactive design of large and complex building floor plans.
Smart Images

Figure CN120611281A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of data processing technology, and in particular to an effective room identification method, device, equipment and storage medium. Background Art
[0002] Room recognition is a key function of computer-aided design (CAD) systems in architectural design and interior space planning. Traditional room recognition methods typically rely on full reconstruction. This means that whenever a user edits a floor plan, the system must reanalyze all wall elements in the entire plan, reconstruct the complete topology, and perform loop detection and room recognition on the entire plan.
[0003] This full-scale processing method has significant computational efficiency issues when faced with large and complex building floor plans. Especially when users perform frequent local editing operations, the system needs to repeatedly perform a large amount of repetitive calculations, resulting in slow response speed and poor user experience, which cannot meet the needs of real-time interactive design. Summary of the Invention
[0004] The main purpose of the present invention is to solve the technical problem that the existing room recognition method requires full reconstruction when processing building floor plan editing, resulting in low computational efficiency; A first aspect of the present invention provides a valid room identification method, the valid room identification method comprising: Converting wall elements in the building plan into a set of line segments, and performing intersection detection and topological analysis on the set of line segments to obtain an undirected weighted graph structure representing the connection relationship of the walls; In response to a user editing operation on the building plan, determining a corresponding affected area, and incrementally updating a graph structure portion corresponding to the affected area in the undirected weighted graph structure to obtain a locally updated graph structure; Applying a minimum ring basis algorithm to the local updated graph structure to perform ring detection processing to obtain a minimum ring basis that includes basic rings in the affected area; The validity of each ring in the minimum ring base is identified according to its geometric features and topological features to obtain a validity identification result, and the ring whose validity identification result is valid is identified as a valid room.
[0005] Optionally, in a first implementation of the first aspect of the present invention, converting wall elements in the building plan into a set of line segments, and performing intersection detection and topological analysis on the set of line segments to obtain an undirected weighted graph structure representing wall connection relationships includes: Extracting geometric attributes of wall elements in the building plan, encapsulating the wall elements into a line segment data structure based on the extracted geometric attributes, and obtaining a line segment set; Performing geometric intersection determination and intersection coordinate calculation on any two line segments in the line segment set to obtain an intersection coordinate set containing position information of all intersection points; Dividing each line segment in the line segment set into a plurality of sub-line segments according to the intersection coordinate set, and merging the intersection coordinate set and the line segment endpoint coordinates of the sub-line segments to remove duplicates, thereby obtaining a vertex set; Performing connection relationship identification processing on adjacent vertices in the vertex set to obtain an edge set, and calculating a weight value according to the length of a sub-line segment corresponding to each edge in the edge set and the thickness of a geometric attribute wall to obtain a weight set; The vertex set, edge set and weight set are assembled into an undirected weighted graph structure representing the wall connection relationship.
[0006] Optionally, in a second implementation of the first aspect of the present invention, incrementally updating the graph structure portion corresponding to the impact area in the undirected weighted graph structure to obtain a locally updated graph structure includes: Locating a corresponding vertex set and edge set in an undirected weighted graph structure according to the influence area, wherein the influence area is the influence area of the wall directly modified in the building plan and the adjacent wall that generates a new intersection; Deleting the vertex set and edge set corresponding to the affected area to obtain an undirected weighted graph structure after local deletion; New wall elements are determined according to the user editing operation, the new wall elements are converted into new line segments, and intersection detection and topology analysis are performed on the new line segments and the edge set of the undirected weighted graph structure after the local deletion to obtain a local updated graph structure.
[0007] Optionally, in a third implementation of the first aspect of the present invention, applying a minimum ring basis algorithm to the local updated graph structure to perform ring detection processing to obtain a minimum ring basis containing basic rings in the affected area includes: Performing a depth-first search traversal on the local update graph structure to detect all simple cycles in the local update graph structure and obtain a candidate cycle set; Applying a minimum ring basis algorithm to the candidate ring set to identify basic rings to obtain a basic ring set; Performing spatial screening on the basic ring set according to the spatial range of the influence area, determining the inclusion relationship between the vertex coordinates of each basic ring and the influence area, and obtaining the ring set within the influence area; Linearly independent basic rings are selected from the ring set within the influence area to obtain a minimum ring base containing the basic rings within the influence area.
[0008] Optionally, in a fourth implementation of the first aspect of the present invention, applying a minimum ring basis algorithm to the candidate ring set to identify basic rings to obtain the basic ring set includes: Use Dijkstra algorithm or BFS algorithm to construct a shortest path tree for each vertex in the graph structure corresponding to the candidate ring set to obtain a shortest path tree set; Identify non-tree edges in the local update graph structure according to the shortest path tree set, construct a basic ring for each path between two vertices connected by the non-tree edge in the shortest path tree, and obtain a basic ring candidate set; constructing a bit vector representation with a length equal to the number of edges for each ring in the basic ring candidate set to obtain a bit vector set; An incremental Gaussian elimination algorithm is applied to the bit vector set to perform linear independence detection, and linearly independent rings in the basic ring candidate set are identified to obtain a basic ring set.
[0009] Optionally, in a fifth implementation of the first aspect of the present invention, applying an incremental Gaussian elimination algorithm to the bit vector set to perform linear independence detection, identifying linearly independent rings in the basic ring candidate set, and obtaining the basic ring set includes: Constructing and setting an initialization matrix to zero, wherein the number of rows of the initialization matrix represents the ring space dimension of the local update graph structure, and the number of columns of the matrix represents the total number of edges in the local update graph structure; Sorting the basic ring candidate set from small to large according to the cumulative sum of all edge weights in each ring to obtain a weight-sorted ring candidate sequence; traversing each ring in the ring candidate sequence to perform a linear correlation test to determine whether the bit vector of the currently traversed ring can be linearly represented by the existing row vectors in the initialization matrix; If it cannot be represented, the bit vector of the currently traversed ring is added to the next empty row of the initialization matrix to obtain the updated matrix; When the number of non-zero rows in the update matrix reaches the dimension of the ring space, the adding process is stopped, and the rings corresponding to the non-zero rows in the update matrix are extracted as linearly independent basic rings to obtain a basic ring set.
[0010] Optionally, in a sixth implementation of the first aspect of the present invention, identifying the validity of each ring in the minimum ring base based on its geometric features and topological features to obtain a validity identification result, and identifying the ring for which the validity identification result indicates validity as a valid room includes: Calculating, for each ring in the minimum ring base, a geometric feature score of area rationality, shape regularity, and internal angle distribution, as well as a topological feature score of vertex degree distribution, to obtain a geometric feature score set and a topological feature score set; Performing a weighted sum calculation on the geometric feature score set and the topological feature score set according to a preset weight coefficient to obtain a validity score value for each ring; Comparing the validity score with a preset threshold, and marking the corresponding ring as valid when the validity score is greater than or equal to the preset threshold, to obtain a validity identification result; A ring marked as valid is extracted from the validity identification result, and the valid ring is identified as a corresponding valid room.
[0011] A second aspect of the present invention provides a valid room identification device, the valid room identification device comprising: A graph structure construction module is used to convert wall elements in the building plan into a set of line segments, and perform intersection detection and topological analysis on the set of line segments to obtain an undirected weighted graph structure representing the connection relationship of the walls; an incremental update module, configured to determine, in response to a user editing operation on the building plan, a corresponding affected area, and incrementally update a graph structure portion corresponding to the affected area in the undirected weighted graph structure to obtain a locally updated graph structure; a ring detection module, configured to apply a minimum ring basis algorithm to the local updated graph structure to perform ring detection processing, and obtain a minimum ring basis containing basic rings in the affected area; The room identification module is used to identify the validity of each ring in the minimum ring base according to the geometric features and topological features of the corresponding ring, obtain a validity identification result, and identify the ring with the validity identification result as valid as a valid room.
[0012] A third aspect of the present invention provides an effective room identification device, comprising: a memory and at least one processor, wherein the memory stores instructions, and the memory and the at least one processor are interconnected via a line; the at least one processor calls the instructions in the memory so that the effective room identification device performs the steps of the above-mentioned effective room identification method.
[0013] A fourth aspect of the present invention provides a computer-readable storage medium, wherein the computer-readable storage medium stores instructions, which, when executed on a computer, enable the computer to execute the steps of the above-mentioned valid room identification method.
[0014] The above-mentioned valid room identification method, device, equipment and storage medium convert the wall elements in the building plan into a set of line segments, perform intersection detection and topological analysis to obtain an undirected weighted graph structure; determine the affected area in response to user editing operations, and incrementally update the affected area to obtain a locally updated graph structure; apply the minimum ring basis algorithm to the locally updated graph structure to perform ring detection processing to obtain a minimum ring basis containing the basic rings in the affected area; identify the validity of the rings based on the geometric and topological features of each ring in the minimum ring basis, and identify the valid rings as valid rooms. Through incremental updates and local processing, the present invention avoids the computational overhead of full reconstruction, significantly improves the computational efficiency and real-time performance of room identification, and is suitable for interactive design scenarios of large and complex building plan views.
[0015] Other features and advantages of the present invention will be described in the following description, and in part will become apparent from the description, or understood by practicing the present invention. The purposes and other advantages of the present invention are realized and obtained by the structures particularly pointed out in the description, claims and drawings.
[0016] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, preferred embodiments are given below and described in detail with reference to the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] Figure 1 Schematic diagram of a first embodiment of a valid room identification method according to an embodiment of the present invention; Figure 2 A schematic diagram of an embodiment of a valid room identification device according to an embodiment of the present invention; Figure 3 FIG. 1 is a schematic diagram of an embodiment of a valid room identification device in an embodiment of the present invention. DETAILED DESCRIPTION
[0018] To make the objectives, technical solutions, and advantages of the embodiments of the present invention more clear, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the embodiments described are only part of the embodiments of the present invention, not all of them. All other embodiments obtained by ordinary technicians in this field based on the embodiments of the present invention without making any creative efforts shall fall within the scope of protection of the present invention.
[0019] The terms "including," "having," and any variations thereof, as used in the embodiments of the present invention are intended to cover non-exclusive inclusions. For example, a process, method, system, product, or device comprising a series of steps or units is not limited to the listed steps or units, but may optionally include other steps or units not listed, or may optionally include other steps or units inherent to the process, method, product, or device.
[0020] To facilitate understanding of this embodiment, an effective room identification method disclosed in an embodiment of the present invention is first introduced in detail. Figure 1 As shown, this method includes the following steps: 101. Convert wall elements in the building plan into a set of line segments, and perform intersection detection and topological analysis on the set of line segments to obtain an undirected weighted graph structure representing wall connection relationships; In one embodiment of the present invention, the process of converting wall elements in a building plan into a line segment set, and performing intersection detection and topological analysis on the line segment set to obtain an undirected weighted graph structure representing the wall connection relationship includes: performing geometric attribute extraction processing on the wall elements in the building plan, and encapsulating the wall elements into a line segment data structure based on the extracted geometric attributes to obtain a line segment set; performing geometric intersection determination and intersection coordinate calculation on any two line segments in the line segment set to obtain an intersection coordinate set containing all intersection position information; dividing each line segment in the line segment set into multiple sub-line segments based on the intersection coordinate set, and merging the intersection coordinate set and the line segment endpoint coordinates of the sub-line segments to remove duplication to obtain a vertex set; performing connection relationship identification processing on adjacent vertices in the vertex set to obtain an edge set, and calculating weight values based on the length of the sub-line segment corresponding to each edge in the edge set and the geometric attribute wall thickness to obtain a weight set; and assembling the vertex set, edge set, and weight set into an undirected weighted graph structure representing the wall connection relationship.
[0021] Specifically, wall elements in a building plan typically contain key data such as their geometric position, dimensional parameters, and material properties. The geometric properties of wall elements primarily include parameters such as starting and ending coordinates, wall thickness, material type, and orientation angle. The system first extracts the geometric properties of each wall element in the building plan. By parsing the data format of architectural design software or directly obtaining user-drawn wall information, it extracts core geometric parameters such as the starting and ending coordinates, as well as the wall thickness. Based on the extracted geometric properties, the system encapsulates each wall element into a line segment data structure, which contains fields such as the starting and ending points, length, thickness, and a unique identifier. The length of the line segment is calculated using the Euclidean distance formula. Each line segment also contains the corresponding wall thickness information. Through this encapsulation method, the originally complex wall elements are simplified into a unified line segment representation, forming a line segment set that contains all wall information, where each line segment represents a specific wall segment.
[0022] Specifically, after the line segment set is constructed, the system needs to perform a geometric intersection judgment on any two line segments in the set to identify the connection relationship between the walls. The geometric intersection judgment adopts a standard line segment intersection algorithm. First, a quick exclusion test is performed to determine whether the enclosing rectangles of the two line segments intersect. If the enclosing rectangles do not intersect, the two line segments must not intersect. For the line segment pairs that pass the quick exclusion test, the system further performs a straddle test to determine whether the two line segments actually intersect by calculating the vector cross product. When it is determined that the two line segments intersect, the system calculates the specific intersection coordinates. The system first calculates the parametric equations of the two straight lines, then solves the parameter values, and finally obtains the precise coordinates of the intersection. By traversing all line segment pairs in the line segment set, the system identifies all intersecting line segment combinations and calculates the corresponding intersection coordinates to form an intersection coordinate set containing all intersection position information, where each intersection represents a specific intersection coordinate.
[0023] Specifically, after obtaining the set of intersection coordinates, the system segments the original line segments according to the intersection positions. For each line segment, the system searches for all intersections on the line segment, and then segments the line segment into multiple sub-segments in the order of the intersection positions on the line segment. The segmentation process ensures that each sub-segment is an independent geometric unit that is not crossed by other line segments. Such segmentation results provide basic edge elements for the subsequent construction of the graph structure. After the sub-segment segmentation is completed, the system extracts the endpoint coordinates of all sub-segments, including the starting point, end point, and intersection coordinates of the original line segment generated by the segmentation. The system merges the intersection coordinate set with the sub-segment endpoint coordinates, and performs deduplication processing to eliminate duplicate coordinate points. Deduplication uses spatial hashing or coordinate comparison to ensure that only one instance of points in the same position is retained. After merging and deduplication, the system obtains a vertex set containing all unique position points. , corresponding to wall intersections or endpoints, where each vertex represents a vertex in the graph structure, corresponding to a wall intersection or endpoint in the building plan.
[0024] Specifically, after the vertex set is determined, the system identifies the connection relationship between adjacent vertices in the vertex set. The identification of the connection relationship is based on the connectivity of the sub-segments, that is, if two vertices are the endpoints of the same sub-segment, then there is a connection relationship between the two vertices. The system traverses all sub-segments, extracts the starting and ending vertices of each sub-segment, establishes the adjacency relationship between the vertices, and forms an edge set representing the connection relationship of the wall. , corresponding to the wall segment, where each edge represents an edge connecting two vertices. For each edge in the edge set, the system calculates a weight value based on the geometric properties of the corresponding sub-segment. Weight function , which can represent wall length, thickness, or other attributes. The specific weight calculation method is determined by the application requirements and can be a function of edge length, wall thickness, or a combination of the two. In this embodiment, the weight function primarily reflects the geometric characteristics of the wall and provides an optimization basis for the subsequent minimum ring basis algorithm. By assigning an appropriate weight value to each edge, the system constructs a complete set of weights, where each weight value corresponds to the weight of an edge.
[0025] Specifically, after constructing the vertex set V, edge set E, and weight set W, the system assembles these three sets into an undirected weighted graph structure G representing the wall connectivity. This graph structure uses a storage method that combines adjacency lists with spatial indexes to support efficient vertex and spatial range queries. The adjacency list structure records the adjacent vertices of each vertex and the weights of the connecting edges, while the spatial index maintains the spatial distribution of vertices and edges through data structures such as quadtrees or R-trees. This storage structure ensures efficient graph operations while supporting the rapid spatial positioning required during subsequent incremental updates.
[0026] 102. In response to the user's editing operation on the building plan, determining a corresponding affected area, and incrementally updating a graph structure portion corresponding to the affected area in the undirected weighted graph structure to obtain a locally updated graph structure; In one embodiment of the present invention, the incremental updating of the graph structure portion corresponding to the affected area in the undirected weighted graph structure to obtain a locally updated graph structure includes: locating the corresponding vertex set and edge set in the undirected weighted graph structure according to the affected area, wherein the affected area is the affected area of the wall directly modified in the building plan and the adjacent wall that produces a new intersection; deleting the vertex set and edge set corresponding to the affected area to obtain an undirected weighted graph structure after local deletion; determining a new wall element according to the user editing operation, converting the new wall element into a new line segment, and performing intersection detection and topological analysis on the new line segment and the edge set of the undirected weighted graph structure after local deletion to obtain a locally updated graph structure.
[0027] Specifically, when a user performs an editing operation on a building plan When the system first needs to accurately locate the affected area of the operation The affected area includes the directly modified wall and any adjacent walls with which it creates new intersections. The affected area is determined using a spatial range analysis method. Based on the user's editing operation type and the location of the affected walls, the system calculates the geometric difference between the wall positions before and after the operation. For wall dragging operations, the system calculates the bounding rectangle of the walls before and after the drag and extends a buffer area to ensure that all potentially intersecting walls are included. For wall addition or deletion operations, the system uses the geometric range of the added or deleted wall as the basis and similarly extends the buffer area to determine the complete affected area. After determining the spatial extent of the affected area, the system locates the corresponding vertex set and edge set in the undirected weighted graph structure G. This location process leverages a previously constructed spatial index structure, allowing for rapid querying of all vertices and edges within the affected area using spatial data structures such as quadtrees or R-trees. The system traverses the relevant nodes of the spatial index and extracts the coordinates of vertices within or intersecting the affected area, forming the affected vertex set. Simultaneously, the system identifies the edges connecting these vertices, as well as all edges whose endpoints lie within the affected area, forming the affected edge set. With the support of spatial index, the time complexity of this query process is kept at a low level, avoiding a comprehensive traversal of the entire graph structure.
[0028] Specifically, after identifying the vertex and edge sets corresponding to the affected area, the system deletes these graph elements in preparation for subsequent incremental updates. The deletion process begins with the edge set. The system traverses the affected edge set, removing the corresponding edge information from the graph's adjacency table one by one. For each edge to be deleted, the system updates the adjacency lists of its two endpoints, removes the edge's connection, and simultaneously deletes the corresponding weight information. After the edge deletion is complete, the system processes the affected vertex set, examining each vertex's degree—that is, the number of edges connected to it. Vertex deletion requires special attention to the handling of isolated vertices. When all connected edges to a vertex are deleted, it becomes an isolated vertex and must be completely removed from the graph. The system checks the remaining degree of each affected vertex. Vertices with a degree of zero are deleted from the vertex set and the corresponding spatial index structure is updated. For vertices that still have connected edges, the system retains them but updates their adjacency information. After the deletion is complete, the system obtains the undirected weighted graph structure after the partial deletion. This structure has gaps within the affected area, ready to be filled with new graph elements.
[0029] Specifically, based on the content of the user's editing operation, the system determines the new wall element configuration. The new wall element contains information such as the newly drawn wall by the user, the position of the wall after dragging, or the modified wall attributes. The system extracts the geometric attributes of the new wall elements and encapsulates the line segment data structure in the same way as the initial graph structure is constructed. For each new wall element, the system extracts its geometric parameters such as the starting coordinates, end coordinates, and wall thickness, and encapsulates these parameters into a standard line segment data structure. The generation process of new line segments strictly follows the original data format specifications to ensure compatibility with the existing graph structure. Each new line segment contains complete geometric information and attribute information, including fields such as line segment length, wall thickness, and unique identifier. The system organizes all newly generated line segments into a new line segment set, which contains all new or modified wall line segments generated by the user's editing operations.
[0030] Specifically, after constructing the new segment set, the system performs intersection detection and topological analysis on the new segments and the edge set of the locally deleted undirected weighted graph. This process is divided into two main phases: intersection detection between new segments and intersection detection between new segments and existing edges. In the intersection detection phase, the system performs geometric intersection detection on any two segments in the new segment set, using the same fast exclusion and straddle tests as used in initial graph construction to identify intersections between the new segments and calculate their precise coordinates. In the intersection detection phase, the system uses a spatial index structure to quickly locate existing edges spatially adjacent to the new segment and then performs intersection detection on these edges with the new segment. The system pays particular attention to existing edges at the boundaries of the affected region, as the intersections of these edges with the new segment will become key nodes connecting the old and new graph structures. The coordinates of all detected intersections are collected in an intersection set, and the system then splits the new segment and its associated existing edges based on these intersections to generate new sub-segments. During the topology analysis and processing phase, the system reconstructs the vertex and edge sets based on the intersection segmentation results. All intersection coordinates, new line segment endpoints, and retained existing vertices are merged into an updated vertex set. Coordinate deduplication is then performed to ensure vertex uniqueness. The system establishes new adjacency relationships, connecting adjacent vertices to form a new edge set, and calculates a corresponding weight for each edge. Weight calculations use the same weight function as the original graph structure, taking into account factors such as edge length and wall thickness. Finally, the system reassembles the updated vertex set, edge set, and weight set to obtain the locally updated graph structure G'.
[0031] Specifically, the entire incremental update process can be described by the mathematical expression of the incremental update operation: , where G represents the original undirected weighted graph structure, ΔG represents the incremental update operation, G' represents the updated graph structure, and ⊕ represents the incremental synthesis operation of the graph structure. is the updated weight function. Incremental update operation ,in , and Represent the vertex sets to be added and deleted, respectively, where , and represents the edge set to be added and deleted, Represents the change in edge weights. Through this incremental update mechanism, the system avoids the computational overhead of full-graph reconstruction, achieves efficient maintenance of the building plan structure, and significantly improves responsiveness during user interaction.
[0032] 103. Apply a minimum ring basis algorithm to the local updated graph structure to perform ring detection processing to obtain a minimum ring basis that includes basic rings in the affected area; In one embodiment of the present invention, the applying of a minimum ring basis algorithm to the local update graph structure to perform ring detection processing to obtain a minimum ring basis containing basic rings in the influence area comprises: performing a depth-first search traversal on the local update graph structure to detect all simple rings in the local update graph structure to obtain a candidate ring set; applying a minimum ring basis algorithm to the candidate ring set to identify basic rings to obtain a basic ring set; spatially screening the basic ring set according to the spatial range of the influence area to determine the inclusion relationship between the vertex coordinates of each basic ring and the influence area to obtain a ring set in the influence area; and selecting linearly independent basic rings from the ring set in the influence area to obtain a minimum ring basis containing the basic rings in the influence area.
[0033] Specifically, when applying cycle detection to a locally updated graph structure, the system first performs a depth-first search (DFS) traversal to detect all simple cycles in the graph. Depth-first search is a graph traversal algorithm that systematically explores the graph structure by recursively visiting vertices. In the context of cycle detection, DFS starts at any vertex in the graph and progressively visits adjacent vertices along edges until a visited vertex is encountered, forming a cycle. The system maintains a visit status for each vertex: unvisited, currently visited, and visited. Simple cycles are identified through state transitions. During simple cycle detection, the system pays special attention to identifying back edges, which connect ancestor vertices to descendant vertices. The presence of such edges signals the formation of a cycle. When a back edge is discovered during the depth-first search traversal, the system backtracks the traversal path to construct a complete cycle structure. The cycle construction process begins at the target vertex of the back edge and traverses the path back up to the starting vertex of the back edge, forming a complete vertex sequence. The system ensures that each detected cycle is simple, meaning that no vertices are repeated and the cycle length is greater than or equal to three vertices. By traversing all connected components in the local update graph structure, the system can identify all simple cycles in the graph and form a set of candidate cycles.
[0034] Specifically, after the candidate ring set is constructed, the system applies the minimum ring basis algorithm to these candidate rings to identify basic rings. The core goal of the minimum ring basis algorithm is to select a set of linearly independent basic rings from the candidate rings so that any other ring can be represented by a linear combination of this set of basic rings. The ring space dimension of the graph G is defined as , where |E| represents the number of edges in the graph G, |V| represents the number of vertices, and effective room identification Valid room identification diagram The number of connected components. The dimension of the ring space determines the number of basic rings in the minimum ring base, that is, the minimum ring base contains μ(G) linearly independent basic rings. The basic ring identification process uses the improved minimum ring base algorithm, which first constructs the shortest path tree for each vertex v in the graph. , where V represents the vertex set of the graph and v represents any vertex in the graph. The shortest path tree is a tree structure consisting of the shortest paths from a specified root vertex to all other vertices in the graph. When the edge weights are non-negative, the system uses the Dijkstra algorithm to construct the shortest path tree. The algorithm gradually determines the shortest distance from the root vertex to each vertex by maintaining a priority queue of vertex distances. The time complexity is , where |E| represents the number of edges and |V| represents the number of vertices. When all edge weights are 1, the system uses the BFS algorithm to construct the shortest path tree. This algorithm determines the shortest path by traversing the levels, and the time complexity is After the shortest path tree is constructed, the system identifies the non-tree edges in the graph, that is, the edges that do not belong to the shortest path tree. For each non-tree edge, a valid room is identified. , constructing a ring for effective room identification , where e represents the non-tree edge connecting vertices u and w, E represents the edge set of the graph, and valid room identification where valid room identification Valid room identification means valid room identification Identify from valid rooms To valid room identification Path to effective room identification, effective room identification Indicates valid room identification Identify from valid rooms arrive The path of effective room identification, ⊕ represents the symmetric difference operation of the path. The algorithm introduces the "light edge priority" strategy, giving priority to non-tree edges with smaller weights to construct rings and form a ring candidate set .
[0035] Specifically, after the ring candidate set is constructed, the system Construct a bit vector of length |E| , where C represents a specific ring in the candidate ring set, and |E| represents the total number of edges in the graph. Bit vector is a binary representation. The i-th component of is defined as: ; in Represents the i-th edge in the graph. This bit vector representation converts the geometric structure of the ring into an algebraic representation, so that the linear combination operation of the ring can be achieved through the XOR operation of the bit vector. The system sorts the candidate rings in ascending order according to the cumulative sum of the weights of all edges in each candidate ring, w(C), where w(C) represents the total weight of ring C. The purpose of weight sorting is to give priority to basic rings with smaller weights when constructing the minimum ring base, so as to obtain the ring base with the smallest total weight. After the sorting is completed, the system applies the incremental Gaussian elimination algorithm to perform linear independence detection. The incremental Gaussian elimination algorithm constructs the dimension The specific steps of incremental Gaussian elimination include: initializing M to an all-zero matrix, B valid room identification to an empty set, and B to represent the currently selected linearly independent ring set. For each ring C (in ascending order of weight), check the valid room identification Can it be linearly represented by the existing row vectors in M? Linear independence is determined using the XOR operation on the GF(2) field, where GF(2) is a finite field containing only two elements, 0 and 1. If it is not representable, then B effective room identification = effective room identification B effective room identification ∪ effective room identification C, and Add to M. Stop when |B| effective room identification = effective room identification μ(G), where |B| represents the number of elements in set B. In this way, the system selects linearly independent basic rings from the candidate ring set to form a basic ring set.
[0036] Specifically, after determining the basic ring set, the system spatially filters the basic rings based on the spatial extent of the influence region to identify those located within the influence region. This spatial filtering process is accomplished by determining the containment relationship between the vertex coordinates of each basic ring and the influence region. The system traverses each ring in the basic ring set, extracts the coordinate information of all vertices within the ring, and then checks whether these vertices are located within the spatial extent of the influence region. This containment relationship is determined using a geometric algorithm. For rectangular influence regions, the system checks whether the vertex coordinates fall within the rectangular boundary; for complex influence regions, the system uses an algorithm that determines whether points are within the polygon. The spatial filtering criteria require that all vertices of a basic ring lie within the influence region or that there is significant spatial overlap between the basic ring and the influence region. The system sets a threshold for spatial overlap. When the proportion of vertices within a basic ring located within the influence region exceeds the threshold, the ring is considered to be within the influence region. Through spatial filtering, the system extracts rings from the basic ring set that are spatially related to the influence region, forming a ring set within the influence region. This filtering process ensures that subsequent ring base construction focuses on the topological structure within the influence region, avoiding interference from ring structures in irrelevant areas. When selecting linearly independent basic rings from the ring set in the influence area, the system applies the linear independence detection algorithm again. Since the ring set in the influence area is a subset of the basic ring set, the rings in it already have the properties of basic rings, and the system focuses on checking the linear independence between these rings. The linear independence detection uses the same incremental Gaussian elimination method as mentioned above, constructing a bit vector matrix on the GF(2) field and performing elimination operations. The system checks the rings in the influence area one by one according to the weight order of the rings, and selects linearly independent rings into the minimum ring basis. When the number of selected rings reaches the ring space dimension of the corresponding subgraph of the influence area, the selection process is completed, and the minimum ring basis containing the basic rings in the influence area is obtained.
[0037] Furthermore, the applying of the minimum ring basis algorithm to the candidate ring set to identify basic rings to obtain the basic ring set includes: using the Dijkstra algorithm or the BFS algorithm to construct a shortest path tree for each vertex in the graph structure corresponding to the candidate ring set to obtain a shortest path tree set; identifying non-tree edges in the locally updated graph structure based on the shortest path tree set, constructing a basic ring for the path between two vertices connected by each non-tree edge in the shortest path tree to obtain a basic ring candidate set; constructing a bit vector representation with a length equal to the number of edges for each ring in the basic ring candidate set to obtain a bit vector set; applying the incremental Gaussian elimination algorithm to the bit vector set to perform linear independence detection to identify linearly independent rings in the basic ring candidate set to obtain a basic ring set.
[0038] Specifically, when applying the minimum cycle basis algorithm to a set of candidate cycles, the system constructs a shortest path tree for each vertex in the graph structure. The algorithm is selected based on the edge weight characteristics: Dijkstra's algorithm is used when edge weights are non-negative, and BFS is used when all edge weights are 1. In architectural floor plans, edge weights typically reflect the geometric characteristics of walls, including a comprehensive consideration of factors such as wall length, thickness, and material density. Weight design directly impacts the quality of the minimum cycle basis. Edges with smaller weights often correspond to primary load-bearing walls or important partitions in the building structure, while edges with larger weights may correspond to minor decorative walls or temporary partitions. During the construction of the shortest path tree, the system maintains a distance label and predecessor pointer for each vertex. The predecessor pointers form a path chain from any vertex back to the root vertex. To optimize storage efficiency, the system uses compressed storage to record the shortest path tree, storing only key path nodes and branch points. Linear path segments are compressed using a start-end point representation. By executing the shortest path algorithm on all vertices, the system obtains a complete set of shortest path trees, which provides an efficient path query basis for subsequent non-tree edge identification and basic cycle construction.
[0039] Specifically, after constructing the shortest path tree set, the system identifies and categorizes non-tree edges in the graph structure. Non-tree edges can be divided into several categories based on the types of vertices they connect: horizontal non-tree edges connecting vertices on the same level, cross-level non-tree edges connecting vertices on different levels, and cross-domain non-tree edges connecting different subtrees. Different categories of non-tree edges have different topological significance. Horizontal non-tree edges typically generate small local loops, while cross-domain non-tree edges may generate large loops spanning multiple rooms. The system sorts these non-tree edges according to the hierarchical depth of their endpoints in the shortest path tree, prioritizing those with lower hierarchical depths, as these edges tend to generate smaller elementary loops. For each non-tree edge, the system constructs an elementary loop using the path information in the shortest path tree. Path extraction utilizes a bidirectional backtracking strategy, simultaneously backtracking from both endpoints of the non-tree edge to the root vertex. This bidirectional backtracking method reduces path length compared to unidirectional backtracking, resulting in more compact elementary loops. The system also implements a "ring quality assessment" mechanism to score the quality of generated candidate rings based on the ring's geometric characteristics such as area, perimeter ratio, and uniformity of vertex distribution, giving priority to retaining candidate rings with higher quality.
[0040] Specifically, after generating a set of basic ring candidates, the system constructs a bit vector representation to support subsequent linear algebra operations. Considering that large building plans may contain thousands of edges, directly storing the complete bit vector consumes a large amount of memory space. The system instead employs a sparse bit vector compression storage strategy, recording only the indices of positions in the bit vector where the value is 1, rather than storing the complete binary sequence. For a ring containing k edges, the compressed storage space is reduced from |E| bits to k integer indices, achieving significant space savings in sparse graph structures. The bit vector index encoding uses a hierarchical encoding scheme, sorting edges according to their importance in the graph structure. Edges in core regions are assigned smaller indices, while edges in peripheral regions are assigned larger indices. This encoding scheme improves cache locality for bit vector operations. The system also implements an incremental bit vector update mechanism. When a local modification occurs in the graph structure, only the bit vectors of the affected rings need to be updated, without recalculating the bit vector representations of all rings. Through these optimizations, the system can efficiently handle ring basis computation tasks for large-scale building plans.
[0041] Specifically, after the bit vector set is constructed, the system performs an incremental Gaussian elimination algorithm to identify linearly independent elementary rings. The algorithm operates on the GF(2) field, and all operations are modulo 2 operations, with addition being equivalent to an XOR operation. The system constructs a dynamic matrix M, which is initially an empty matrix, and then processes candidate rings one by one in ascending order of ring weight. For each newly added ring, the system first checks whether its bit vector can be represented as a linear combination of existing row vectors in the matrix M. This check is achieved by performing a forward elimination operation. The forward elimination process starts from the highest bit of the bit vector and checks whether the current bit is 1 bit by bit. If it is 1, the pivot row of the corresponding column in the matrix M is searched for elimination. The elimination operation is implemented by an XOR operation, which XORs the current bit vector with the pivot row to eliminate the 1 value of the current bit. If the bit vector becomes a zero vector after the elimination process, it means that the ring can be linearly represented by the selected elementary ring and is therefore discarded. If the bit vector still has non-zero bits, it indicates that the ring is linearly independent and is added to the basic ring set. At the same time, its bit vector is added to the matrix M as a new pivot row. The algorithm adopts a dynamic maintenance strategy for the pivot row, maintaining the corresponding pivot row index for each column, so that the elimination operation can quickly locate the relevant pivot row. When the number of rows in the matrix M reaches the dimension of the ring space of the graph, the algorithm terminates. At this time, the basic ring set B contains linearly independent basic rings, forming the minimum ring basis of the graph structure. During the execution of the entire algorithm, the system monitors memory usage and computational complexity to ensure that the basic ring identification task is completed within reasonable time and space constraints, providing high-quality basic ring data for subsequent room validity determination.
[0042] Furthermore, the incremental Gaussian elimination algorithm is applied to the bit vector set to perform linear independence detection, identify linearly independent rings in the basic ring candidate set, and obtain the basic ring set, including: constructing and setting an initialization matrix to zero, wherein the number of matrix rows of the initialization matrix represents the ring space dimension of the local update graph structure, and the number of matrix columns represents the total number of edges in the local update graph structure; sorting the basic ring candidate set from small to large according to the cumulative sum of all edge weights in each ring to obtain a weight-sorted ring candidate sequence; traversing each ring in the ring candidate sequence to perform linear correlation detection to determine whether the bit vector of the currently traversed ring can be linearly represented by the existing row vectors in the initialization matrix; if not, adding the bit vector of the currently traversed ring to the next empty row of the initialization matrix to obtain an update matrix; stopping the addition process when the number of non-zero rows in the update matrix reaches the ring space dimension, and extracting the rings corresponding to the non-zero rows in the update matrix as linearly independent basic rings to obtain a basic ring set.
[0043] Specifically, when applying the incremental Gaussian elimination algorithm to a set of bit vectors for linear independence testing, the system first constructs and zeroes an initialization matrix M, which is stored in a two-dimensional array or sparse matrix data structure. The dimensionality of the initialization matrix directly impacts the algorithm's execution efficiency and space complexity. The number of rows in the matrix is set to the ring space dimension of the local update graph, and the number of columns is set to the total number of edges in the local update graph. Ring space dimension is a key concept in graph theory, representing the maximum number of linearly independent elementary rings in a graph. For a connected graph, this dimension is equal to the number of edges minus the number of vertices plus one. The number of matrix columns corresponds to the position of the bit vector of each edge in the graph, ensuring that the bit vector of each ring can be fully mapped into the matrix column space. Zeroing the initialization matrix ensures that all matrix elements are zero at the beginning of the algorithm. This initial state provides a clean foundation for subsequent incremental updates. The system uses a dynamic memory allocation strategy to create the matrix, adjusting the matrix size based on the actual size of the local update graph to avoid memory waste or space shortages caused by fixed-size matrices. For large-scale graph structures, the system also implements a block matrix storage mechanism, which decomposes large matrices into multiple small blocks for storage and operation, improving the locality of memory access and cache hit rate. The data type selection of the matrix takes into account the characteristics of GF(2) domain operations. Since all operations are modulo 2 operations, the system uses bit operations to optimize storage space and computational efficiency. Each matrix element only requires one binary bit to represent, so a bit vector or compressed bitmap can be used to store the entire matrix. This bit-level storage optimization enables matrix operations to take advantage of the parallel bit operation instructions of modern processors, significantly improving the execution speed of the algorithm. At the same time, the system maintains a mapping table of matrix row and column indices, establishes a correspondence between the matrix position and the actual ring and edge, and ensures that the relevant data elements can be accurately located and operated during the execution of the algorithm.
[0044] Specifically, after the initialization matrix is constructed, the system sorts the basic ring candidate set from smallest to largest based on the cumulative sum of all edge weights within each ring. The edge weight accumulation process traverses each edge within the ring, obtains the edge weight, and sums them to obtain the total ring weight. In architectural floor plans, edge weights typically take into account multiple factors, such as wall length, thickness, and material properties. Rings with smaller weights often correspond to core areas or important functional spaces within the building structure. The choice of sorting algorithm directly impacts overall performance. For medium-sized ring candidate sets, the system uses a quick sort algorithm, while for large sets, external sorting or distributed sorting strategies are employed. During the sorting process, the system maintains the original index information of the rings to ensure that their positions in the original candidate set can still be traced after sorting. This index maintenance mechanism is implemented by constructing a mapping table before and after sorting, which records the correspondence between each ring's original position and its position after sorting. The sorting operation generates a weighted sequence of ring candidates, which is arranged from smallest to largest in terms of total weight, prioritizing processing and selection of rings with smaller weights. The weighted sorting strategy embodies the principle of a greedy algorithm, prioritizing rings with smaller weights as basic ring candidates, thereby constructing a ring base with the smallest total weight. This strategy is of great significance in practical applications, as rings with smaller weights often correspond to compact areas or important rooms in building plans. Accurately identifying these areas is highly valuable for architectural spatial analysis. The system also implements a secondary sorting rule for cases of equal weights. When multiple rings have the same total weight, they are sorted by the number of edges in the rings, with rings with fewer edges prioritized. This results in a more concise basic ring structure.
[0045] Specifically, after the weight sorting is completed, the system traverses each ring in the ring candidate sequence and performs a linear correlation test on each ring to determine whether it can be linearly represented by the selected basic ring. Linear correlation test is the core operation of the incremental Gaussian elimination algorithm, which is implemented by performing matrix operations on the GF(2) field. During the execution of the matrix update operation, the system continuously monitors the changes in the number of non-zero rows in the update matrix. The number of non-zero rows represents the number of linearly independent basic rings currently selected. When this number reaches the ring space dimension, the system stops adding new rings to the matrix. The ring space dimension represents the maximum possible number of linearly independent basic rings in the graph structure. Reaching this number means that a complete minimum ring basis has been constructed. The termination condition is determined by a real-time counting mechanism. Each time a new row is added to the matrix, the system increases the non-zero row counter by 1 and then compares it with the preset ring space dimension. When the termination condition is met, the system begins to extract the rings corresponding to the non-zero rows in the update matrix as linearly independent basic rings. The extraction process is implemented by traversing all rows of the matrix. For each non-zero row, the system determines the original ring corresponding to the row based on the previously maintained index mapping table. These primitive rings form the final basic ring set, which encompasses all linearly independent basic rings in the graph structure and satisfies the mathematical definition of a minimum ring basis. The construction of the basic ring set completes the complete transformation process from geometric topology to algebraic representation and then to optimization selection. Each ring selected into the basic ring set is linearly independent, and any other ring can be represented by a linear combination of these basic rings. The system also constructs metadata information for the basic ring set, including attribute information such as the weight of each basic ring, the number of edges it contains, and the spatial area it covers. This metadata provides rich reference information for subsequent room identification and spatial analysis, enabling the algorithm to select appropriate basic rings for room boundary construction and validity verification based on different application requirements.
[0046] 104. Identify the validity of each ring in the minimum ring base according to its geometric features and topological features to obtain a validity identification result, and identify the ring with a valid validity identification result as a valid room.
[0047] In one embodiment of the present invention, the method of identifying the validity of the corresponding ring based on the geometric features and topological features of each ring in the minimum ring base to obtain a validity identification result, and identifying the ring with the validity identification result as valid as a valid room includes: calculating the geometric feature score of area rationality, shape regularity and internal angle distribution, and the topological feature score of vertex degree distribution for each ring in the minimum ring base to obtain a geometric feature score set and a topological feature score set; performing weighted sum calculation on the geometric feature score set and the topological feature score set according to a preset weight coefficient to obtain a validity score value for each ring; comparing the validity score value with a preset threshold value, and marking the corresponding ring as valid when the validity score value is greater than or equal to the preset threshold value to obtain a validity identification result; extracting the ring marked as valid from the validity identification result, and identifying the valid ring as the corresponding valid room.
[0048] Specifically, when identifying the validity of the corresponding ring based on the geometric features of each ring in the minimum ring base, the system first calculates the geometric feature scores of area rationality, shape regularity and internal angle distribution for each ring. Area rationality score This is achieved by calculating the area of the polygon enclosed by the ring and comparing it with the reasonable area range. Rings with too small an area are considered corridors or aisles, while rings with too large an area are considered unreasonable space divisions. The scoring uses a piecewise linear function to map the area value to the interval [0,1], so that rings within the ideal area range receive a higher score. Shape regularity scoring The main evaluation indicators are the convexity and rectangularity of the ring. The convexity evaluation is calculated by detecting whether the ring is a convex polygon. The system traverses each vertex in the ring and calculates the turning angle formed by three consecutive vertices. If the directions of all turning angles are consistent, it is determined to be a convex polygon. The rectangularity evaluation is measured by calculating the area ratio of the ring to its minimum circumscribed rectangle. The closer the area ratio is to 1, the closer the shape is to a rectangle. The system also calculates the aspect ratio of the ring. A moderate aspect ratio can obtain a higher shape regularity score. Internal angle distribution score The system analyzes the internal angle characteristics of each vertex in the ring, favoring a distribution pattern that favors right angles or regular angles. The system traverses each vertex in the ring, calculates the number of internal angles formed by two adjacent edges, and counts the proportion of angles close to regular angles such as 90 degrees, 180 degrees, and 270 degrees. A higher proportion indicates a better geometric regularity of the room. The system also calculates the variance of the internal angle distribution to quantify the regularity of the angle distribution. A distribution with a smaller variance and a higher concentration of angles near regular angles receives a higher score.
[0049] Specifically, after the geometric feature scoring is completed, the system calculates the topological feature scoring , the rationality of the topological structure of the ring is evaluated by analyzing the vertex degree distribution. According to the room effectiveness judgment model, the system prefers vertices with degrees of 2 or 4, because these degree values correspond to common wall connection patterns in buildings. Vertices with degree 2 usually appear in straight segments of walls, and vertices with degree 4 usually appear at the intersection of walls. The system counts the proportion of vertices with degrees of 2 and 4 in the ring. The higher the proportion of these two types of vertices, the more the topological structure of the ring conforms to the characteristics of a typical room. The system performs a weighted sum calculation on the geometric feature score set and the topological feature score set according to the preset weight coefficient. According to the room effectiveness judgment model, the effectiveness scoring function is defined as , where α, β, γ, and δ are weight coefficients, satisfying The design of the weight coefficients reflects the importance of different features in determining room validity. Generally, area rationality and shape regularity have higher weights. For residential buildings, the area rationality weight α is usually set between 0.3 and 0.4, the shape regularity weight β is set between 0.25 and 0.35, and the internal angle distribution weight γ and vertex degree distribution weight δ are set between 0.15 and 0.25 respectively. During the weighted summation calculation process, the system ensures that all score values have been standardized to the [0,1] interval, making the scores of different features comparable. The final validity score value fvalid(C) reflects the comprehensive possibility of the ring as a valid room. The higher the score, the more the ring meets the characteristics of a valid room. In this embodiment, wall elements in a building plan are converted into a set of line segments, and intersection detection and topological analysis are performed to obtain an undirected weighted graph structure. In response to user editing operations, the affected area is determined, and the affected area is incrementally updated to obtain a locally updated graph structure. A minimum ring basis algorithm is applied to the locally updated graph structure to perform ring detection, obtaining a minimum ring basis containing the basic rings within the affected area. The validity of the rings is identified based on the geometric and topological features of each ring in the minimum ring basis, and valid rings are identified as valid rooms. Through incremental updates and local processing, this invention avoids the computational overhead of full reconstruction, significantly improving the computational efficiency and real-time performance of room identification, and is suitable for interactive design scenarios involving large and complex building plans.
[0050] Specifically, after the effectiveness score is calculated, the system compares the score of each ring with the preset threshold τ. , ring C is determined to be a valid room. The preset threshold τ is usually set between 0.6 and 0.8, and the specific value is adjusted according to the accuracy requirements of the application scenario. If the threshold is set too low, too many invalid rings will be mistakenly identified as valid rooms. If the threshold is set too high, some valid rooms will be mistakenly excluded. The comparison and judgment process performs a threshold test on the validity score value of each ring. When the validity score value is greater than or equal to the preset threshold, the system marks the corresponding ring as valid, otherwise it is marked as invalid. The marking result constitutes the validity identification result, which contains the validity label and corresponding score value of each ring. When extracting the ring marked as valid from the validity identification result, the system establishes a correspondence between the valid ring and the room entity, assigns a unique room identifier to each valid ring, and constructs room attribute information, including geometric attributes such as area, perimeter, shape parameters, and topological attributes such as connectivity. The final set of valid rooms identified constitutes all room areas that meet the validity conditions in the building floor plan.
[0051] Specifically, after identifying a valid room, the building indicators of the room can be calculated, including the following: 1. Geometric ring area: ; in For the ring Middle The coordinates of the vertices, .
[0052] 2. Usable area: Considering the influence of wall thickness, define: ; in Represents an edge Corresponding to the thickness of the wall, Represents an edge length.
[0053] 3. Building area: Considering the exterior wall outline, define: in Represents a collection of exterior wall edges.
[0054] 4. Floor space ratio: defined as the ratio of usable area to building area: 5. Determining the gross floor area: defining the function , determine whether to include it in the floor area ratio based on the room type and attributes: 6. Common wall area ratio: defined as the ratio of wall area shared with adjacent rooms to total wall area: in Represents a set of shared wall edges.
[0055] 7. Spatial compactness: defined as the ratio of the square of the ring perimeter to the area, normalized to: in Representation ring circumference. , if and only if For a circle, the minimum value is 1.
[0056] All calculation results are displayed in real time through a visual interface and support historical version comparison, helping designers to intuitively understand the impact of design changes on various indicators.
[0057] In this embodiment, wall elements in a building plan are converted into a set of line segments, and intersection detection and topological analysis are performed to obtain an undirected weighted graph structure. In response to user editing operations, the affected area is determined, and the affected area is incrementally updated to obtain a locally updated graph structure. A minimum ring basis algorithm is applied to the locally updated graph structure to perform ring detection, obtaining a minimum ring basis containing the basic rings within the affected area. The validity of rings is identified based on the geometric and topological features of each ring in the minimum ring basis, and valid rings are identified as valid rooms. Through incremental updates and local processing, this invention avoids the computational overhead of full reconstruction, significantly improving the computational efficiency and real-time performance of room identification, and is suitable for interactive design scenarios involving large and complex building plans.
[0058] The above describes the effective room identification method in the embodiment of the present invention. The following describes the effective room identification device in the embodiment of the present invention. Figure 2 In one embodiment of the present invention, an effective room identification device includes: A graph structure construction module 201 is used to convert wall elements in the building plan into a set of line segments, and perform intersection detection and topological analysis on the set of line segments to obtain an undirected weighted graph structure representing the connection relationship of the walls; The incremental update module 202 is configured to determine the corresponding affected area in response to the user's editing operation on the building plan, and incrementally update the graph structure portion corresponding to the affected area in the undirected weighted graph structure to obtain a locally updated graph structure; A ring detection module 203 is configured to perform ring detection processing on the local updated graph structure by applying a minimum ring basis algorithm to obtain a minimum ring basis containing basic rings in the affected area; The room identification module 201 is configured to identify the validity of each ring in the minimum ring base according to its geometric and topological features, obtain a validity identification result, and identify the ring with a valid validity identification result as a valid room.
[0059] In an embodiment of the present invention, the effective room identification device runs the above-mentioned effective room identification method. The effective room identification device converts the wall elements in the building plan into a set of line segments, performs intersection detection and topological analysis to obtain an undirected weighted graph structure; determines the affected area in response to the user's editing operation, and incrementally updates the affected area to obtain a locally updated graph structure; applies the minimum ring basis algorithm to the locally updated graph structure to perform ring detection processing to obtain a minimum ring basis containing basic rings in the affected area; identifies the validity of the ring based on the geometric features and topological features of each ring in the minimum ring basis, and identifies the valid ring as a valid room. The present invention avoids the computational overhead of full reconstruction through incremental updates and local processing, significantly improves the computational efficiency and real-time performance of room identification, and is suitable for interactive design scenarios of large and complex building plan views.
[0060] above Figure 2 The effective room identification apparatus in the embodiment of the present invention is described in detail from the perspective of modular functional entities. The effective room identification device in the embodiment of the present invention is described in detail from the perspective of hardware processing.
[0061] Figure 3 Figure 3 is a schematic diagram of the structure of an effective room identification device provided by an embodiment of the present invention. The effective room identification device 300 may vary significantly depending on configuration or performance. It may include one or more central processing units (CPUs) 310 (e.g., one or more processors), memory 320, and one or more storage media 330 (e.g., one or more mass storage devices) storing applications 333 or data 332. The memory 320 and storage media 330 may be either transient or persistent storage. The program stored in the storage medium 330 may include one or more modules (not shown), each of which may include a series of instructions for operating on the effective room identification device 300. Furthermore, the processor 310 may be configured to communicate with the storage medium 330, executing the series of instructions stored in the storage medium 330 on the effective room identification device 300 to implement the steps of the above-described effective room identification method.
[0062] The effective room identification device 300 may further include one or more power supplies 340, one or more wired or wireless network interfaces 350, one or more input and output interfaces 360, and / or one or more operating systems 331, such as Windows Server, Mac OS X, Unix, Linux, FreeBSD, etc. It will be understood by those skilled in the art that Figure 3 The structure of the effective room recognition device shown does not constitute a limitation on the effective room recognition device provided by the present invention, and may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently.
[0063] The present invention also provides a computer-readable storage medium, which may be a non-volatile computer-readable storage medium or a volatile computer-readable storage medium. The computer-readable storage medium stores instructions, which, when executed on a computer, enable the computer to execute the steps of the effective room identification method.
[0064] Those skilled in the art will clearly understand that, for the convenience and brevity of description, the specific working processes of the above-described systems, devices, and units can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0065] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the portion that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions for enabling a computer device (which can be a personal computer, server, or network device, etc.) to execute all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes various media that can store program code, such as a USB flash drive, a mobile hard drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.
[0066] As described above, the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the above embodiments, those skilled in the art should understand that the technical solutions described in the above embodiments can still be modified, or some of the technical features thereof can be replaced by equivalents. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. An effective room identification method, characterized in that: The effective room identification method includes: Converting wall elements in the building plan into a set of line segments, and performing intersection detection and topological analysis on the set of line segments to obtain an undirected weighted graph structure representing the connection relationship of the walls; In response to a user editing operation on the building plan, determining a corresponding affected area, and incrementally updating a graph structure portion corresponding to the affected area in the undirected weighted graph structure to obtain a locally updated graph structure; Applying a minimum ring basis algorithm to the local updated graph structure to perform ring detection processing to obtain a minimum ring basis that includes basic rings in the affected area; The validity of each ring in the minimum ring base is identified according to its geometric features and topological features to obtain a validity identification result, and the ring whose validity identification result is valid is identified as a valid room.
2. The effective room identification method according to claim 1, characterized in that The step of converting the wall elements in the building plan into a set of line segments, and performing intersection detection and topological analysis on the set of line segments to obtain an undirected weighted graph structure representing the connection relationship of the walls includes: Extracting geometric attributes of wall elements in the building plan, encapsulating the wall elements into a line segment data structure based on the extracted geometric attributes, and obtaining a line segment set; Performing geometric intersection determination and intersection coordinate calculation on any two line segments in the line segment set to obtain an intersection coordinate set containing position information of all intersection points; Dividing each line segment in the line segment set into a plurality of sub-line segments according to the intersection coordinate set, and merging the intersection coordinate set and the line segment endpoint coordinates of the sub-line segments to remove duplicates, thereby obtaining a vertex set; Performing connection relationship identification processing on adjacent vertices in the vertex set to obtain an edge set, and calculating a weight value according to the length of a sub-line segment corresponding to each edge in the edge set and the thickness of a geometric attribute wall to obtain a weight set; The vertex set, edge set and weight set are assembled into an undirected weighted graph structure representing the wall connection relationship.
3. The effective room identification method according to claim 1, characterized in that: The incrementally updating the graph structure portion corresponding to the impact area in the undirected weighted graph structure to obtain a locally updated graph structure includes: Locating a corresponding vertex set and edge set in an undirected weighted graph structure according to the influence area, wherein the influence area is the influence area of the wall directly modified in the building plan and the adjacent wall that generates a new intersection; Deleting the vertex set and edge set corresponding to the affected area to obtain an undirected weighted graph structure after local deletion; New wall elements are determined according to the user editing operation, the new wall elements are converted into new line segments, and intersection detection and topology analysis are performed on the new line segments and the edge set of the undirected weighted graph structure after the local deletion to obtain a local updated graph structure.
4. The effective room identification method according to claim 1, characterized in that: The applying of the minimum ring basis algorithm to the local updated graph structure to perform ring detection processing to obtain the minimum ring basis containing the basic rings in the affected area comprises: Performing a depth-first search traversal on the local update graph structure to detect all simple cycles in the local update graph structure and obtain a candidate cycle set; Applying a minimum ring basis algorithm to the candidate ring set to identify basic rings to obtain a basic ring set; Performing spatial screening on the basic ring set according to the spatial range of the influence area, determining the inclusion relationship between the vertex coordinates of each basic ring and the influence area, and obtaining the ring set within the influence area; Linearly independent basic rings are selected from the ring set within the influence area to obtain a minimum ring base containing the basic rings within the influence area.
5. The effective room identification method according to claim 4, characterized in that: The applying the minimum ring basis algorithm to the candidate ring set to identify the basic rings to obtain the basic ring set includes: Use Dijkstra algorithm or BFS algorithm to construct a shortest path tree for each vertex in the graph structure corresponding to the candidate ring set to obtain a shortest path tree set; Identify non-tree edges in the local update graph structure according to the shortest path tree set, construct a basic ring for each path between two vertices connected by the non-tree edge in the shortest path tree, and obtain a basic ring candidate set; constructing a bit vector representation with a length equal to the number of edges for each ring in the basic ring candidate set to obtain a bit vector set; An incremental Gaussian elimination algorithm is applied to the bit vector set to perform linear independence detection, and linearly independent rings in the basic ring candidate set are identified to obtain a basic ring set.
6. The effective room identification method according to claim 5, characterized in that: The applying of the incremental Gaussian elimination algorithm to the bit vector set to perform linear independence detection, identifying linearly independent rings in the basic ring candidate set, and obtaining the basic ring set includes: Constructing and setting an initialization matrix to zero, wherein the number of rows of the initialization matrix represents the ring space dimension of the local update graph structure, and the number of columns of the matrix represents the total number of edges in the local update graph structure; Sorting the basic ring candidate set from small to large according to the cumulative sum of all edge weights in each ring to obtain a weight-sorted ring candidate sequence; traversing each ring in the ring candidate sequence to perform a linear correlation test to determine whether the bit vector of the currently traversed ring can be linearly represented by the existing row vectors in the initialization matrix; If it cannot be represented, the bit vector of the currently traversed ring is added to the next empty row of the initialization matrix to obtain the updated matrix; When the number of non-zero rows in the update matrix reaches the dimension of the ring space, the adding process is stopped, and the rings corresponding to the non-zero rows in the update matrix are extracted as linearly independent basic rings to obtain a basic ring set.
7. The effective room identification method according to claim 1, characterized in that: The identifying the validity of each ring in the minimum ring base according to the geometric features and topological features of the corresponding ring to obtain a validity identification result, and identifying the ring with the validity identification result as valid as a valid room includes: Calculating, for each ring in the minimum ring base, a geometric feature score of area rationality, shape regularity, and internal angle distribution, as well as a topological feature score of vertex degree distribution, to obtain a geometric feature score set and a topological feature score set; Performing a weighted sum calculation on the geometric feature score set and the topological feature score set according to a preset weight coefficient to obtain a validity score value for each ring; Comparing the validity score with a preset threshold, and marking the corresponding ring as valid when the validity score is greater than or equal to the preset threshold, to obtain a validity identification result; A ring marked as valid is extracted from the validity identification result, and the valid ring is identified as a corresponding valid room.
8. An effective room identification device, characterized in that: The effective room identification device comprises: A graph structure construction module is used to convert wall elements in the building plan into a set of line segments, and perform intersection detection and topological analysis on the set of line segments to obtain an undirected weighted graph structure representing the connection relationship of the walls; an incremental update module, configured to determine, in response to a user editing operation on the building plan, a corresponding affected area, and incrementally update a graph structure portion corresponding to the affected area in the undirected weighted graph structure to obtain a locally updated graph structure; a ring detection module, configured to apply a minimum ring basis algorithm to the local updated graph structure to perform ring detection processing, and obtain a minimum ring basis containing basic rings in the affected area; The room identification module is used to identify the validity of each ring in the minimum ring base according to the geometric features and topological features of the corresponding ring, obtain a validity identification result, and identify the ring with the validity identification result as valid as a valid room.
9. An effective room identification device, characterized in that The effective room identification device includes: a memory and at least one processor, wherein the memory stores instructions; The at least one processor calls the instructions in the memory to enable the active room identification device to perform the steps of the active room identification method according to any one of claims 1 to 7.
10. A computer-readable storage medium having instructions stored thereon, characterized in that: When the instructions are executed by a processor, the steps of the valid room identification method according to any one of claims 1 to 7 are implemented.
Citation Information
Cited By
Geometric topology updating method and device and storage medium
CN120951410A
Hotel guest room number ratio optimization method combining room obtaining rate dynamic state and building area parameter
CN121413842A
Virtual building framework generation method and system
CN122289542A