A rectangle splitting method and system for architectural drawings
By using polygon corners to create split lines in architectural drawings, rectangle splitting and merging are automatically completed, and the problem of time-consuming and poor accuracy of traditional methods is solved, achieving efficient and accurate rectangle splitting effect.
Patent Information
- Application Number
- CN202310941181.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-07-28
- Publication Date
- 2025-04-18
- Estimated Expiration
- 2043-07-28
AI Technical Summary
The rectangular splitting method of traditional architectural drawings relies on manual judgment and rotation drag, which is time-consuming and the accuracy of the results is difficult to guarantee.
By obtaining the polygon outline in the architectural drawings, using the corners of the polygon to create a split line, completing the splitting of the smallest rectangle, and combining the rectangles according to preset requirements to obtain the final room outline.
The automation of rectangular splitting is achieved, which improves the accuracy and efficiency of results and reduces the workload of staff.
Smart Images

Figure CN116862939B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of architectural drawing processing, and more specifically, relates to a method and system for rectangle splitting of architectural drawings. Background Art
[0002] In the field of architectural design and engineering, drawings are an important tool for recording building design plans and construction details. In order to carry out detailed design and construction plans, architectural drawings usually contain multiple irregularly shaped areas, such as rooms, corridors, doors and windows, etc. However, in some applications and requirements, these irregular areas need to be split into simpler and regular shapes, such as rectangles, so as to facilitate analysis, measurement, marking, modularization and other operations.
[0003] The traditional method of splitting rectangles in architectural drawings is usually based on manual judgment and rotation and dragging. This method requires a lot of time and manpower, and the accuracy of the results is difficult to guarantee. Summary of the invention
[0004] To solve the above problems, the object of the present invention is to provide a method and system for rectangle splitting of architectural drawings.
[0005] A rectangle splitting method for architectural drawings, comprising:
[0006] Step 1: Get the polygons that make up the room outline in the architectural drawing;
[0007] Step 2: Using the corner points of the polygon to establish a split line;
[0008] Step 3: Complete the splitting of all minimum rectangles according to the splitting line;
[0009] Step 4: Merge the smallest rectangles according to the preset splitting requirements to obtain the split room outline.
[0010] Preferably, the step 2: establishing a split line using corner points of a polygon includes:
[0011] Step 2.1: Select a corner point on the polygon, and establish two straight lines in the horizontal direction and the vertical direction with the corner point as the center;
[0012] Step 2.2: Traverse the line segments formed by other corner points that are not adjacent to the corner point, and find all intersection points with the two straight lines established in the horizontal direction and the vertical direction;
[0013] Step 2.3: Split the line segment where the intersection point is located to obtain a first node and a second node, and respectively connect the first node, the second node and the corner point with the intersection point as the starting point to form a split line;
[0014] Step 2.4: Return to step 2.1 until all corner points on the polygon are traversed and all split lines are obtained.
[0015] Preferably, the step 3: completing the splitting of all minimum rectangles according to the splitting line includes:
[0016] Step 3.1: Take the split line and the line segments consisting of the corner points on the polygon as the baseline set;
[0017] Step 3.2: taking an endpoint of any one end of a baseline in the baseline set as the first endpoint and the endpoint of the other end as the second endpoint;
[0018] Step 3.3: When the second endpoint is above the first endpoint, search for a corner point to the right of the second endpoint as the third endpoint, and search for a corner point below the third endpoint as the fourth endpoint;
[0019] Step 3.4: When the second endpoint is below the first endpoint, search for a corner point on the left of the second endpoint as the third endpoint, and search for a corner point above the third endpoint as the fourth endpoint;
[0020] Step 3.5: When the second endpoint is to the left of the first endpoint, search for a corner point above the second endpoint as the third endpoint, and search for a corner point to the right of the third endpoint as the fourth endpoint;
[0021] Step 3.6: When the second endpoint is to the right of the first endpoint, search for a corner point below the second endpoint as the third endpoint, and search for a corner point to the left of the third endpoint as the fourth endpoint;
[0022] Step 3.7: The rectangle formed by the first endpoint, the second endpoint, the third endpoint and the fourth endpoint is taken as the minimum rectangle;
[0023] Step 3.8: Traverse all baselines in the baseline set to find all minimum rectangles.
[0024] Preferably, the step 4: merging the minimum rectangles according to the preset splitting requirements to obtain the split room outline includes:
[0025] When horizontal merging is required, check whether other minimum rectangles have a common horizontal edge with the current minimum rectangle. If so, merge the corresponding rectangles to obtain a horizontally merged rectangle.
[0026] Preferably, the step 4: merging the minimum rectangles according to the preset splitting requirements to obtain the split room outline also includes:
[0027] When vertical merging is required, check whether other minimum rectangles have a common vertical edge with the current minimum rectangle. If so, merge the corresponding rectangles to obtain a vertically merged rectangle.
[0028] The present invention also provides a rectangle splitting system for architectural drawings, comprising:
[0029] A data acquisition module, used to acquire polygons constituting room outlines in architectural drawings;
[0030] A split line construction module, used to establish a split line using the corner points of the polygon;
[0031] A splitting module, used for completing the splitting of all minimum rectangles according to the splitting lines;
[0032] The merging module is used to merge the minimum rectangles according to the preset splitting requirements to obtain the split room outline.
[0033] The present invention also provides an electronic device, comprising a bus, a transceiver, a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the transceiver, the memory, and the processor are connected via the bus, and wherein the computer program, when executed by the processor, implements the steps in the above-mentioned method for splitting rectangles in architectural drawings.
[0034] The present invention also provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the steps in the above-mentioned method for splitting rectangles of architectural drawings.
[0035] The beneficial effect of a rectangle splitting method for architectural drawings provided by the present invention is that: compared with the prior art, the present invention completes the splitting of each rectangle through splitting lines. Not only is the algorithm simple and easy to implement, but the splitting result is also highly accurate, which can help staff automatically complete the division of room outlines and effectively reduce the workload of staff. BRIEF DESCRIPTION OF THE DRAWINGS
[0036] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0037] Figure 1 A flow chart of a rectangle splitting method for architectural drawings provided by an embodiment of the present invention;
[0038] Figure 2A schematic diagram of a room outline provided by an embodiment of the present invention;
[0039] Figure 3 An undirected graph of room outlines provided by an embodiment of the present invention;
[0040] Figure 4 A schematic diagram of intersection calculation provided by an embodiment of the present invention;
[0041] Figure 5 A schematic diagram of the split line provided in the embodiment of the present invention;
[0042] Figure 6 A schematic diagram of rectangle splitting preprocessing provided by an embodiment of the present invention;
[0043] Figure 7 A schematic diagram of a rectangle splitting principle provided by an embodiment of the present invention; wherein the left figure is a schematic diagram of a rectangle splitting process, and the right figure is a schematic diagram of a rectangle splitting completion;
[0044] Figure 8 A horizontal merging effect diagram provided by an embodiment of the present invention;
[0045] Fig. 9 This is a diagram of the vertical merging effect provided by an embodiment of the present invention. Implementation
[0046] In order to make the technical problems, technical solutions and beneficial effects to be solved by the present invention more clearly understood, the present invention is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention.
[0047] To achieve the above object, the technical solution adopted by the present invention is:
[0048] See also Figure 1 , a rectangle splitting method for architectural drawings, comprising:
[0049] Step 1: Get the polygons that make up the room outline in the architectural drawing;
[0050] Step 2: Using the corner points of the polygon to establish a split line;
[0051] Furthermore, the step 2 comprises:
[0052] Step 2.1: Select a corner point on the polygon, and establish two straight lines in the horizontal direction and the vertical direction with the corner point as the center;
[0053] Step 2.2: Traverse the line segments formed by other corner points that are not adjacent to the corner point, and find all intersection points with the two straight lines established in the horizontal direction and the vertical direction;
[0054] Step 2.3: Split the line segment where the intersection point is located to obtain a first node and a second node, and respectively connect the first node, the second node and the corner point with the intersection point as the starting point to form a split line;
[0055] Step 2.4: Return to step 2.1 until all corner points on the polygon are traversed and all split lines are obtained.
[0056] Step 3: Complete the splitting of all minimum rectangles according to the splitting line;
[0057] Furthermore, the step 3 comprises:
[0058] Step 3.1: Take the split line and the line segments consisting of the corner points on the polygon as the baseline set;
[0059] Step 3.2: taking an endpoint of any one end of a baseline in the baseline set as the first endpoint and the endpoint of the other end as the second endpoint;
[0060] Step 3.3: When the second endpoint is above the first endpoint, search for a corner point to the right of the second endpoint as the third endpoint, and search for a corner point below the third endpoint as the fourth endpoint;
[0061] Step 3.4: When the second endpoint is below the first endpoint, search for a corner point on the left of the second endpoint as the third endpoint, and search for a corner point above the third endpoint as the fourth endpoint;
[0062] Step 3.5: When the second endpoint is to the left of the first endpoint, search for a corner point above the second endpoint as the third endpoint, and search for a corner point to the right of the third endpoint as the fourth endpoint;
[0063] Step 3.6: When the second endpoint is to the right of the first endpoint, search for a corner point below the second endpoint as the third endpoint, and search for a corner point to the left of the third endpoint as the fourth endpoint;
[0064] Step 3.7: The rectangle formed by the first endpoint, the second endpoint, the third endpoint and the fourth endpoint is taken as the minimum rectangle;
[0065] Step 3.8: Traverse all baselines in the baseline set to find all minimum rectangles.
[0066] Step 4: Merge the smallest rectangles according to the preset splitting requirements to obtain the split room outline.
[0067] Further, the step 4 comprises:
[0068] When horizontal merging is required, check whether other minimum rectangles have a common horizontal edge with the current minimum rectangle. If so, merge the corresponding rectangles to obtain a horizontally merged rectangle.
[0069] When vertical merging is required, check whether other minimum rectangles have a common vertical edge with the current minimum rectangle. If so, merge the corresponding rectangles to obtain a vertically merged rectangle.
[0070] The above-mentioned method for splitting rectangles of architectural drawings of the present invention is further described below in conjunction with specific embodiments:
[0071] Please refer to Figure 2 , the construction of this graph in the computer is an undirected graph. The nodes of the undirected graph are the corner points or edges of the contour. Side and node are connected to each other at intervals. The node format is as follows:
[0072] ```C++
[0073] struct side
[0074] {
[0075] struct node* round_node[2]; / / Two nodes on this edge
[0076] bool flag; / / Flag used in subsequent algorithms
[0077] }
[0078] struct node
[0079] {
[0080] struct side* round_side[4]; / / Other sides adjacent to this corner point. There are at most four sides adjacent to this corner point. If there are less than four, the extra elements are set to nullptr()
[0081] double x; / / x coordinate of this corner point
[0082] double y; / / y coordinate of this corner point
[0083] };
[0084] Please refer to Figure 3 , each circle in the figure is a node, and the line represents the side. For the convenience of representation, the node exclusion position is known to the original graph, but in the actual program, the nodes have no relative position, only connection relationship.
[0085] 1. The first step of splitting is to establish the splitting line, that is, to determine where to split. The steps to establish the splitting line are as follows:
[0086] Please refer to Figure 4 , choose a corner point on the edge of the contour, such as Figure 4 From the middle node, establish two horizontal and vertical lines, traverse the line segments formed by other nodes that are not adjacent to the above node, and find all intersections.
[0087] The vertical line is L1, the horizontal line is L2, and there is an intersection point on L1 and L2, called P1 and P2. Create two nodes, P1 and P2, and insert them into the undirected graph according to the following steps (this embodiment takes P1 as an example):
[0088] 1. Delete the side whose nodes at both ends of the line segment where P1 is located point to the middle, that is, disconnect the first and second nodes;
[0089] 2. Create three new sides and connect P1, the first node, and the second node.
[0090] 3. After operating all corner points, the split line is established. Figure 5 .
[0091] 2. Rectangle Splitting
[0092] like Figure 6 As shown, the flag position of all side nodes is false. White side means it has not been split, and red side means it has been split. In the subsequent description, white means flag=false, and red means flag=true:
[0093] Choose a white (unsplit line) side as the baseline, select a node at either end of the baseline as node1, and another node as node2, and perform the following operations based on the relative positions of node1 and node2:
[0094] * Node2 is above node1: find the corner point to the right of node2 as node3, find the corner point below node3 as node4, and set the sides between the four nodes to red, which means they have been split (in actual applications, they can be other colors. For the convenience of description, the present invention sets the split lines to red)
[0095] * node2 is below node1: find the corner point on the left of node2 as node3, find the corner point above node3 as node4, and set the sides between the four nodes to red.
[0096] * node2 is to the left of node1: find the corner point above node2 as node3, find the corner point to the right of node3 as node4, and set the sides between the four nodes to red.
[0097] * node2 is to the right of node1: find the corner point below node2 as node3, find the corner point to the left of node3 as node4, and set the sides between the four nodes to red.
[0098] At this point, nodes 1-4 form a rectangle. Repeat this step until all sides are red, and all rectangles are found. Figure 7 , which represents the three smallest rectangles that are split.
[0099] 3. Rectangle Merger
[0100] The rectangles split in the previous step are all minimum rectangles. In fact, this is an over-splitting solution and rectangle merging is required.
[0101] * Horizontal merge
[0102] * Traverse all small rectangles and perform the following operations on each rectangle:
[0103] Check all other rectangles to see if there is a rectangle that has a common **horizontal** side with this rectangle (each rectangle has two horizontal sides, namely A, B and C, D. Compare the coordinates of the two endpoints of AC, AD, BC, and BD in turn to see if they are the same. If they are the same, the two rectangles have the same sides. For example: AC is the same, that is, the coordinates of the two line segment endpoints of the side A are the same as the two line segment endpoints of the side C, that is, the above two rectangles have the same sides). If so, merge the two rectangles, add the merged rectangle to the rectangle list, delete the original two small rectangles, and start traversing from the beginning.
[0104] * Vertical merger
[0105] * Traverse all small rectangles and perform the following operations on each rectangle:
[0106] Check all other rectangles to see if there is a rectangle that has a common vertical edge with this rectangle. If so, merge the two rectangles, add the merged rectangle to the rectangle list, delete the original two small rectangles, and start traversing from the beginning.
[0107] After two rounds of merging, the final segmentation result is generated. By adjusting the order of horizontal merging and vertical merging, two segmentation styles can be generated: Figure 8 Medium level style, Fig. 9 Vertical style in .
[0108] The present invention completes the splitting of each rectangle through splitting lines. Not only is the algorithm simple and easy to implement, but the splitting result is also highly accurate, which can help staff members automatically complete the division of room outlines and effectively reduce the workload of staff members.
[0109] The present invention also provides a rectangle splitting system for architectural drawings, comprising:
[0110] A data acquisition module, used to acquire polygons constituting room outlines in architectural drawings;
[0111] A split line construction module, used to establish a split line using the corner points of the polygon;
[0112] A splitting module, used for completing the splitting of all minimum rectangles according to the splitting lines;
[0113] The merging module is used to merge the minimum rectangles according to the preset splitting requirements to obtain the split room outline.
[0114] Compared with the prior art, the beneficial effects of a rectangle splitting system for architectural drawings provided by the present invention are the same as the beneficial effects of a rectangle splitting method for architectural drawings described in the above technical solution, which will not be elaborated here.
[0115] The present invention also provides an electronic device, comprising a bus, a transceiver, a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the transceiver, the memory, and the processor are connected via the bus, and wherein the computer program, when executed by the processor, implements the steps in the above-mentioned method for splitting rectangles in architectural drawings.
[0116] Compared with the prior art, the beneficial effects of the electronic device provided by the present invention are the same as the beneficial effects of the rectangle splitting method for architectural drawings described in the above technical solution, and will not be described in detail here.
[0117] The present invention also provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the steps in the above-mentioned method for splitting rectangles of architectural drawings.
[0118] Compared with the prior art, the beneficial effects of a computer-readable storage medium provided by the present invention are the same as the beneficial effects of a rectangle splitting method for architectural drawings described in the above technical solution, and are not elaborated here.
[0119] 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 and improvements made within the spirit and principles of the present invention should be included in the protection scope of the present invention.
Claims
1. A method for splitting rectangles in architectural drawings, characterized in that: include: Step 1: Get the polygons that make up the room outline in the architectural drawing; Step 2: Using the corner points of the polygon to establish a split line; The step 2: using the corner points of the polygon to establish a split line, comprises: Step 2.1: Select a corner point on the polygon, and establish two straight lines in the horizontal direction and the vertical direction with the corner point as the center; Step 2.2: Traverse the line segments formed by other corner points that are not adjacent to the corner point, and find all intersection points with the two straight lines established in the horizontal direction and the vertical direction; Step 2.3: Split the line segment where the intersection point is located to obtain a first node and a second node, and respectively connect the first node, the second node and the corner point with the intersection point as the starting point to form a split line; Step 2.4: Return to step 2.1 until all corner points on the polygon are traversed and all split lines are obtained; Step 3: Complete the splitting of all minimum rectangles according to the splitting line; The step 3: completing the splitting of all minimum rectangles according to the splitting line, includes: Step 3.1: Take the split line and the line segments consisting of the corner points on the polygon as the baseline set; Step 3.2: taking an endpoint of any one end of a baseline in the baseline set as the first endpoint and the endpoint of the other end as the second endpoint; Step 3.3: When the second endpoint is above the first endpoint, search for a corner point to the right of the second endpoint as the third endpoint, and search for a corner point below the third endpoint as the fourth endpoint; Step 3.4: When the second endpoint is below the first endpoint, search for a corner point on the left of the second endpoint as the third endpoint, and search for a corner point above the third endpoint as the fourth endpoint; Step 3.5: When the second endpoint is to the left of the first endpoint, search for a corner point above the second endpoint as the third endpoint, and search for a corner point to the right of the third endpoint as the fourth endpoint; Step 3.6: When the second endpoint is to the right of the first endpoint, search for a corner point below the second endpoint as the third endpoint, and search for a corner point to the left of the third endpoint as the fourth endpoint; Step 3.7: The rectangle formed by the first endpoint, the second endpoint, the third endpoint and the fourth endpoint is taken as the minimum rectangle; Step 3.8: Traverse all baselines in the baseline set to find all minimum rectangles; Step 4: Merge the smallest rectangles according to the preset splitting requirements to obtain the split room outline.
2. A method for splitting rectangles of architectural drawings as claimed in claim 1, characterized in that: The step 4: merging the minimum rectangles according to the preset splitting requirements to obtain the split room outline includes: When horizontal merging is required, check whether other minimum rectangles have a common horizontal edge with the current minimum rectangle. If so, merge the corresponding rectangles to obtain a horizontally merged rectangle.
3. A method for splitting rectangles of architectural drawings as claimed in claim 2, characterized in that: The step 4: merging the minimum rectangles according to the preset splitting requirements to obtain the split room outline, further includes: When vertical merging is required, check whether other minimum rectangles have a common vertical edge with the current minimum rectangle. If so, merge the corresponding rectangles to obtain a vertically merged rectangle.
4. A rectangular splitting system for architectural drawings, characterized in that: include: A data acquisition module, used to acquire polygons constituting room outlines in architectural drawings; A split line construction module, used to establish a split line using the corner points of the polygon; Among them, using the corner points of the polygon to establish the split line includes: Step 2.1: Select a corner point on the polygon, and establish two straight lines in the horizontal direction and the vertical direction with the corner point as the center; Step 2.2: Traverse the line segments formed by other corner points that are not adjacent to the corner point, and find all intersection points with the two straight lines established in the horizontal direction and the vertical direction; Step 2.3: Split the line segment where the intersection point is located to obtain a first node and a second node, and respectively connect the first node, the second node and the corner point with the intersection point as the starting point to form a split line; Step 2.4: Return to step 2.1 until all corner points on the polygon are traversed and all split lines are obtained; A splitting module, used for completing the splitting of all minimum rectangles according to the splitting lines; The splitting of all minimum rectangles is completed according to the splitting line, including: Step 3.1: Take the split line and the line segments consisting of the corner points on the polygon as the baseline set; Step 3.2: taking an endpoint of any one end of a baseline in the baseline set as the first endpoint and the endpoint of the other end as the second endpoint; Step 3.3: When the second endpoint is above the first endpoint, search for a corner point to the right of the second endpoint as the third endpoint, and search for a corner point below the third endpoint as the fourth endpoint; Step 3.4: When the second endpoint is below the first endpoint, search for a corner point on the left of the second endpoint as the third endpoint, and search for a corner point above the third endpoint as the fourth endpoint; Step 3.5: When the second endpoint is to the left of the first endpoint, search for a corner point above the second endpoint as the third endpoint, and search for a corner point to the right of the third endpoint as the fourth endpoint; Step 3.6: When the second endpoint is to the right of the first endpoint, search for a corner point below the second endpoint as the third endpoint, and search for a corner point to the left of the third endpoint as the fourth endpoint; Step 3.7: The rectangle formed by the first endpoint, the second endpoint, the third endpoint and the fourth endpoint is taken as the minimum rectangle; Step 3.8: Traverse all baselines in the baseline set to find all minimum rectangles; The merging module is used to merge the minimum rectangles according to the preset splitting requirements to obtain the split room outline.
5. An electronic device, comprising a bus, a transceiver, a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the transceiver, the memory, and the processor are connected via the bus, wherein: When the computer program is executed by the processor, the steps in a rectangle splitting method for architectural drawings as described in any one of claims 1 to 3 are implemented.
6. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps in a rectangle splitting method for architectural drawings as described in any one of claims 1 to 3 are implemented.
Citation Information
Patent Citations
House type code matching method and device
CN113920250A
Mask data partitioning method, apparatus and device, and storage medium
WO2022252276A1