Methods for processing and searching objects in a two-dimensional planar scene
By constructing a hybrid HV tree and R tree structure in a two-dimensional planar scene, the problem of low query efficiency for large-scale, widely distributed, and locally overlapping objects is solved, achieving efficient object storage and improved query performance.
Patent Information
- Application Number
- CN202280088833.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-03-07
- Publication Date
- 2025-10-28
- Estimated Expiration
- 2042-03-07
AI Technical Summary
In two-dimensional planar scenarios, existing R-trees and HV-trees have low query efficiency when dealing with large-scale, widely distributed, and locally overlapping objects. In particular, as the number of objects increases, the query complexity increases linearly, leading to a performance degradation.
A hybrid tree structure is adopted. By determining whether the number of objects exceeds a threshold, the space is divided into subspaces using cutting lines. A combined structure of HV tree and R tree is constructed based on the number of objects, including cutting tree and R tree, to optimize object storage and query methods.
It improves the efficiency of regional queries for large data objects, increasing query performance by 30%-50%, while also significantly improving efficiency for queries with small data volumes.
Smart Images

Figure CN118541684B_ABST
Abstract
Description
Technical Field
[0001] The embodiments of this disclosure generally relate to the field of object processing and searching in two-dimensional planar scenes, and more specifically, to a method for processing objects in a two-dimensional planar scene, a method for searching for objects in a two-dimensional planar scene, an electronic device, a computer-readable storage medium, and a computer program product. Background Technology
[0002] In IC design, computer-aided design software is now used to complete the functional design, synthesis, verification, placement, and routing processes of very large-scale integrated circuit chips. During placement and layout, a crucial operation is region lookup (or region search), which requires finding objects that intersect with a given rectangular search box within a very short time. For example, in the zooming and panning of a graphical user interface (GUI), it is necessary to quickly obtain and display all objects within the search box; these objects represent the bounding rectangles of numerous electronic components.
[0003] Region lookup in a two-dimensional planar scene can be abstracted into the following problem: given a set of polygons (e.g., rectangles) of indeterminate size and random position in space, input a search box, and output the set of rectangles that intersect with the search box. Figure 1 The image shows objects and a search box in a two-dimensional planar scene. For example... Figure 1 The solid-line rectangular border 101 represents the large number of objects given before the query, and the dashed-line rectangular border 102 is the search box. The region query algorithm needs to return the eight solid-line rectangular borders 101 that intersect with the search box 102, which are the eight objects.
[0004] The most intuitive solution to the region search problem described above is to traverse all objects and determine whether each object intersects with the search box. However, this method has a time complexity of O(N), where N is the number of objects. As the data size increases, the search time increases linearly. Therefore, an efficient data structure is needed to store objects based on their positional relationships. Currently, there are many data structures available for region searches, among which the more efficient ones include R-trees (also known as rectangular trees) and HV trees (also known as horizontal / vertical trees).
[0005] In R-trees, when objects are widely distributed, the bounding rectangles of parent nodes can easily overlap, which impacts query efficiency. Furthermore, each insertion and deletion of an object causes a change in the bounding rectangle, and since R-trees must maintain balance, the efficiency of inserting and deleting objects in an R-tree structure is relatively low.
[0006] For HV trees, when the data size of the objects is very large, the number of objects on the cut lines of the HV tree will be large, and the number of cuts will increase significantly, leading to an increase in the number of nodes and reducing query efficiency. Additionally, when there is significant object overlap, since there is no upper limit to the number of objects on a single cut node in the cut tree, query efficiency will also be affected.
[0007] Therefore, there is a need for a solution for efficient object querying in two-dimensional scenarios. Summary of the Invention
[0008] Embodiments of this disclosure provide a method for processing objects in a two-dimensional planar scene, a method for searching for objects in a two-dimensional planar scene, an electronic device, a computer-readable storage medium, and a computer program product, aimed at solving the problem of low query efficiency in scenes where the data scale of objects in a two-dimensional planar scene is large and the distribution range is wide, as well as other potential problems.
[0009] According to a first aspect of this disclosure, a method for processing objects in a two-dimensional planar scene is provided, the method comprising: determining whether the number of objects in a predetermined space of the two-dimensional planar scene exceeds a threshold; in response to the number of objects in the predetermined space exceeding the threshold, cutting the predetermined space with a cutting line having a first extending direction to divide the predetermined space into two subspaces; constructing a cutting tree in an HV tree structure from the objects on the cutting line having the first extending direction; determining whether the number of objects in each subspace exceeds the threshold; in response to the number of objects in the corresponding subspace not exceeding the threshold, constructing an R-tree from the objects in the corresponding subspace; and in response to the number of objects in the corresponding subspace exceeding the threshold, changing the cutting direction and further dividing the corresponding subspace into two subspaces with a cutting line having a second extending direction perpendicular to the first extending direction.
[0010] By utilizing the tree-structured storage object constructed according to embodiments of this disclosure, the problem of low efficiency in regional queries for large amounts of data can be solved. For scenarios with large amounts of object data, a wide planar distribution of objects, and significant local overlap, using such a tree-structured storage object can improve query performance by 30%-50% compared to other object storage methods. Furthermore, it can significantly improve query performance for regional queries with small amounts of data.
[0011] In some embodiments, the method further includes: constructing an R-tree from the objects in the predetermined space in response to the fact that the number of objects in the predetermined space does not exceed the threshold.
[0012] In some embodiments, the predetermined space is the entire space of the two-dimensional planar scene or a subspace obtained by cutting the entire space of the two-dimensional planar scene once or multiple times.
[0013] In some embodiments, constructing objects on the cutting line having the first extension direction into a cutting tree in an HV tree structure includes at least one of the following: constructing objects on the cutting line having the first extension direction into a binary search tree; and sorting the objects on the cutting line having the first extension direction using an array.
[0014] In some embodiments, the method further includes: constructing objects on the cutting line having the second extension direction into a cutting tree in an HV tree structure; determining whether the number of objects in each of the two subspaces obtained by further dividing the corresponding subspace exceeds the threshold; in response to the number of objects in the corresponding subspace not exceeding the threshold, constructing objects in the corresponding subspace into an R-tree; and in response to the number of objects in the corresponding subspace exceeding the threshold, changing the cutting direction and further dividing the corresponding subspace into two subspaces using the cutting line having the first extension direction.
[0015] In some embodiments, constructing objects on the cutting line having the second extension direction into a cutting tree in an HV tree structure includes at least one of the following: constructing objects on the cutting line having the second extension direction into a binary search tree; and sorting the objects on the cutting line having the second extension direction using an array.
[0016] In some embodiments, constructing an R-tree from objects in a corresponding subspace includes aggregating a predetermined number of objects that are close to each other in the corresponding subspace.
[0017] In some embodiments, the method further includes: in response to the fact that all objects in the entire space of the two-dimensional planar scene are already in the corresponding tree nodes, outputting a tree structure composed of the cutting tree and the R-tree.
[0018] In some embodiments, the first extending direction is one of a horizontal extending direction and a vertical extending direction, and the second extending direction is the other of a horizontal extending direction and a vertical extending direction.
[0019] In some embodiments, the two-dimensional planar scene includes at least one of an IC chip design scene, a map query scene, and a pixel retrieval scene.
[0020] According to a second aspect of this disclosure, a method is provided for searching for objects in a two-dimensional planar scene, wherein objects in the entire space of the two-dimensional planar scene are constructed into a tree structure, the tree structure including cut nodes and leaf nodes, each cut node pointing to a first subtree, a second subtree, and a cut tree in an HV tree structure, each cut tree storing objects on a cut line, and each leaf node pointing to an R tree, the method comprising: inputting a search box into the tree structure; determining whether a current node is a cut node; in response to the current node being a leaf node but not a cut node, searching for objects in the R tree pointed to by the current node using the search box; and in response to the current node being a cut node, searching for objects in the cut tree pointed to by the current node using the search box.
[0021] By utilizing the embodiments of this disclosure to search for objects in a tree structure, the problem of low efficiency in regional queries for large amounts of objects can be solved. For scenarios with large amounts of object data, a wide planar distribution of objects, and significant local overlap, this query method is expected to improve query performance by 30%-50% compared to other object query methods. It can also significantly improve query performance for regional queries with small amounts of data.
[0022] In some embodiments, the method further includes: in response to the current node being the cutting node, determining whether the cutting line corresponding to the current node passes through the search box; in response to the cutting line corresponding to the current node passing through the search box, using the search box to search for an object in both the first subtree and the second subtree pointed to by the current node; and in response to the cutting line corresponding to the current node not passing through the search box, using the search box to search for an object in the subtrees intersecting the search box in the first subtree and the second subtree pointed to by the current node.
[0023] In some embodiments, searching for an object in both the first subtree and the second subtree pointed to by the current node using the search box includes: determining whether the root node of each subtree in the first subtree and the second subtree is the cutting node; in response to the corresponding root node not being the cutting node but being the leaf node, searching for an object in the R-tree pointed to by the corresponding root node using the search box; and in response to the corresponding root node being the cutting node, searching for an object in the cutting tree pointed to by the corresponding root node using the search box.
[0024] In some embodiments, using the search box to search for an object in both the first subtree and the second subtree pointed to by the current node further includes: in response to the corresponding root node being the cutting node, determining whether the cutting line corresponding to the corresponding root node passes through the search box; in response to the cutting line corresponding to the corresponding root node passing through the search box, using the search box to search for an object in both the first subtree and the second subtree pointed to by the corresponding root node; and in response to the cutting line corresponding to the corresponding root node not passing through the search box, using the search box to search for an object in the subtrees of the first subtree and the second subtree pointed to by the corresponding root node that intersect with the search box.
[0025] In some embodiments, searching for an object in the subtrees intersecting the search box in the first and second subtrees pointed to by the current node using the search box includes: determining whether the root node of the subtree intersecting the search box in the first and second subtrees is the cutting node; in response that the root node is not the cutting node but the leaf node, searching for an object in the R-tree pointed to by the root node using the search box; and in response that the root node is the cutting node, searching for an object in the cutting tree pointed to by the root node using the search box.
[0026] In some embodiments, searching for an object using the search box in the subtrees intersecting the search box in the first and second subtrees pointed to by the current node further includes: determining whether a cutting line corresponding to the root node passes through the search box in response to the root node being the cutting node; searching for an object in both the first and second subtrees pointed to by the root node using the search box in response to the cutting line corresponding to the root node passing through the search box; and searching for an object in the subtrees intersecting the search box in the first and second subtrees pointed to by the root node in response to the cutting line corresponding to the root node not passing through the search box.
[0027] In some embodiments, searching for an object in the pruning tree pointed to by the current node using the search box includes: searching for an object at the root node of the pruning tree; searching for an object in the left subtree if the search box intersects with the bounding rectangle of the left subtree of the pruning tree; and searching for an object in the right subtree if the search box intersects with the bounding rectangle of the right subtree of the pruning tree.
[0028] In some embodiments, the current node is the root node or a child node of the tree structure.
[0029] According to a third aspect of this disclosure, an electronic device is provided, comprising: a processor; and a memory coupled to the processor and including instructions stored thereon, the instructions causing the electronic device to perform a method according to a first or second aspect of this disclosure when executed by the processor.
[0030] According to a fourth aspect of this disclosure, a computer-readable storage medium is provided that stores machine-executable instructions that, when executed by at least one processor, cause the at least one processor to implement the method according to a first or second aspect of this disclosure.
[0031] According to a fifth aspect of this disclosure, a computer program product is provided, which is tangibly stored in a computer-readable storage medium and includes machine-executable instructions that, when executed by a device, cause the device to perform a method according to a first or second aspect of this disclosure.
[0032] The summary section is provided to present the chosen concepts in a simplified form, which will be further described in the detailed description below. The summary section is not intended to identify key or principal features of this disclosure, nor is it intended to limit the scope of this disclosure. Attached Figure Description
[0033] The above and other objects, features, and advantages of embodiments of the present disclosure will become readily apparent from the following detailed description taken in conjunction with the accompanying drawings. Several embodiments of the present disclosure are illustrated in the drawings by way of example and not limitation.
[0034] Figure 1 The image shows objects and a search box in a two-dimensional plane scene.
[0035] Figure 2 A flowchart of a method for processing objects in a two-dimensional planar scene according to an embodiment of the present disclosure is shown.
[0036] Figure 3 A schematic diagram is shown illustrating the processing of objects in a two-dimensional planar scene using a method according to embodiments of the present disclosure.
[0037] Figure 4 A tree structure is shown obtained by processing objects in a two-dimensional planar scene using a method according to embodiments of the present disclosure.
[0038] Figure 5 A flowchart of a method for searching for objects in a two-dimensional planar scene according to an embodiment of the present disclosure is shown.
[0039] Figure 6A flowchart of a method for searching for objects in a two-dimensional planar scene according to another embodiment of the present disclosure is shown.
[0040] Figure 7 A schematic block diagram of an example device that can be used to implement embodiments of the present disclosure is shown.
[0041] In the various figures, the same or corresponding reference numerals indicate the same or corresponding parts. Detailed Implementation
[0042] Preferred embodiments of the present disclosure will now be described in more detail with reference to the accompanying drawings. While preferred embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure may be implemented in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that the present disclosure will be thorough and complete, and will fully convey the scope of the present disclosure to those skilled in the art.
[0043] The term "comprising" and its variations as used herein signify an open-ended inclusion, i.e., "including but not limited to". Unless otherwise stated, the term "or" means "and / or". The term "based on" means "at least partially based on". The terms "one example embodiment" and "one embodiment" mean "at least one example embodiment". The term "another embodiment" means "at least one additional embodiment". Terms such as "upper", "lower", "front", and "rear", indicating placement or positional relationship, are based on the orientation or positional relationship shown in the accompanying drawings and are used only for the purpose of describing the principles of this disclosure, and are not intended to indicate or imply that the elements referred to must have a specific orientation, be constructed or operated in a specific orientation, and therefore should not be construed as limiting this disclosure.
[0044] As described above, conventional methods for storing objects in a two-dimensional planar scene using R-trees and HV-trees suffer from low query efficiency when the data volume of objects in the two-dimensional planar scene is large and widely distributed. Embodiments of this disclosure provide a method for processing objects in a two-dimensional planar scene, a method for searching for objects in a two-dimensional planar scene, an electronic device, a computer-readable storage medium, and a computer program product, aiming to solve the problem of low query efficiency in scenarios with large data volume and wide distribution of objects in two-dimensional planar scenes, as well as other potential problems.
[0045] Figure 2 A flowchart of a method 200 for processing objects in a two-dimensional planar scene according to an embodiment of the present disclosure is shown. Figure 3 A schematic diagram is shown illustrating the processing of objects in a two-dimensional planar scene using a method according to embodiments of the present disclosure. Figure 4A tree structure is shown obtained by processing objects in a two-dimensional planar scene using a method according to embodiments of the present disclosure. The following will be combined with... Figures 2 to 4 This describes the process of processing objects in a two-dimensional planar scene.
[0046] like Figure 2 As shown, a set of objects in the entire space of a two-dimensional planar scene is input at point 201. In embodiments according to this disclosure, the two-dimensional planar scene may include at least one of an IC chip design scene, a map query scene, and a pixel retrieval scene. The two-dimensional planar scene may contain various objects, such as polygons (e.g., rectangles). Figure 3 As shown, 16 rectangular objects R1-R16 are illustrated in the entire space of a two-dimensional planar scene. In the following description, objects R1-R16 will be used as examples to illustrate the principles of this disclosure. It should be understood that the entire space of a two-dimensional planar scene may contain more or fewer objects and / or other types of objects, and the scope of this disclosure is not strictly limited in this respect. Furthermore, it should be understood that in other embodiments, the two-dimensional planar scene may also be other types of scenes containing objects such as polygons (e.g., rectangles), and the scope of this disclosure is not strictly limited in this respect either.
[0047] At point 202, it is determined whether the number of objects in the entire space of the two-dimensional planar scene exceeds a threshold. If yes, step 203 is executed; otherwise, step 207 is executed. In the following, a threshold of 4 will be used as an example to describe the principle of this disclosure. It should be understood that in embodiments according to this disclosure, the threshold may be larger or smaller, and the scope of this disclosure is not strictly limited in this respect. Figure 3 As shown, the entire space of the two-dimensional planar scene contains 16 objects R1-R16. The number of objects exceeds the threshold of 4, so method 200 will proceed to step 203.
[0048] At point 203, in response to the number of objects in the entire space of the two-dimensional planar scene exceeding a threshold, the entire space of the two-dimensional planar scene is cut with a cutting line having a first extending direction to divide the entire space of the two-dimensional planar scene into two subspaces. In embodiments according to this disclosure, the first extending direction is one of a horizontal extending direction and a vertical extending direction. Figure 3 As shown, the first extension direction is a horizontal extension direction. The cutting line 301 with a horizontal extension direction divides the entire space of the two-dimensional planar scene into two subspaces 311 and 312. Subspace 311 can also be the upper space, and subspace 312 can also be the lower space. In other embodiments, the first extension direction can be a vertical extension direction, that is, a cutting line with a vertical extension direction can be used to cut the entire space of the two-dimensional planar scene.
[0049] At position 204, objects on the cut lines with the first extension direction are constructed into a cut tree within the HV tree structure. For example... Figure 3 As shown, the first extension direction is a horizontal extension direction, and the cutting line 301 with the horizontal extension direction intersects with objects R8, R4, R13, and R16. Here, objects R8, R4, R13, and R16 on the cutting line 301 with the horizontal extension direction are constructed into a cutting tree in the HV tree structure. Figure 4 As shown, objects R8, R4, R13, and R16 are constructed into a cut tree 401 in the HV tree structure. Cut tree 401 is connected to the root node 400 of the entire tree structure, and the root node 400 is the cut node. Object R4 is located at the root node 4010 of cut tree 401, object R8 is located in the left subtree of the root node 4010 of cut tree 401, and objects R13 and R16 are located in the right subtree of the root node 4010 of cut tree 401. Furthermore, as... Figure 4 As shown, the root node 400 is also connected to the first subtree 411 and the second subtree 412.
[0050] In some embodiments, constructing a cut tree in an HV tree structure from objects on a cut line having a first extension direction includes at least one of the following: constructing a binary search tree from objects on a cut line having a first extension direction; and sorting the objects on a cut line having a first extension direction using an array. In other embodiments, other methods may also be used to construct a cut tree in an HV tree structure from objects on a cut line having a first extension direction, and the scope of this disclosure is not strictly limited in this respect.
[0051] At step 205, determine if the number of objects in each subspace exceeds the threshold. If yes, proceed to step 206; otherwise, proceed to step 207. Figure 3 As shown, subspace 311 contains objects R1, R2, R3, R5, R6, and R7, totaling 6 objects, which exceeds the threshold of 4. Subspace 312 contains objects R9, R10, R11, R14, and R15, totaling 5 objects, which also exceeds the threshold of 4.
[0052] At position 206, the cutting direction is changed in response to the number of objects in the corresponding subspace exceeding a threshold. For example... Figure 3 As shown, since subspace 311 contains 6 objects, exceeding the threshold 4, the cutting direction is changed from horizontal to vertical. Similarly, since subspace 312 contains 5 objects, exceeding the threshold 4, the cutting direction is also changed from horizontal to vertical. Then, at 203, the corresponding subspace is further divided into two subspaces by a cutting line with a second extending direction perpendicular to the first extending direction. Figure 3As shown, subspace 311 is cut by a cutting line 302 with a vertical extension direction to further divide subspace 3111 into two subspaces 3111 and 3112. Similarly, subspace 312 is cut by a cutting line 303 with a vertical extension direction to further divide subspace 3121 and 3122. It should be understood that when the first extension direction is a vertical extension direction, the converted second extension direction is a horizontal extension direction.
[0053] Subsequently, at position 204, objects on cut lines 302 with a second extension direction (e.g., a vertical extension direction) are constructed into cut trees within an HV tree structure, and objects on cut lines 303 with a vertical extension direction are also constructed into cut trees within an HV tree structure. For example... Figure 3 and Figure 4 As shown, since object R4 has already been assigned to the cleavage tree 401, there are no other objects on cleavage line 302, and only object R12 exists on cleavage line 303. Therefore, as Figure 4 As shown, an empty cut tree 4111 containing no objects is connected to the root node 4110 of the first subtree 411, and a cut tree 4121 containing only object R12 is connected to the root node 4120 of the second subtree 412. Both the root node 4110 of the first subtree 411 and the root node 4120 of the second subtree 412 are cut nodes, and the root node 4110 of the first subtree 411 points to the further first subtree 421 and second subtree 422, while the root node 4120 of the second subtree 412 points to the further first subtree 431 and second subtree 432.
[0054] In some embodiments, constructing a cut tree in an HV tree structure from objects on cut lines having a second extension direction includes at least one of the following: constructing a binary search tree from objects on cut lines having a second extension direction; and sorting the objects on cut lines having a second extension direction using an array. In other embodiments, other methods may also be used to construct a cut tree in an HV tree structure from objects on cut lines having a second extension direction, and the scope of this disclosure is not strictly limited in this respect.
[0055] Subsequently, in step 205, for each of the obtained subspaces 3111, 3112, 3121, and 3122, it is determined whether the number of objects in each subspace exceeds a threshold. If yes, step 206 is executed; otherwise, step 207 is executed. Figure 3As shown, subspace 3111 contains objects R1, R2, and R3, with a total of 3 objects; subspace 3112 contains objects R5, R6, and R7, with a total of 3 objects; subspace 3121 contains objects R9, R10, and R11, with a total of 3 objects; and subspace 3122 contains objects R14 and R15, with a total of 2 objects. Since the number of objects in each subspace does not exceed the threshold of 4, the objects in each subspace are constructed into R-trees. Figure 4 As shown, the root nodes 4210, 4220, 4310, and 4320 of the first subtree 421, the second subtree 422, the first subtree 431, and the second subtree 432 are all leaf nodes, pointing to the R-tree respectively. For example, as... Figure 3 and Figure 4 As shown, in subspace 3111, two objects R1 and R2 that are close in distance are aggregated into a larger rectangle BR1 and stored in the first subtree 421; in subspace 3112, two objects R5 and R6 that are close in distance are aggregated into a larger rectangle BR3 and stored in the second subtree 422; in subspace 3121, two objects R9 and R10 that are close in distance are aggregated into a larger rectangle BR5 and stored in the first subtree 431; in subspace 3122, two objects R14 and R15 that are close in distance are aggregated into a larger rectangle BR7 and stored in the second subtree 432. The outer rectangle BR2 of object R3 is stored in the first subtree 421, the outer rectangle BR6 of object R11 is stored in the first subtree 431, and the outer rectangle BR4 of object R7 is stored in the second subtree 422.
[0056] At positions 208 and 209, in response to the fact that all objects in the entire space of the two-dimensional planar scene are already in their corresponding tree nodes, the output is a tree structure consisting of a cut tree and an R-tree (also known as an Rhv tree). Figure 4 An Rhv tree structure is shown, obtained by processing objects in a two-dimensional planar scene using method 200 according to an embodiment of the present disclosure.
[0057] As mentioned above Figure 2 As shown, at point 202, it is determined whether the number of objects in the entire space of the two-dimensional planar scene exceeds a threshold, and at point 205, it is determined whether the number of objects in each subspace (which can be subspaces obtained after one or more cuts of the entire space of the two-dimensional planar scene) exceeds a threshold. These two steps can be collectively referred to as determining whether the number of objects in a predetermined space of the two-dimensional planar scene exceeds a threshold. Subsequently, based on the determination results, a combination of... Figure 2 The steps described.
[0058] In some cases, if it is determined at point 202 that the number of objects in the entire space of the two-dimensional planar scene does not exceed a threshold, then the objects in the entire space can be directly constructed into an R-tree at point 207. Thus, the objects in the two-dimensional planar scene are constructed into a tree structure. By using the tree structure constructed according to the embodiments of this disclosure to store objects, the problem of low efficiency in regional queries for large amounts of data can be solved. For scenarios with large amounts of object data, a wide planar distribution of objects, and significant local overlap, using such a tree structure to store objects results in an expected query performance improvement of 30%-50% compared to other object storage methods. For regional queries with small amounts of data, query performance can also be significantly improved.
[0059] Embodiments of this disclosure also provide a method for searching for objects in a two-dimensional planar scene. Figure 5 A flowchart of a method 500 for searching for objects in a two-dimensional planar scene according to an embodiment of the present disclosure is shown. Objects throughout the space of the two-dimensional planar scene have been constructed into a tree structure, for example, combining... Figures 2 to 4 The Rhv tree described above, combined with Figures 2 to 4 The described content can be combined with this. Figure 3 and Figure 4 As shown, the tree structure includes cut nodes (e.g., nodes 400, 4110, and 4120) and leaf nodes (4210, 4220, 4310, and 4320). Each cut node points to a first subtree (e.g., subtrees 411, 421, and 431), a second subtree (e.g., subtrees 412, 422, and 432), and a cut tree in the HV tree structure (e.g., cut trees 401, 4111, and 4121). For example, cut node 400 points to the first subtree 411, the second subtree 412, and cut tree 401; cut node 4110 points to the first subtree 421, the second subtree 422, and cut tree 4111; and cut node 4120 points to the first subtree 431, the second subtree 432, and cut tree 4121. Each cut tree stores objects on cut lines (e.g., cut lines 301, 302, and 303). For example, cleaving tree 401 stores objects on cleaving line 301; cleaving tree 4111 stores objects on cleaving line 302; and cleaving tree 4121 stores objects on cleaving line 303. Each leaf node (e.g., nodes 4210, 4220, 4310, and 4320) points to an R-tree. Leaf node 4210 points to an R-tree that stores objects in subspace 3111. Leaf node 4220 points to an R-tree that stores objects in subspace 3112. Leaf node 4310 points to an R-tree that stores objects in subspace 3121. Leaf node 4320 points to an R-tree that stores objects in subspace 3122.
[0060] like Figure 5As shown, at position 501, the input search box is entered into the tree structure, for example, into the combination. Figures 2 to 4 The described Rhv tree. The search box can be rectangular or other shapes. During a query, the search is performed from top to bottom in the tree structure.
[0061] At step 502, determine if the current node is a cutting node. If it is, proceed to step 504; otherwise, proceed to step 503. Figure 4 As shown, when the current node is node 400, 4110, or 4120, it is a cutting node, so step 504 is executed; while when the current node is node 4210, 4220, 4310, or 4320, it is a leaf node, not a cutting node, so step 503 is executed.
[0062] At point 503, in response to the current node being a leaf node instead of a cutoff node, the search box is used to search for the object in the R tree pointed to by the current node. For example... Figure 4 As shown, when the current node is any of nodes 4210, 4220, 4310, and 4320, the object is searched in the corresponding R-tree pointed to by the current node.
[0063] At position 504, in response to the current node being a cut node, the search box is used to search for the object in the cut tree pointed to by the current node. For example... Figure 4 As shown, when the current node is any of the nodes 400, 4110, and 4120, the search box is used to search for objects in the corresponding cutting trees 401, 4111, and 4121 pointed to by the current node.
[0064] At position 505, in response to the current node being a cutting node, it checks whether the cutting line corresponding to the current node crosses the search box. For example, if... Figure 4 As shown, when the current node is node 400, it is determined whether the cutting line 301 corresponding to node 400 passes through the search box; when the current node is node 4110, it is determined whether the cutting line 302 corresponding to node 4110 passes through the search box; when the current node is node 4120, it is determined whether the cutting line 303 corresponding to node 4120 passes through the search box.
[0065] At position 506, in response to the cutting line corresponding to the current node crossing the search box, the search box is used to search for the object in both the first and second subtrees pointed to by the current node. For example, as... Figure 3 and Figure 4 As shown, when the current node is node 400, if the cutting line 301 corresponding to node 400 passes through the search box, the search box is used to search for the object in the first subtree 411 and the second subtree 412 pointed to by node 400.
[0066] In some embodiments, at 506, searching for an object in both the first subtree and the second subtree pointed to by the current node using a search box includes: determining whether the root node of each subtree in the first subtree and the second subtree is a cutting node; in response that the corresponding root node is not a cutting node but a leaf node, searching for an object in the R-tree pointed to by the corresponding root node using a search box; and in response that the corresponding root node is a cutting node, searching for an object in the cutting tree pointed to by the corresponding root node using a search box.
[0067] In some embodiments, at 506, searching for an object in both the first subtree and the second subtree pointed to by the current node using the search box further includes: in response to the corresponding root node being a cutting node, determining whether the cutting line corresponding to the corresponding root node passes through the search box; in response to the cutting line corresponding to the corresponding root node passing through the search box, searching for an object in both the first subtree and the second subtree pointed to by the corresponding root node using the search box; and in response to the cutting line corresponding to the corresponding root node not passing through the search box, searching for an object in the subtrees of the first and second subtrees pointed to by the corresponding root node that intersect with the search box using the search box.
[0068] At point 507, in response to the cut line corresponding to the current node not crossing the search box, the search box is used to search for the object in the subtrees of the first and second subtrees pointed to by the current node that intersect with the search box. For example, as... Figure 3 and Figure 4 As shown, when the current node is node 400, if the cutting line 301 corresponding to node 400 does not pass through the search box, the search box is used to search for the object in the subtrees that intersect with the search box in the first subtree 411 and the second subtree 412 pointed to by node 400, instead of searching for the object in the other subtree.
[0069] In some embodiments, at 507, searching for an object in the subtrees intersecting the search box in the first and second subtrees pointed to by the current node using the search box includes: determining whether the root node of the subtree intersecting the search box in the first and second subtrees is a cutting node; in response that the root node is not a cutting node but a leaf node, searching for an object in the R-tree pointed to by the root node using the search box; and in response that the root node is a cutting node, searching for an object in the cutting tree pointed to by the root node using the search box.
[0070] In some embodiments, at 507, searching for an object in the subtrees intersecting the search box in the first and second subtrees pointed to by the current node using the search box further includes: determining whether the cutting line corresponding to the root node passes through the search box in response to the root node being a cutting node; searching for an object in both the first and second subtrees pointed to by the root node using the search box in response to the cutting line corresponding to the root node passing through the search box; and searching for an object in the subtrees intersecting the search box in the first and second subtrees pointed to by the root node in response to the cutting line corresponding to the root node not passing through the search box.
[0071] After repeating steps 502 to 507 for the root node and each child node of the tree structure, all objects found that intersect with the search box are output at point 508. By using the embodiments of this disclosure to search for objects in the tree structure, the problem of low efficiency in regional queries for large amounts of objects can be solved. For scenarios with large amounts of object data, a wide planar distribution of objects, and significant local overlap, this query method is expected to improve query performance by 30%-50% compared to other object query methods. It can also significantly improve query performance for regional queries with small amounts of data.
[0072] Figure 6 A flowchart of a method 500 for searching for objects in a two-dimensional planar scene according to another embodiment of the present disclosure is shown. Figure 6 Method 500 shown Figure 5 The method shown is similar to 500. For example... Figure 6 As shown, in some embodiments, at 504, searching for an object in the slicing tree pointed to by the current node using the search box includes: searching for the object at the root node of the slicing tree; searching for the object in the left subtree if the search box intersects with the bounding rectangle of the left subtree of the slicing tree; and searching for the object in the right subtree if the search box intersects with the bounding rectangle of the right subtree of the slicing tree.
[0073] Figure 7 A schematic block diagram of a device 1300 that can be used to implement embodiments of the present disclosure is shown. Figure 7 As shown, device 1300 includes a central processing unit (CPU) 1301, which can perform various appropriate actions and processes according to computer program instructions stored in read-only memory (ROM) 1302 or loaded from storage unit 1308 into random access memory (RAM) 1303. The RAM 1303 may also store various programs and data required for the operation of device 1300. The CPU 1301, ROM 1302, and RAM 1303 are interconnected via bus 1304. An input / output (I / O) interface 1305 is also connected to bus 1304.
[0074] Multiple components in device 1300 are connected to I / O interface 1305, including: input unit 1306, such as keyboard, mouse, etc.; output unit 1307, such as various types of monitors, speakers, etc.; storage unit 1308, such as disk, optical disk, etc.; and communication unit 1309, such as network card, modem, wireless transceiver, etc. Communication unit 1309 allows device 1300 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.
[0075] The various processes and procedures described above, such as method 200 or method 500, may be executed by processing unit 1301. For example, in some embodiments, method 200 or method 500 may be implemented as a computer software program tangibly contained in a machine-readable medium, such as storage unit 1308. In some embodiments, part or all of the computer program may be loaded and / or installed on device 1300 via ROM 1302 and / or communication unit 1309. When the computer program is loaded into RAM 1303 and executed by CPU 1301, one or more steps of method 200 or method 500 described above may be performed.
[0076] This disclosure can be a method, apparatus, system, and / or computer program product. A computer program product may include a computer-readable storage medium having computer-readable program instructions loaded thereon for performing various aspects of this disclosure.
[0077] Computer-readable storage media can be tangible devices capable of holding and storing instructions for use by an instruction execution device. Computer-readable storage media can be, for example, but not limited to, electrical storage devices, magnetic storage devices, optical storage devices, electromagnetic storage devices, semiconductor storage devices, or any suitable combination of the foregoing. More specific examples (a non-exhaustive list) of computer-readable storage media include: portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), static random access memory (SRAM), portable compact disc read-only memory (CD-ROM), digital multifunction disc (DVD), memory sticks, floppy disks, mechanical encoding devices, such as punch cards or recessed protrusions storing instructions thereon, and any suitable combination of the foregoing. The computer-readable storage media used herein are not to be construed as transient signals themselves, such as radio waves or other freely propagating electromagnetic waves, electromagnetic waves propagating through waveguides or other transmission media (e.g., light pulses through fiber optic cables), or electrical signals transmitted through wires.
[0078] The computer-readable program instructions described herein can be downloaded from computer-readable storage media to various computing / processing devices, or downloaded via a network, such as the Internet, local area network, wide area network, and / or wireless network, to an external computer or external storage device. The network may include copper transmission cables, fiber optic transmission, wireless transmission, routers, firewalls, switches, gateway computers, and / or edge servers. A network adapter card or network interface in each computing / processing device receives the computer-readable program instructions from the network and forwards them to the computer-readable storage media in the respective computing / processing device.
[0079] Computer program instructions used to perform the operations of this disclosure may be assembly instructions, instruction set architecture (ISA) instructions, machine instructions, machine-dependent instructions, microcode, firmware instructions, status setting data, or source code or object code written in any combination of one or more programming languages, including object-oriented programming languages such as Smalltalk, C++, etc., and conventional procedural programming languages such as the "C" language or similar programming languages. The computer-readable program instructions may execute entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving a remote computer, the remote computer may be connected to the user's computer via any type of network—including a local area network (LAN) or a wide area network (WAN)—or may be connected to an external computer (e.g., via the Internet using an Internet service provider). In some embodiments, electronic circuitry, such as programmable logic circuitry, field-programmable gate arrays (FPGAs), or programmable logic arrays (PLAs), is personalized by utilizing the status information of the computer-readable program instructions to implement various aspects of this disclosure.
[0080] Various aspects of this disclosure are described herein with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this disclosure. It should be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer-readable program instructions.
[0081] These computer-readable program instructions can be provided to a processing unit of a general-purpose computer, a special-purpose computer, or other programmable data processing apparatus to produce a machine such that, when executed by the processing unit of the computer or other programmable data processing apparatus, they create means for implementing the functions / actions specified in one or more blocks of the flowchart and / or block diagram. These computer-readable program instructions can also be stored in a computer-readable storage medium that causes a computer, programmable data processing apparatus, and / or other device to operate in a particular manner. Thus, the computer-readable medium storing the instructions comprises an article of manufacture that includes instructions for implementing aspects of the functions / actions specified in one or more blocks of the flowchart and / or block diagram.
[0082] Computer-readable program instructions may also be loaded onto a computer, other programmable data processing apparatus, or other device so that a series of operational steps are performed on the computer, other programmable data processing apparatus, or other device to produce a computer-implemented process, thereby causing the instructions executed on the computer, other programmable data processing apparatus, or other device to implement the functions / actions specified in one or more blocks in the flowchart and / or block diagram.
[0083] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of the present disclosure. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of an instruction containing one or more executable instructions for implementing a specified logical function. In some alternative implementations, the functions marked in the blocks may occur in a different order than those shown in the drawings. For example, two consecutive blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, may be implemented using a dedicated hardware-based system that performs the specified function or action, or using a combination of dedicated hardware and computer instructions.
[0084] The various embodiments of this disclosure have been described above. These descriptions are exemplary and not exhaustive, and are not limited to the disclosed embodiments. Many modifications and variations will be apparent to those skilled in the art without departing from the scope and spirit of the described embodiments. The terminology used herein is chosen to best explain the principles, practical applications, or technical improvements to the technology in the market, or to enable others skilled in the art to understand the embodiments disclosed herein.
Claims
1. A method for processing objects in a two-dimensional planar scene, characterized in that, The method includes: Determine whether the number of objects in the predetermined space of the two-dimensional planar scene exceeds a threshold; In response to the number of objects in the predetermined space exceeding the threshold, the predetermined space is cut with a cutting line having a first extending direction to divide the predetermined space into two subspaces; Objects on the cutting lines with the first extension direction are constructed into a cutting tree in the HV tree structure; Determine whether the number of objects in each subspace exceeds the threshold. In response to the fact that the number of objects in the corresponding subspace does not exceed the threshold, the objects in the corresponding subspace are constructed into an R-tree; and In response to the number of objects in the corresponding subspace exceeding the threshold, the cutting direction is changed, and the corresponding subspace is further divided into two subspaces by a cutting line having a second extending direction perpendicular to the first extending direction.
2. The method according to claim 1, characterized in that, The method further includes: in response to the fact that the number of objects in the predetermined space does not exceed the threshold, constructing the objects in the predetermined space into an R-tree.
3. The method according to claim 1, characterized in that, The predetermined space is the entire space of the two-dimensional plane scene or a subspace obtained by cutting the entire space of the two-dimensional plane scene once or multiple times.
4. The method according to claim 1, characterized in that, Constructing objects along the cutting line with the first extension direction into a cutting tree in the HV tree structure includes at least one of the following: Construct a binary search tree from the objects on the cutting line with the first extension direction; as well as Sort the objects on the cutting line with the first extension direction using an array.
5. The method according to claim 1, characterized in that, The method further includes: Objects on the cutting lines with the second extension direction are constructed into a cutting tree in the HV tree structure; Determine whether the number of objects in each of the two subspaces obtained by further dividing the corresponding subspace exceeds the threshold. In response to the fact that the number of objects in the corresponding subspace does not exceed the threshold, the objects in the corresponding subspace are constructed into an R-tree; and In response to the number of objects in the corresponding subspace exceeding the threshold, the cutting direction is changed, and the corresponding subspace is further divided into two subspaces by a cutting line having the first extension direction.
6. The method according to claim 5, characterized in that, Constructing a cut tree in an HV tree structure from objects on cut lines having the second extension direction includes at least one of the following: Construct a binary search tree from the objects on the cutting line with the second extension direction; as well as Sort the objects on the cutting line with the second extension direction using an array.
7. The method according to claim 1, characterized in that, Constructing an R tree from objects in the corresponding subspace includes: Aggregate a predetermined number of objects that are close to each other in the corresponding subspace.
8. The method according to claim 1, characterized in that, The method further includes: In response to the fact that all objects in the entire space of the two-dimensional plane scene are already in their corresponding tree nodes, a tree structure consisting of the cutting tree and the R-tree is output.
9. The method according to claim 1, characterized in that, The first extending direction is one of the horizontal extending direction and the vertical extending direction, and the second extending direction is the other of the horizontal extending direction and the vertical extending direction.
10. The method according to claim 1, characterized in that, The two-dimensional planar scene includes at least one of the following: IC chip design scene, map query scene, and pixel retrieval scene.
11. A method for searching for objects in a two-dimensional planar scene, wherein objects in the entire space of the two-dimensional planar scene are constructed into a tree structure, characterized in that, The tree structure includes cut nodes and leaf nodes. Each cut node points to the first subtree, the second subtree, and the cut tree in the HV tree structure. Each cut tree stores objects on the cut line. Each leaf node points to the R tree. The method includes: Enter the search box into the tree structure; Determine whether the current node is the cutting node; In response to the current node being a leaf node instead of a cutting node, the search box is used to search for an object in the R-tree pointed to by the current node; and In response to the current node being the cutting node, the search box is used to search for an object in the cutting tree pointed to by the current node.
12. The method according to claim 11, characterized in that, The method further includes: In response to the fact that the current node is the cutting node, determine whether the cutting line corresponding to the current node passes through the search box; In response to a cutting line corresponding to the current node passing through the search box, the search box is used to search for an object in both the first subtree and the second subtree pointed to by the current node; and In response to the cutting line corresponding to the current node not passing through the search box, the search box is used to search for an object in the subtrees that intersect with the search box in the first subtree and the second subtree pointed to by the current node.
13. The method according to claim 12, characterized in that, The search objects used in the search box within both the first subtree and the second subtree pointed to by the current node include: Determine whether the root node of each subtree in the first subtree and the second subtree is the cutting node; In response to the root node being a leaf node instead of the cut node, the search box is used to search for the object in the R-tree pointed to by the corresponding root node; and In response to the fact that the corresponding root node is the cutting node, the search box is used to search for the object in the cutting tree pointed to by the corresponding root node.
14. The method according to claim 13, characterized in that, The search object used in the search box within both the first subtree and the second subtree pointed to by the current node also includes: In response to the fact that the corresponding root node is the cutting node, determine whether the cutting line corresponding to the corresponding root node passes through the search box; In response to a cutting line corresponding to the root node passing through the search box, the search box is used to search for an object in both the first subtree and the second subtree pointed to by the root node; and In response to a cutting line corresponding to the root node not passing through the search box, the search box is used to search for an object in the subtrees of the first and second subtrees pointed to by the root node that intersect with the search box.
15. The method according to claim 12, characterized in that, The search for objects using the search box within the subtrees intersecting the first and second subtrees pointed to by the current node includes: Determine whether the root node of the subtree that intersects with the search box in the first subtree and the second subtree is the cutting node; In response to the root node being a leaf node instead of the cutting node, the search box is used to search for an object in the R-tree pointed to by the root node; and In response that the root node is the cutting node, the search box is used to search for an object in the cutting tree pointed to by the root node.
16. The method according to claim 15, characterized in that, The search for objects using the search box within the subtrees intersecting the search box in the first and second subtrees pointed to by the current node further includes: In response to the fact that the root node is the cutting node, determine whether the cutting line corresponding to the root node passes through the search box; In response to a cutting line corresponding to the root node passing through the search box, the search box is used to search for an object in both the first subtree and the second subtree pointed to by the root node; and In response to the cutting line corresponding to the root node not passing through the search box, the search box is used to search for an object in the subtrees that intersect with the search box in the first subtree and the second subtree pointed to by the root node.
17. The method according to claim 11, characterized in that, Searching for objects in the slicing tree pointed to by the current node using the search box includes: Search for objects at the root node of the cut tree; If the search box intersects the bounding rectangle of the left subtree of the cut tree, then the object is searched in the left subtree; and If the search box intersects with the bounding rectangle of the right subtree of the cut tree, then the object is searched in the right subtree.
18. The method according to claim 11, characterized in that, The current node is either the root node or a child node of the tree structure.
19. An electronic device comprising: processor; as well as A memory, coupled to the processor and including instructions stored thereon, which, when executed by the processor, cause the electronic device to perform the method according to any one of claims 1-18.
20. A computer-readable storage medium storing machine-executable instructions that, when executed by at least one processor, cause the at least one processor to perform the method according to any one of claims 1-18.
21. A computer program product tangibly stored in a computer-readable storage medium and comprising machine-executable instructions that, when executed by a device, cause the device to perform the method according to any one of claims 1-18.
Citation Information
Patent Citations
Method for judging inside and outside within area
JP1996320938A
Picture partition method and device
WO2020043136A1