Spatial region generation method and device for generating room structure
By combining the position information of each grid point itself and the layout between the subspace to be generated and other subspaces in the grid area, determining the initial position of the subspace to be generated and selecting the target grid area, the problem of unreasonable random room generation in the existing technology is solved, and a more reasonable and generalized room structure generation is achieved.
Patent Information
- Application Number
- CN202411700415.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-26
- Publication Date
- 2025-04-25
- Estimated Expiration
- 2044-11-26
AI Technical Summary
The shape and position of the room generated by the random room area generation method in the prior art are often unreasonable, affecting the user experience.
By combining the position information of each grid point itself and the layout between the subspace to be generated and other subspaces in the grid area, the initial position of the subspace to be generated is determined, and the target grid area corresponding to the subspace to be generated is determined from the candidate grid area generated by the initial position.
While ensuring randomness, it improves the rationality and generality of the generated room structure and locality, improves the spatial area generation effect, and thus improves the user experience.
Smart Images

Figure CN119180074B_ABST
Abstract
Description
Technical Field
[0001] The present application belongs to the field of space generation, and in particular, relates to a method and device for generating a space region for generating a room structure. Background Art
[0002] In computer-generated images, virtual reality, and space layout scenarios, it is often necessary to dynamically create scenes or maps. In related technologies, rooms are mainly generated by random room area generation technology, but the shapes and positions of the room areas generated by this method are often unreasonable, affecting user experience. Summary of the invention
[0003] The present application aims to solve at least one of the technical problems existing in the prior art. To this end, the present application proposes a spatial region generation method and device for generating room structures, which can improve the rationality and versatility of the generated room structure and locality while ensuring randomness, and improve the spatial region generation effect.
[0004] In a first aspect, the present application provides a method for generating a spatial region for generating a room structure, the method comprising:
[0005] Determine a target grid point corresponding to the subspace to be generated in the grid area based on at least one of first relative position information of each grid point in the grid area relative to the grid area and second relative position information between the grid point and the target subspace; the target subspace is a subspace having a position restriction relationship with the subspace to be generated;
[0006] Taking the target grid point as a base point and expanding in all directions, a plurality of candidate grid areas corresponding to the target subspace in the grid area are determined, each of the candidate grid areas includes the target grid point and at least one other grid point;
[0007] Based on the multiple candidate grid areas, a target grid area corresponding to the subspace to be generated is determined.
[0008] According to the spatial area generation method for generating room structure of the present application, the initial position of the subspace to be generated is determined by combining the position of each grid point itself in the grid area and the layout between the subspace to be generated and other subspaces in the entire area, and then the target grid area corresponding to the subspace to be generated is determined from the candidate grid area generated by the initial position. This can improve the rationality and versatility of the generated room structure and the locality while ensuring randomness, improve the spatial area generation effect, and thus improve the user experience.
[0009] According to an embodiment of the present application, determining the target grid point corresponding to the subspace to be generated in the grid area based on at least one of first relative position information of each grid point in the grid area relative to the grid area and second relative position information between the grid point and the target subspace includes:
[0010] Determining a first weight corresponding to each of the grid points based on first relative position information of each of the grid points relative to a midpoint of the grid area;
[0011] Determining a second weight corresponding to each of the grid points based on second relative position information between each of the grid points and each of the target subspaces;
[0012] Based on at least one of the first weight and the second weight, a target grid point corresponding to the subspace to be generated in the grid area is determined.
[0013] According to an embodiment of the present application, determining the first weight corresponding to each of the grid points based on the first relative position information of each of the grid points relative to the midpoint of the grid area includes:
[0014] Based on the lateral distance and the longitudinal distance between the grid point and the midpoint, a first weight corresponding to the grid point is determined.
[0015] According to an embodiment of the present application, determining the second weight corresponding to each of the grid points based on the second relative position information between each of the grid points and each of the target subspaces includes:
[0016] Determining a sub-weight of the grid point relative to the target subspace based on a lateral distance and a longitudinal distance between the grid point and the target subspace;
[0017] An average value of the sub-weights of the grid point relative to each of the target subspaces is determined as the second weight corresponding to the grid point.
[0018] According to an embodiment of the present application, determining the target grid area corresponding to the subspace to be generated based on the multiple candidate grid areas includes:
[0019] Based on at least one of an area score function, a shape score function, and a perimeter score function, the plurality of candidate grid areas are screened to determine a target grid area corresponding to the subspace to be generated.
[0020] According to an embodiment of the present application, the screening of the multiple candidate grid areas based on at least one of an area score function, a shape score function, and a perimeter score function to determine the target grid area corresponding to the subspace to be generated includes:
[0021] Calculating the area score, shape score and perimeter score corresponding to each of the candidate grid areas based on the area score function, the shape score function and the perimeter score function respectively;
[0022] Summing the area score, shape score and perimeter score corresponding to the same candidate grid area to obtain a comprehensive score corresponding to the candidate grid area;
[0023] Based on the comprehensive scores corresponding to the candidate grid areas, the multiple candidate grid areas are screened to obtain the target grid area.
[0024] In a second aspect, the present application provides a spatial region generating device for generating a room structure, the device comprising:
[0025] A first processing module, configured to determine a target grid point corresponding to a subspace to be generated in the grid area based on at least one of first relative position information of each grid point in the grid area relative to the grid area and second relative position information between the grid point and a target subspace; the target subspace is a subspace having a position restriction relationship with the subspace to be generated;
[0026] A second processing module is used to expand around the target grid point as a base point to determine a plurality of candidate grid areas corresponding to the target subspace in the grid area, each of the candidate grid areas includes the target grid point and at least one other grid point;
[0027] The third processing module is used to determine a target grid area corresponding to the subspace to be generated based on the multiple candidate grid areas.
[0028] According to the spatial area generation device for generating room structure of the present application, the initial position of the subspace to be generated is determined by combining the position of each grid point in the grid area and the layout between the subspace to be generated and other subspaces in the entire area, and then the target grid area corresponding to the subspace to be generated is determined from the candidate grid area generated by the initial position. This can improve the rationality and versatility of the generated room structure and the locality while ensuring randomness, improve the spatial area generation effect, and thus improve the user experience.
[0029] In a third aspect, the present application provides an electronic device comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, wherein when the processor executes the computer program, the method for generating a spatial area for generating a room structure as described in the first aspect above is implemented.
[0030] In a fourth aspect, the present application provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the spatial area generation method for generating a room structure as described in the first aspect above.
[0031] In a fifth aspect, the present application provides a computer program product, including a computer program, which, when executed by a processor, implements the spatial area generation method for generating a room structure as described in the first aspect above.
[0032] The above one or more technical solutions in the embodiments of the present application have at least one of the following technical effects:
[0033] The initial position of the subspace to be generated is determined by combining the position of each grid point in the grid area and the layout between the subspace to be generated and other subspaces in the entire area. Then, the target grid area corresponding to the subspace to be generated is determined from the candidate grid area generated by the initial position. This can improve the rationality and versatility of the generated room structure and locality while ensuring randomness, thereby improving the spatial area generation effect.
[0034] By calculating the first weight of each grid point according to the position of the point in the grid area, the corner positions can correspond to higher weights, which can not only effectively alleviate the unreasonable position of room generation, but also improve the regularity of the room.
[0035] Furthermore, by considering the lateral distance and longitudinal distance between the target subspace and the grid point that has a position restriction relationship with the subspace to be generated, the sub-weight of the grid point relative to the target subspace is calculated to obtain the grid weights of the different fuselage itself corresponding to different rooms. This can make the position of the subspace to be generated determined subsequently meet the spatial layout requirements as much as possible, thereby improving the precision and accuracy of room generation.
[0036] Furthermore, by taking the product of the first weight and the second weight as the total weight, it is possible to comprehensively consider different conditions such as the corner positions having higher weights and the positions of the subspace to be generated and the target subspace satisfying the preset distance as much as possible, so that the position of the subspace to be generated is more reasonable and meets the set position requirements, which helps to improve the regularity and accuracy of the room.
[0037] Additional aspects and advantages of the present application will be given in part in the description below, and in part will become apparent from the description below, or will be learned through the practice of the present application. BRIEF DESCRIPTION OF THE DRAWINGS
[0038] The above and / or additional aspects and advantages of the present application will become apparent and easily understood from the description of the embodiments in conjunction with the following drawings, in which:
[0039] Figure 1 is a flow chart of a method for generating a spatial region for generating a room structure provided in an embodiment of the present application;
[0040] Figure 2 is a schematic diagram of the result of the spatial region generation method for generating a room structure provided in an embodiment of the present application;
[0041] Figure 3 is a structural schematic diagram of a spatial region generating device for generating a room structure provided in an embodiment of the present application;
[0042] Figure 4 It is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0043] The following will be combined with the drawings in the embodiments of the present application to clearly describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, rather than all the embodiments. All other embodiments obtained by ordinary technicians in this field based on the embodiments in the present application belong to the scope of protection of this application.
[0044] The terms "first", "second", etc. in the specification and claims of the present application are used to distinguish similar objects, and are not used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable under appropriate circumstances, so that the embodiments of the present application can be implemented in an order other than those illustrated or described here, and the objects distinguished by "first", "second", etc. are generally of one type, and the number of objects is not limited. For example, the first object can be one or more. In addition, "and / or" in the specification and claims represents at least one of the connected objects, and the character " / " generally indicates that the objects associated with each other are in an "or" relationship.
[0045] In conjunction with the accompanying drawings, the spatial area generation method for generating a room structure, the spatial area generation device for generating a room structure, the electronic device and the readable storage medium provided in the embodiments of the present application are described in detail through specific embodiments and their application scenarios.
[0046] The spatial region generation method for generating a room structure may be applied to a terminal, and may be specifically executed by hardware or software in the terminal.
[0047] In the following various embodiments, a terminal including a display and a touch-sensitive surface is described. However, it should be understood that the terminal may include one or more other physical user interface devices such as a physical keyboard, a mouse and a joystick.
[0048] The spatial area generation method for generating a room structure provided in the embodiment of the present application may be an electronic device or a functional module or functional entity in the electronic device that can implement the spatial area generation method for generating a room structure. The electronic devices mentioned in the embodiment of the present application include but are not limited to mobile phones, tablet computers, computers, cameras, and wearable devices. The spatial area generation method for generating a room structure provided in the embodiment of the present application is described below using an electronic device as an example of an execution subject.
[0049] It should be noted that the spatial region generation method for generating room structures provided in the present application can be used for space generation in a virtual reality scene, and can also be used for space generation in a real scene.
[0050] like Figure 1 As shown, the spatial region generation method for generating a room structure includes: step 110, step 120 and step 130.
[0051] Step 110: determining a target grid point in the grid area corresponding to the subspace to be generated based on at least one of first relative position information of each grid point in the grid area relative to the grid area and second relative position information between the grid point and the target subspace;
[0052] In this step, the subspace to be generated can be a room of any type, such as a kitchen, a bedroom, an activity room or a classroom.
[0053] The type, quantity and area of the subspaces to be generated can be customized by the user, such as the subspaces to be generated should occupy 10% or 5% of the area of the entire room.
[0054] The target subspace is a subspace that has a position restriction relationship with the subspace to be generated. The position restriction relationship may include, but is not limited to: distance and whether it is a containing nested relationship.
[0055] It is understandable that the target subspace may be user-defined. For example, if the subspace to be generated is a kitchen, the target subspace may be a toilet. For example, the kitchen may be defined as being as far away from each toilet as possible.
[0056] The grid area is an area including a plurality of grid points, such as an area including N*N grid points, where N is a positive integer.
[0057] The first relative position information is the relative position of the grid point in the entire grid area, such as whether it is located at the center or edge of the grid area.
[0058] The second relative position information is the relative position between the grid point and the target subspace, such as the distance from the target subspace.
[0059] The number of the target subspaces may be one or more. When there are multiple target subspaces, the second relative position information between each grid point and each target object should be obtained respectively.
[0060] The target grid point is a reference point for generating the subspace to be generated, and is used to represent the initial room position corresponding to the subspace to be generated. The target grid point is a grid point in the grid area.
[0061] During the actual execution process, the first relative position information and the second relative position information corresponding to each grid point are obtained, and at least one of the first relative position information and the second relative position information corresponding to each grid point is combined to determine an optimal grid point as the target grid point from the multiple grids included in the grid area.
[0062] Step 120: Expanding around the target grid point as a base point to determine a plurality of candidate grid areas corresponding to the target subspace in the grid area, each candidate grid area including the target grid point and at least one other grid point;
[0063] In this step, the target grid points are expanded outward until they exceed the set ratio or fill the room, thereby generating multiple candidate grid areas.
[0064] The number of grid points included in each candidate grid area, the shape and perimeter of each candidate grid area, etc. may be different.
[0065] Step 130: Determine a target grid area corresponding to the subspace to be generated based on multiple candidate grid areas.
[0066] In this step, the target grid area is the final space area corresponding to the subspace to be generated.
[0067] The target grid area may be a candidate grid area, or may include multiple candidate grid areas.
[0068] In some embodiments, the multiple candidate grid areas obtained in step 120 may be manually selected by a user, such as in response to a user input of a target candidate grid area among the multiple candidate grid areas, determining the target candidate grid area as the target grid area.
[0069] User input may be touch input, physical button input, voice input, or any other feasible input method, which is not limited in this application.
[0070] In some embodiments, for the multiple candidate grid areas obtained in step 120, a grid area with a shape or area that meets the project requirements can be selected from the candidate grid areas as the target grid area according to specific project requirements; for example, grids with unreasonable shapes in the candidate grid areas can be deleted, and the remaining candidate grid areas can be used as the target grid areas, which is not limited in the present application.
[0071] During the actual implementation process, all the required rooms can be pre-defined, including the room type (such as kitchen or toilet), proportion (such as you want the kitchen to occupy 10% of the entire house), etc. For each room, you can also define the room to include leaf rooms and meta-rooms, where a meta-room can contain multiple meta-rooms and leaf rooms. The meta-room can be regarded as a smaller house, and the meta-room can be used as the subspace to be generated in this application.
[0072] By defining meta-rooms and leaf rooms, it is convenient to bind different room types through meta-rooms.
[0073] For example, a meta-room may be defined to include a master bedroom and a toilet, where the master bedroom and the toilet are leaf rooms corresponding to the meta-room.
[0074] For another example, a villa is defined to include three activity areas and an entertainment room, with the activity areas and the entertainment room each being a meta-room.
[0075] For each activity area, it can include two bedrooms and a toilet, that is, the leaf rooms corresponding to the activity area; for the entertainment room, it can include: toilets, billiard rooms, KTV and other leaf rooms.
[0076] Each meta-room can be used as a subspace to be generated. The initial position of the meta-room in the entire area (i.e., the target grid point) is determined by the method of step 110, and then the target grid point is expanded until it reaches a suitable area or cannot be expanded any further, thereby obtaining a candidate grid area corresponding to the meta-room. The candidate grid areas are screened by the method of step 130 to determine the target grid area corresponding to the meta-room.
[0077] According to the spatial area generation method for generating room structure provided in the embodiment of the present application, the initial position of the subspace to be generated is determined by combining the position of each grid point in the grid area and the layout between the subspace to be generated and other subspaces in the entire area, and then the target grid area corresponding to the subspace to be generated is determined from the candidate grid area generated by the initial position. This can improve the rationality and versatility of the generated room structure and the locality while ensuring randomness, improve the spatial area generation effect, and thus improve the user experience.
[0078] In some embodiments, step 110 may include:
[0079] Determine a first weight corresponding to each grid point based on first relative position information of each grid point relative to a midpoint of the grid area;
[0080] Determining a second weight corresponding to each grid point based on second relative position information between each grid point and each target subspace;
[0081] Based on at least one of the first weight and the second weight, a target grid point corresponding to the subspace to be generated in the grid area is determined.
[0082] In this embodiment, the first weight is used to characterize the weight of each grid point in the grid, which is irrelevant to the generated room layout in the grid area and is only related to the position of the grid point in the grid area.
[0083] In actual implementation, the first weight may be determined by using an initialization method that decreases from the edge to the center.
[0084] In some embodiments, determining the first weight corresponding to each grid point based on the first relative position information of each grid point relative to the midpoint of the grid area may include:
[0085] Based on the lateral distance and the longitudinal distance between the grid point and the midpoint, a first weight corresponding to the grid point is determined.
[0086] In this embodiment, the transverse distance is the horizontal distance from the grid point to the midpoint, and the longitudinal distance is the vertical distance from the grid point to the midpoint. The calculation formula is as follows:
[0087]
[0088] in, is the first weight corresponding to the grid point; v is the longitudinal distance, and h is the lateral distance.
[0089] According to the spatial area generation method for generating room structure provided in the embodiment of the present application, the first weight of each grid point is calculated by the position of the point in the grid area, so that the corner positions correspond to higher weights, which can not only effectively alleviate the unreasonable position of room generation, but also improve the regularity of the room.
[0090] The second weight is used to characterize the grid weights of different fuselages corresponding to different rooms, and the second weight is related to the room layout generated within the grid area.
[0091] In some embodiments, determining the second weight corresponding to each grid point based on the second relative position information between each grid point and each target subspace may include:
[0092] Determine the sub-weight of the grid point relative to the target subspace based on the lateral distance and the longitudinal distance between the grid point and the target subspace;
[0093] The average value of the sub-weights of the grid point relative to each target subspace is determined as the second weight corresponding to the grid point.
[0094] In this embodiment, the number of the target subspaces may be one or more.
[0095] When there is only one target subspace, the calculated subweight of the grid point relative to the target subspace can be directly determined as the final second weight.
[0096] When there are multiple target spaces, the sub-weights of the grid points relative to each target subspace are first calculated, and then the average of all the sub-weights is taken to obtain the final second weight.
[0097] In some embodiments, the sub-weights may be weighted and summed based on the weight of the target subspace to obtain a second weight. The weight of the target subspace may be user-defined, which is not limited in this application.
[0098] In the actual implementation process, each target subspace can be used as a midpoint to calculate the distance between the grid point and the midpoint.
[0099] In some embodiments, the second weight may be calculated using the following formula:
[0100]
[0101] in, is the second weight corresponding to the grid point; is the longitudinal distance between the grid point and the i-th target subspace; is the longitudinal distance from the grid point to the i-th target subspace; n is the number of target subspaces, where n is a positive integer.
[0102] According to the spatial area generation method for generating a room structure provided in an embodiment of the present application, by considering the lateral distance and longitudinal distance between the target subspace and the grid point that have a position restriction relationship with the subspace to be generated, the sub-weight of the grid point relative to the target subspace is calculated to obtain the grid weights of the different fuselage itself corresponding to different rooms, so that the position of the subspace to be generated determined subsequently can meet the spatial layout requirements as much as possible, thereby improving the precision and accuracy of room generation.
[0103] After the first weight and the second weight are calculated, the total weight corresponding to the grid point can be determined based on the product of the first weight and the second weight, that is:
[0104]
[0105] in, is the total weight corresponding to the grid point; is the first weight; is the second weight.
[0106] By taking the product of the first weight and the second weight as the total weight, a grid weight that meets the above two conditions can be obtained as much as possible.
[0107] According to the spatial area generation method for generating a room structure provided in an embodiment of the present application, by taking the product of the first weight and the second weight as the total weight, it is possible to comprehensively consider different conditions such as the corner positions corresponding to higher weights and the positions of the subspace to be generated and the target subspace satisfying a preset distance as much as possible, so that the position of the subspace to be generated is more reasonable and meets the set position requirements, which helps to improve the regularity and accuracy of the room.
[0108] In some embodiments, step 130 may include:
[0109] Based on at least one of an area score function, a shape score function, and a perimeter score function, a plurality of candidate grid regions are screened to determine a target grid region corresponding to the subspace to be generated.
[0110] In this embodiment, the area score function is used to limit the area of the generated subspace to be generated; the compactness of the room is evaluated by comparing the number of grids actually occupied by the room (i.e., the candidate grid area) with the maximum number of square grids that can be formed by the current number of grids (i.e., the most compact layout under ideal conditions); the closer the ratio of the actually occupied area to the maximum possible area is to 1, the higher the score is.
[0111] The area score function is used to evaluate whether the room's footprint is close to the ideal square layout, preventing the generation of rooms with very scattered or overly complex footprints, and helping to generate more regular and compact room shapes.
[0112] The shape score function is used to limit the aspect ratio of the generated subspace to prevent the generation of overly elongated rooms. The shape score function can be used to evaluate whether the shape of the room is close to an ideal rectangle by calculating the ratio of the long side of the room (i.e., the candidate grid area) divided by the short side. If this ratio is within a user-defined reasonable range, the score is 1. Otherwise, points will be deducted based on the degree of deviation from the ratio. The greater the deviation, the lower the corresponding shape score.
[0113] By setting the shape score function, we can effectively avoid generating rooms with too irregular shapes, such as too long corridors or extremely narrow rooms, thus making the room layout more reasonable and beautiful.
[0114] The perimeter scoring function is used to limit the perimeter of the generated subspace to be generated. The perimeter scoring function evaluates the surrounding structure of the room by comparing the actual perimeter of the room with the most ideal (minimum) and worst (maximum) perimeters; based on the number of grid points in the current room (i.e., the candidate grid area), the minimum and maximum perimeters can be calculated, and then the actual perimeter is mapped to a score through a formula. Ideally, the room's perimeter has a high score when it is close to the minimum perimeter, and a low score when it is close to the maximum perimeter.
[0115] The perimeter score function is used to avoid generating rooms with too large a perimeter and to suppress irregular outer edges of the room, such as jagged edges or overly extended shapes, thereby improving the regularity of the room.
[0116] In some embodiments, the area score function, the shape score function, and the perimeter score function may be user-defined, or may be adjusted accordingly based on actual project requirements.
[0117] In the actual implementation process, based on actual needs, one or more of the area scoring function, shape scoring function and perimeter scoring function can be selected to screen the multiple candidate grid areas obtained to obtain candidate grid areas that meet the conditions of area restrictions, perimeter restrictions and shape restrictions, and use them as the final target grid areas.
[0118] According to the spatial area generation method for generating room structures provided in an embodiment of the present application, candidate grid areas generated according to at least one of the first relative position information of each grid point in the grid area relative to the grid area and the second relative position information between the grid point and the target subspace are screened through one or more of the area scoring function, the shape scoring function and the perimeter scoring function. This can remove irregular rooms (including those surrounded or with jagged edges), screen the area distribution that meets the requirements in a large number of generated areas, and further improve the rationality and accuracy of the target grid area corresponding to the subspace to be generated.
[0119] In some embodiments, based on at least one of an area score function, a shape score function, and a perimeter score function, screening multiple candidate grid areas to determine a target grid area corresponding to the subspace to be generated may include:
[0120] Based on the area score function, shape score function and perimeter score function respectively, the area score, shape score and perimeter score corresponding to each candidate grid area are calculated;
[0121] The area score, shape score and perimeter score corresponding to the same candidate grid area are summed to obtain the comprehensive score corresponding to the candidate grid area;
[0122] Based on the comprehensive scores corresponding to the candidate grid areas, multiple candidate grid areas are screened to obtain the target grid area.
[0123] In this embodiment, the higher the area score, shape score, and perimeter score, the more the candidate grid region meets the area, shape, or perimeter requirements.
[0124] In some embodiments, calculating the shape score based on the shape score function may include: obtaining the shape score based on a ratio of a long side to a short side corresponding to the candidate mesh region.
[0125] In this embodiment, the actual shape of the candidate grid area does not need to be considered.
[0126] For example, when the grid area is a rectangle, the shape score can be calculated based on the aspect ratio as the ratio of the long side to the short side.
[0127] When the candidate grid region is an irregular shape, the longest side and the shortest side of all sides of the candidate grid region may be obtained, and the ratio of the longest side to the shortest side may be determined as the shape score.
[0128] like Figure 2 As shown, the shape score corresponding to the candidate mesh area corresponding to the gray area is the ratio of the longest side 4 to the shortest side 3, that is, 4 / 3.
[0129] By calculating the ratio of the long side to the short side, the candidate grid area can be limited to a certain range to limit the length-to-width ratio of the room, prevent the appearance of long strips of rooms, and improve the rationality of the generated candidate grid area.
[0130] In some embodiments, when the candidate mesh area meets the user-defined restriction range, its corresponding shape score is 1.
[0131] In some embodiments, calculating the perimeter score based on the perimeter score function may include: determining the perimeter score based on the actual perimeter of the candidate grid area, the minimum perimeter that can be obtained by the number of grid points included in the candidate grid area, and the maximum perimeter that can be obtained by the number of grid points included in the candidate grid area.
[0132] In this embodiment, the perimeter score function can calculate the area of the most ideal room and the area of the worst room according to the number of grids occupied by the room. The calculation formula is as follows:
[0133]
[0134] in, Score for perimeter; is the actual perimeter of the candidate grid area; is the minimum perimeter that can be obtained based on the number of grid points included in the candidate grid area; It is the maximum perimeter that can be obtained based on the number of grid points included in the candidate grid area.
[0135] Continue to refer Figure 2 , the shaded area is the candidate grid area, and the perimeter of the candidate grid area is is 14, the number of grid points in the candidate grid area is 9, the minimum perimeter is 12 (3*3), and the maximum perimeter is 20 (1*9). The corresponding perimeter score is calculated as: 1-(14-12) / (20-12)=0.75.
[0136] In some embodiments, calculating the area score based on the area score function may include: obtaining the area score based on a ratio of the number of grid points included in the candidate grid area to the maximum number of grid points corresponding to the grid area occupied by the candidate grid area.
[0137] The area score function is based on the actual number of grid points currently occupied by the candidate grid area divided by the maximum number of square grid points occupied by the current grid.
[0138] Continue to refer Figure 2 , the number of grid points included in the candidate grid area is 9, and the maximum number of grid points it occupies is 12, so the corresponding area fraction can be calculated to be 9 / 12=0.75.
[0139] After obtaining the area score, shape score and perimeter score, all scores can be summed to obtain the comprehensive score corresponding to the candidate grid area, and the candidate grid area with the highest comprehensive score or the comprehensive score exceeding the preset score is used as the target grid area corresponding to the subspace to be generated.
[0140] According to the spatial area generation method for generating room structure provided in the embodiment of the present application, by combining the area scoring function, shape scoring function and perimeter scoring function to calculate the comprehensive score of each candidate grid area to screen multiple areas, it is possible to effectively reduce the probability of generating rooms with overly irregular shapes, rooms with irregular outer edges, and rooms with relatively scattered or overly complex areas, thereby improving the regularity, rationality, compactness and aesthetics of the final room.
[0141] The spatial region generation method for generating a room structure provided in the embodiment of the present application can be executed by a spatial region generation device for generating a room structure. In the embodiment of the present application, the spatial region generation method for generating a room structure is executed by a spatial region generation device for generating a room structure as an example to illustrate the spatial region generation device for generating a room structure provided in the embodiment of the present application.
[0142] An embodiment of the present application also provides a spatial region generating device for generating a room structure.
[0143] like Figure 3 As shown, the spatial region generating device for generating a room structure includes: a first processing module 310 , a second processing module 320 and a third processing module 330 .
[0144] The first processing module 310 is used to determine the target grid point corresponding to the subspace to be generated in the grid area based on at least one of the first relative position information of each grid point in the grid area relative to the grid area and the second relative position information between the grid point and the target subspace; the target subspace is a subspace having a position restriction relationship with the subspace to be generated;
[0145] The second processing module 320 is used to expand around the target grid point as a base point to determine a plurality of candidate grid areas corresponding to the target subspace in the grid area, each candidate grid area including the target grid point and at least one other grid point;
[0146] The third processing module 330 is used to determine a target grid area corresponding to the subspace to be generated based on multiple candidate grid areas.
[0147] According to the spatial area generation device for generating room structure provided by the embodiment of the present application, the initial position of the subspace to be generated is determined by combining the position of each grid point in the grid area and the layout between the subspace to be generated and other subspaces in the entire area, and then the target grid area corresponding to the subspace to be generated is determined from the candidate grid area generated by the initial position. This can improve the rationality and versatility of the generated room structure and the locality while ensuring randomness, improve the spatial area generation effect, and thus improve the user experience.
[0148] In some embodiments, the first processing module 310 may also be used to:
[0149] Determine a first weight corresponding to each grid point based on first relative position information of each grid point relative to a midpoint of the grid area;
[0150] Determining a second weight corresponding to each grid point based on second relative position information between each grid point and each target subspace;
[0151] Based on at least one of the first weight and the second weight, a target grid point corresponding to the subspace to be generated in the grid area is determined.
[0152] In some embodiments, the first processing module 310 may also be used to:
[0153] Based on the lateral distance and the longitudinal distance between the grid point and the midpoint, a first weight corresponding to the grid point is determined.
[0154] In some embodiments, the first processing module 310 may also be used to:
[0155] Determine the sub-weight of the grid point relative to the target subspace based on the lateral distance and the longitudinal distance between the grid point and the target subspace;
[0156] The average value of the sub-weights of the grid point relative to each target subspace is determined as the second weight corresponding to the grid point.
[0157] In some embodiments, the third processing module 330 may also be used to:
[0158] Based on at least one of an area score function, a shape score function, and a perimeter score function, a plurality of candidate grid regions are screened to determine a target grid region corresponding to the subspace to be generated.
[0159] In some embodiments, the third processing module 330 may also be used to:
[0160] Based on the area score function, shape score function and perimeter score function respectively, the area score, shape score and perimeter score corresponding to each candidate grid area are calculated;
[0161] The area score, shape score and perimeter score corresponding to the same candidate grid area are summed to obtain the comprehensive score corresponding to the candidate grid area;
[0162] Based on the comprehensive scores corresponding to the candidate grid areas, multiple candidate grid areas are screened to obtain the target grid area.
[0163] The spatial region generating device for generating the room structure in the embodiment of the present application may be an electronic device, or a component in the electronic device, such as an integrated circuit or a chip. The electronic device may be a terminal, or may be other devices other than a terminal. Exemplarily, the electronic device may be a mobile phone, a tablet computer, a laptop computer, a PDA, a vehicle-mounted electronic device, a mobile Internet device (Mobile Internet Device, MID), an augmented reality (augmented reality, AR) / virtual reality (virtual reality, VR) device, a robot, a wearable device, an ultra-mobile personal computer (ultra-mobile personal computer, UMPC), a netbook or a personal digital assistant (personal digital assistant, PDA), etc., and may also be a server, a network attached storage (Network Attached Storage, NAS), a personal computer (personal computer, PC), a television (television, TV), a teller machine or a self-service machine, etc., which is not specifically limited in the embodiment of the present application.
[0164] The spatial region generating device for generating a room structure in the embodiment of the present application may be a device having an operating system. The operating system may be an Android operating system, an IOS operating system, or other possible operating systems, which are not specifically limited in the embodiment of the present application.
[0165] The spatial region generating device for generating room structure provided in the embodiment of the present application can achieve Figure 1 and Figure 2 To avoid repetition, the various processes implemented by the method embodiment are not described here.
[0166] In some embodiments, Figure 4 As shown, an embodiment of the present application also provides an electronic device 400, including a processor 401, a memory 402, and a computer program stored in the memory 402 and executable on the processor 401. When the program is executed by the processor 401, each process of the above-mentioned spatial area generation method embodiment for generating a room structure is implemented, and the same technical effect can be achieved. To avoid repetition, it will not be described here.
[0167] It should be noted that the electronic devices in the embodiments of the present application include the mobile electronic devices and non-mobile electronic devices mentioned above.
[0168] An embodiment of the present application also provides a non-transitory computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the various processes of the above-mentioned spatial area generation method embodiment for generating a room structure are implemented, and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.
[0169] The processor is the processor in the electronic device described in the above embodiment. The readable storage medium includes a computer readable storage medium, such as a computer read-only memory ROM, a random access memory RAM, a magnetic disk or an optical disk.
[0170] An embodiment of the present application also provides a computer program product, including a computer program, which, when executed by a processor, implements the above-mentioned spatial area generation method for generating a room structure.
[0171] The processor is the processor in the electronic device described in the above embodiment. The readable storage medium includes a computer readable storage medium, such as a computer read-only memory ROM, a random access memory RAM, a magnetic disk or an optical disk.
[0172] An embodiment of the present application further provides a chip, which includes a processor and a communication interface, wherein the communication interface is coupled to the processor, and the processor is used to run programs or instructions to implement the various processes of the above-mentioned embodiment of the spatial area generation method for generating a room structure, and can achieve the same technical effect. To avoid repetition, it will not be repeated here.
[0173] It should be understood that the chip mentioned in the embodiments of the present application can also be called a system-level chip, a system chip, a chip system or a system-on-chip chip, etc.
[0174] It should be noted that, in this article, the terms "comprise", "include" or any other variant thereof are intended to cover non-exclusive inclusion, so that the process, method, article or device including a series of elements includes not only those elements, but also includes other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise one..." do not exclude the presence of other identical elements in the process, method, article or device including the element. In addition, it should be pointed out that the scope of the methods and devices in the embodiments of the present application is not limited to performing functions in the order shown or discussed, and may also include performing functions in a substantially simultaneous manner or in reverse order according to the functions involved, for example, the described method may be performed in an order different from that described, and various steps may also be added, omitted, or combined. In addition, the features described with reference to certain examples may be combined in other examples.
[0175] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a computer software product, which is stored in a storage medium (such as ROM / RAM, a magnetic disk, or an optical disk), and includes a number of instructions for enabling a terminal (which can be a mobile phone, a computer, a server, or a network device, etc.) to execute the methods described in each embodiment of the present application.
[0176] The embodiments of the present application are described above in conjunction with the accompanying drawings, but the present application is not limited to the above-mentioned specific implementation methods. The above-mentioned specific implementation methods are merely illustrative and not restrictive. Under the guidance of the present application, ordinary technicians in this field can also make many forms without departing from the purpose of the present application and the scope of protection of the claims, all of which are within the protection of the present application.
[0177] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "illustrative embodiments", "examples", "specific examples", or "some examples" means that the specific features, structures, materials, or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present application. In this specification, the schematic representation of the above terms does not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials, or characteristics described may be combined in any one or more embodiments or examples in a suitable manner.
[0178] Although the embodiments of the present application have been shown and described, those skilled in the art will appreciate that various changes, modifications, substitutions and variations may be made to the embodiments without departing from the principles and spirit of the present application, and that the scope of the present application is defined by the claims and their equivalents.
Claims
1. A spatial region generation method for generating a room structure, characterized in that: include: Determine a target grid point corresponding to the subspace to be generated in the grid area based on at least one of first relative position information of each grid point in the grid area relative to the grid area and second relative position information between the grid point and the target subspace; The target subspace is a subspace having a position restriction relationship with the subspace to be generated; Taking the target grid point as a base point and expanding in all directions, a plurality of candidate grid areas corresponding to the target subspace in the grid area are determined, each of the candidate grid areas includes the target grid point and at least one other grid point; Based on the multiple candidate grid areas, determining a target grid area corresponding to the subspace to be generated; The determining, based on at least one of first relative position information of each grid point in the grid area relative to the grid area and second relative position information between the grid point and the target subspace, a target grid point corresponding to the subspace to be generated in the grid area includes: Determining a first weight corresponding to each of the grid points based on first relative position information of each of the grid points relative to a midpoint of the grid area; Determining a second weight corresponding to each of the grid points based on second relative position information between each of the grid points and each of the target subspaces; Based on at least one of the first weight and the second weight, determining a target grid point corresponding to the subspace to be generated in the grid area; The first relative position information is the relative position of the grid point in the entire grid area; the second relative position information is the relative position between the grid point and the target subspace; The subspace to be generated is a room; the target grid point is an initial room position corresponding to the subspace to be generated.
2. The method for generating a spatial region for generating a room structure according to claim 1, characterized in that: The determining, based on the first relative position information of each grid point relative to the midpoint of the grid area, a first weight corresponding to each grid point includes: Based on the lateral distance and the longitudinal distance between the grid point and the midpoint, a first weight corresponding to the grid point is determined.
3. The method for generating a spatial region for generating a room structure according to claim 1, characterized in that: The determining, based on the second relative position information between each of the grid points and each of the target subspaces, a second weight corresponding to each of the grid points comprises: Determining a sub-weight of the grid point relative to the target subspace based on a lateral distance and a longitudinal distance between the grid point and the target subspace; An average value of the sub-weights of the grid point relative to each of the target subspaces is determined as the second weight corresponding to the grid point.
4. The method for generating a spatial region for generating a room structure according to any one of claims 1 to 3, characterized in that: The step of determining a target grid area corresponding to the subspace to be generated based on the multiple candidate grid areas includes: Based on at least one of an area score function, a shape score function, and a perimeter score function, the plurality of candidate grid areas are screened to determine a target grid area corresponding to the subspace to be generated.
5. The method for generating a spatial region for generating a room structure according to claim 4, characterized in that: The screening of the plurality of candidate grid areas based on at least one of an area score function, a shape score function, and a perimeter score function to determine a target grid area corresponding to the subspace to be generated includes: Calculating the area score, shape score and perimeter score corresponding to each of the candidate grid areas based on the area score function, the shape score function and the perimeter score function respectively; Summing the area score, shape score and perimeter score corresponding to the same candidate grid area to obtain a comprehensive score corresponding to the candidate grid area; Based on the comprehensive scores corresponding to the candidate grid areas, the multiple candidate grid areas are screened to obtain the target grid area.
6. A spatial region generating device for generating a room structure, characterized in that: include: A first processing module, configured to determine a target grid point corresponding to the subspace to be generated in the grid area based on at least one of first relative position information of each grid point in the grid area relative to the grid area and second relative position information between the grid point and the target subspace; The target subspace is a subspace having a position restriction relationship with the subspace to be generated; A second processing module is used to expand around the target grid point as a base point to determine a plurality of candidate grid areas corresponding to the target subspace in the grid area, each of the candidate grid areas includes the target grid point and at least one other grid point; A third processing module, configured to determine a target grid area corresponding to the subspace to be generated based on the multiple candidate grid areas; The first processing module is further used for: Determining a first weight corresponding to each of the grid points based on first relative position information of each of the grid points relative to a midpoint of the grid area; Determining a second weight corresponding to each of the grid points based on second relative position information between each of the grid points and each of the target subspaces; Based on at least one of the first weight and the second weight, determining a target grid point corresponding to the subspace to be generated in the grid area; The first relative position information is the relative position of the grid point in the entire grid area; the second relative position information is the relative position between the grid point and the target subspace; The subspace to be generated is a room; the target grid point is an initial room position corresponding to the subspace to be generated.
7. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the program, the spatial area generation method for generating a room structure as described in any one of claims 1 to 5 is implemented.
8. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method for generating a spatial region for generating a room structure as described in any one of claims 1 to 5 is implemented.
9. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the method for generating a spatial area for generating a room structure as claimed in any one of claims 1 to 5 is implemented.
Citation Information
Patent Citations
Site selection method and device
CN111091417A
Screening point layout position screening method and device and computer equipment
CN115935060A