A method, device and medium for adaptively processing regional overlap of cluster maps
By dividing virtual blocks in the cluster map and replacing data points, the problem of area overlap is solved, adaptive processing is realized, and class boundary clarity and visualization quality are improved.
Patent Information
- Application Number
- CN202411202754.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-29
- Publication Date
- 2025-04-01
- Estimated Expiration
- 2044-08-29
AI Technical Summary
When dealing with the problem of overlapping regions in clustering maps, the prior art requires setting multiple sets of thresholds, which are not robust and do not have adaptive effects.
By obtaining various regions in the clustering map, dividing overlapping regions into two virtual blocks belonging to the two target regions, and replacing data points located in the virtual block of the other target region with each other, updating the boundaries of each target region.
Adaptive processing of overlapping cluster map regions is realized, the clarity of class boundaries is improved, and it is suitable for different data orders and distributions, with high robustness and reduced the ambiguity problem of visualization.
Smart Images

Figure CN119106166B_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present invention relate to the technical field of data visualization, and in particular to a method, device and medium for adaptively processing regional overlap of a cluster map. Background Art
[0002] The era of big data has had a profound impact on cluster map visualization. With the explosive growth of data volume, cluster maps are no longer limited to traditional small-scale data set analysis, but can analyze larger data sets. In visual analysis, large amounts of data will increase the complexity of visualization. In the process of cluster map generation, there is a certain impact on the accuracy of the region, and often faces problems of accuracy and ambiguity, such as outliers, regional overlap, and regional inclusion.
[0003] Currently, most of the problems of area overlap are handled through clustering algorithms, grid algorithms, point movement and area movement. These methods require setting multiple sets of thresholds. Whether the threshold settings are reasonable has a great impact on the processing results, and the robustness is poor. In addition, when processing different data, the thresholds need to be modified, and they do not have an adaptive effect.
[0004] In view of this, the present invention provides a method for adaptively processing regional overlap of cluster maps applicable to various data levels. Summary of the invention
[0005] The embodiments of the present invention provide a method, device and medium for adaptively processing regional overlap of a cluster map to solve the above technical problems.
[0006] In a first aspect, an embodiment of the present invention provides a method for adaptively processing region overlap of a cluster map, comprising:
[0007] S10, obtaining areas of each type of multiple data types in the cluster map;
[0008] S20, for two overlapping target areas, dividing the overlapping area into two virtual blocks respectively belonging to the two target areas;
[0009] S30, replacing data points in each target area that are located in a virtual block belonging to another target area with each other;
[0010] S40: Update the boundaries of each target area according to the replaced data points.
[0011] In a second aspect, an embodiment of the present invention provides an electronic device, the electronic device comprising:
[0012] one or more processors;
[0013] a memory for storing one or more programs,
[0014] When the one or more programs are executed by the one or more processors, the one or more processors implement the method for adaptively processing area overlap of a cluster map as described in any one of the embodiments.
[0015] In a third aspect, an embodiment of the present invention further provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the method for adaptively processing regional overlap of a cluster map as described in any one of the embodiments.
[0016] The embodiment of the present invention provides a method for adaptively processing regional overlap of a cluster map. First, it is determined whether there is a regional overlap problem in the cluster map. If so, the overlapping area is divided into two parts using a geometric method, and the abnormal points in the two parts are processed by node replacement, thereby solving the regional overlap problem of the cluster map and improving the clarity of the class boundary. The method is applicable to data of different data magnitudes and different distributions. Regional overlap can be eliminated only by judging geometric relationships. No parameter setting is required. The method has high robustness and achieves true adaptation. At the same time, the method can improve the accuracy of the map, so that the map has clear class boundaries, improve the quality of visualization, as well as the transparency and comprehensibility of the data, and reduce the problem of ambiguity in visualization. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] In order to more clearly illustrate the specific implementation methods of the present invention or the technical solutions in the prior art, the drawings required for use in the specific implementation methods or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some implementation methods of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0018] Figure 1 It is a flow chart of a method for adaptively processing regional overlap of a cluster map provided by an embodiment of the present invention;
[0019] Figure 2 is a schematic diagram of a region overlap and a processing process thereof provided by an embodiment of the present invention;
[0020] Figure 3 is a comparison diagram before and after region overlap processing using the method of this embodiment provided by an embodiment of the present invention;
[0021] Figure 4 is another comparison diagram before and after the region overlap processing is performed using the method of this embodiment provided by the embodiment of the present invention;
[0022] Figure 5 A schematic diagram of the structure of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0023] In order to make the purpose, technical solution and advantages of the present invention clearer, the technical solution of the present invention will be described clearly and completely below. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work belong to the scope of protection of the present invention.
[0024] In the description of the present invention, it should be noted that the terms "center", "upper", "lower", "left", "right", "vertical", "horizontal", "inner", "outer", etc., indicating the orientation or positional relationship, are based on the orientation or positional relationship shown in the drawings, and are only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as limiting the present invention. In addition, the terms "first", "second", and "third" are used for descriptive purposes only, and cannot be understood as indicating or implying relative importance.
[0025] In the description of the present invention, it is also necessary to explain that, unless otherwise clearly specified and limited, the terms "installed", "connected", and "connected" should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection, or it can be indirectly connected through an intermediate medium, or it can be the internal communication of two components. For ordinary technicians in this field, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.
[0026] Figure 1 1 is a flow chart of a method for adaptively processing overlapping regions of a cluster map provided by an embodiment of the present invention. The method is applicable to the case where overlapping regions exist in a data cluster map and is executed by an electronic device. Figure 1 As shown, the method specifically includes:
[0027] S110, obtaining areas of each of the multiple data classes in the cluster map.
[0028] The multiple data classes refer to multiple types of data that have been pre-clustered, and the specific content of the data is not limited. For example, in the field of network security, the specific data can be an ASN number, and each data point of the data class in the cluster map represents an ASN number. This step first obtains the regional information of each data class in the cluster map, including the regional boundary coordinates and data point coordinates, as the data source of the entire method. Among them, the data point can also be called a node.
[0029] In a specific implementation, the region boundary coordinates of each class and the node coordinates of each class can be recorded as cluster_boundary and cluster_position, respectively, both of which are stored in dictionary form, where the key of cluster_boundary is the class id, and the value is the two-dimensional coordinates of the region boundary point; the key of cluster_positionion is the class id, and the value is the two-dimensional coordinates of the data point, both of which are two-dimensional lists.
[0030] S120. If two target areas overlap, divide the overlapping area into two virtual blocks respectively belonging to the two target areas.
[0031] In this step, each pair of overlapping areas in the cluster map is first determined, and these areas are referred to as target areas in this embodiment; then, the overlapping parts of each two target areas are respectively determined, also referred to as overlapping areas; and each overlapping area is divided into two blocks belonging to the two target areas respectively, as an auxiliary tool for processing area overlap. Since these blocks are only used to process the coordinate points of the overlapping areas and the target areas have not yet been actually cut, these blocks are referred to as virtual blocks.
[0032] Optionally, if two areas intersect and the intersecting part is not a line segment, the two areas are determined as two overlapping target areas. In a specific implementation, the area boundary coordinates can be uniformly converted into polygon objects, and two for loops are used to traverse the area boundaries of a certain class to see if there is an overlapping relationship with other class areas. The overlapping relationship can be judged by the intersects and touches functions: the intersects function is used to determine whether two geometric figures intersect, and the intersection includes the situation where only shared edges exist; the touches function is used to determine whether two geometric figures have a shared boundary; and the judgment condition for the existence of an overlapping relationship is: the two geometric figures intersect, but there is no shared boundary. Exemplarily, for polygons polygon1 and polygon2, first judge the result of polygon1.intersects(polygon2). If the result is False, it means that there is no overlapping relationship; if the result is True, continue to judge the result of polygon1.touches(polygon2.exterior). If the result is True, it means that there is no overlapping relationship, and if the result is False, it means that there is an overlapping relationship.
[0033] After the overlap relationship between the two regions is determined, the overlap region of the two target regions can be extracted. For example, polygon1.intersection(polygon2) can be used to preliminarily obtain the overlap region of the two target regions. The preliminary result may include multiple situations, such as multiple line segments, or one line segment, or one polygon. If there are line segments, it means that there are only redundant line segments at the region boundary, and there is no complete overlap region. This situation is excluded.
[0034] Optionally, in order to make the processed node coordinates more accurate and improve the visualization effect, when extracting the overlapping area, the two target areas can be filled into two convex polygons respectively, and then the area where the two convex polygons intersect is determined as the overlapping area of the two target areas. Figure 2 As shown, we can first use the polygon function to obtain the convex polygons of the two target areas. Specifically, the two target areas are Figure 2 The two solid polygons shown in red and blue are both concave polygons. After filling the two target areas with the two dotted lines of red and blue, two convex polygons can be obtained. By using the intersection function on the two convex polygons, the overlapping area of the two target areas (or the overlapping area of the two convex polygons) can be obtained, which is recorded as overlap_polygon.
[0035] After obtaining the overlapping area, combine Figure 2 , the overlapping area belongs to both polygon1 and polygon2. In order to make the same block belong to a certain category more accurately, the overlapping area can be divided into two parts, and according to the position and direction of the two target areas, one part belongs to polygon1 and the other part belongs to polygon2, that is, the overlapping area is divided into two virtual blocks belonging to the two target areas respectively. In a specific implementation, the overlap_polygon area can be divided by a perpendicular bisector, which specifically includes the following steps:
[0036] Step 1: Determine a straight line passing through the centers of the two target areas. Figure 2 In the case of convex polygon filling, this step should determine a straight line passing through the centers of the two convex polygons. Specifically, first calculate the center points of polygon1 and polygon2, denoted as center1 and center2 respectively, and then calculate the equation of the straight line linear1 passing through center1 and center2.
[0037] Step 2: Determine another straight line that is perpendicular to the one straight line and has a center of the overlapping region. For the sake of distinction and description, in this embodiment, the one straight line is referred to as the first straight line, and the other straight line is referred to as the second straight line. Figure 2 First, use the judgment function of the point in the polygon to determine whether all the nodes in polygon1 and all the nodes in polygon2 are in the overlapping area, and calculate the center point of the overlapping area overlap_polygon based on the statistical results, denoted as center3. Then, calculate the straight line passing through center3 and perpendicular to linear1, denoted as linear2. The equation coefficients of linear2 are a1, b1, c1, and the straight line equation is a1x+b1y+c1=0.
[0038] Step 3: Use two blocks located on both sides of the second straight line in the overlapping area as two virtual blocks belonging to the two target areas respectively. Figure 2 , connect the boundary line segment of the overlapping area with the two intersection points A and B of linear2 to form line segment AB, which divides the overlap_polygon area into two virtual blocks, polygon3 and polygon4. Figure 2 It can be seen that polygon3 belongs to polygon1, and polygon4 belongs to polygon2. However, in actual calculations, after being divided into two virtual blocks by line segment AB, it is not possible to directly determine which virtual block belongs to which target area. Therefore, this embodiment provides the following judgment method: Substitute the center coordinates of any target area into the equation of the second straight line to obtain a first result; at the same time, substitute the center coordinates of the blocks on either side of the second straight line in the overlapping area into the equation of the second straight line to obtain a second result; if the first result has the same sign as the second result, determine that the blocks on either side are virtual blocks belonging to any target area. Combined with Figure 2, based on the four points of center1 and center2, as well as the center points p3_center and p4_center of polygon3 and polygon4, we can determine whether the two virtual blocks are part of polygon1 or part of polygon2. If center1 and p3_center are substituted into the algebraic expression a1x+b1y+c1 of linear2, and the results are both greater than 0 or less than 0, it means that center1 and p3_center are on the same side of linear2, and we can determine that polygon3 is part of polygon1. Similarly, if center1 and p4_center are substituted into the algebraic expression a1x+b1y+c1 of linear2, and the results are both greater than 0 or less than 0, it means that center2 and p4_center are on the same side of linear2, and we can determine that polygon4 is part of polygon1.
[0039] S130 , replacing data points in each target area that are located in a virtual block belonging to another target area.
[0040] Continue to combine Figure 2 After executing S120, it can be determined that polygon3 belongs to polygon1 and polygon4 belongs to polygon2. Then, in S130, the abnormal nodes in the overlapping area are processed based on this information. The above-mentioned "data points in each target area that are located in a virtual block belonging to another target area" are abnormal nodes.
[0041] Optionally, for the convenience of distinction and description, the present embodiment refers to the two target areas as the first target area and the second target area, and the virtual blocks contained in the two target areas as the first virtual block and the second virtual block, respectively. Then, the above-mentioned abnormal node extraction process may include: extracting data points located in the second virtual block from the first target area, and these data points are abnormal data points in the first target area, and the present embodiment refers to them as first data points; at the same time, extracting data points located in the first virtual block from the second target area, and these data points are abnormal data points in the second target area, and the present embodiment refers to them as second data points. Exemplarily, in combination with Figure 2, we can use the judgment function of the point in the polygon to judge whether the node belonging to polygon1 is located in polygon4. If so, the node is an outlier point of polygon1, recorded as out_point1, and finally out_point1 is a one-dimensional list; similarly, we can use the judgment function of the point in the polygon to judge whether the node belonging to polygon2 is located in polygon3. If so, the node is an outlier point of polygon2, recorded as out_point2, and finally out_point1 is a one-dimensional list. Figure 2 The data points belonging to polygon1 and polygon2 are represented as red and blue dots respectively. The two red dots in polygon4 are the abnormal nodes of polygon1 (the first data points), and the three blue dots in polygon3 are the abnormal nodes of polygon2 (the second data points).
[0042] After the abnormal node is determined, the region information to which the first data point and the second data point belong is exchanged, and the abnormal node processing can be completed. Optionally, the number of the first data point and the second data point is first compared, and the number of points with a greater number is recorded as a, and the number of points with a less number is recorded as b. Then, from the data points with a number of data points, b data points that are farthest from the boundary line of the two virtual blocks are selected, and the region information to which they belong is exchanged with the data points with b number, and the abnormal node processing can be completed. Specifically, combined with Figure 2 According to the number of data points of out_point1 and out_point2, it can be divided into the following cases for processing:
[0043] Case 1: The number of out_point1 is greater than the number of out_point2. In this case, the number of out_point1 is a and the number of out_point2 is b. In this case, the b data points in out_point2 can be recorded as replace_point2, and the distance from all points in out_point1 to linear2 can be calculated. In the order of distance from large to small, b data points are taken, recorded as replace_point1, and the coordinates of replace_point1 and replace_point2 are exchanged. Although the area information to which out_point1 and out_point2 belong is not directly changed here, but other variables replace_point1 and replace_point2 are used to realize point replacement, it is also a way to exchange area information.
[0044] Case 2: The number of out_point1 is less than the number of out_point2. In this case, the number of out_point1 is b and the number of out_point2 is a. In this case, the b data points in out_point1 can be recorded as replace_point1, and the distance from all points in out_point2 to linear2 can be calculated. In the descending order of distance, b data points are taken and recorded as replace_point2, and the coordinates of replace_point1 and replace_point2 are exchanged. Figure 2 This is what is shown. Figure 2 In the figure, if the number of out_point1 is b=2 and the number of out_point2 is a=3, then 2 of the 3 blue dots are selected to replace with the 2 red dots. In the figure, the blue solid line represents the distance from the blue dot to linear2. The greater the distance, the greater the possibility that the blue dot will cause the blue convex polygon to overlap with other convex polygons. Therefore, in this embodiment, the farthest blue dot and the red dot are preferentially selected for replacement. As for the remaining closest blue dot, since it is relatively close to polygon4, retaining its original position can completely distinguish the two target areas in space, so the closest blue dot can be left unprocessed.
[0045] Case 3: If the number of out_point1 is equal to the number of out_point2, then out_point1 is recorded as replace_point1, out_point2 is recorded as replace_point2, and the coordinates of replace_point1 and replace_point2 are exchanged.
[0046] S140: Update the boundaries of each target area according to the replaced data points.
[0047] As described above, the mutual replacement of the above-mentioned area information or coordinate information only modifies the information of some points, and has not actually modified the boundaries of each area. This step actually modifies the boundaries of the area according to the replaced information. Optionally, a circumscribed polygon can be constructed using the first data points involved in the mutual replacement, called the first circumscribed polygon; another circumscribed polygon can be constructed using the second data points involved in the mutual replacement, called the second circumscribed polygon; then, the first target area is subtracted from the first circumscribed polygon and combined with the second circumscribed polygon to obtain a new boundary of the first target area; the second target area is subtracted from the second circumscribed polygon and combined with the first circumscribed polygon to obtain a new boundary of the second target area; the new boundaries of the two target areas will no longer overlap.
[0048] Combination Figure 2 , after recording the above replace_point1 and replace_point2, first take the difference set of the current polygon1 with the circumscribed polygon created by replace_point1, and then take the union set of the circumscribed polygon created by replace_point2 to complete the boundary update of polygon1; first take the difference set of the current polygon2 with the circumscribed polygon created by replace_point2, and then take the union set of the circumscribed polygon created by replace_point1 to complete the boundary update of polygon2; the updated polygon1 and polygon2 will not overlap.
[0049] S150 . Return to S120 according to the updated region boundary, and re-execute S120 - S150 until all the latest overlapping regions are processed.
[0050] This step returns to S120 based on the region boundary after the last update in S140, and selects two overlapping regions from the latest region as two new target regions; and executes S120-S140 for the two new target regions so that the two new target regions no longer overlap; then executes S150 again, and selects two overlapping regions from the latest region for processing, ... This cycle repeats until all region overlaps in the cluster map are processed.
[0051] Figure 3 and Figure 4 The example shows the changes of the local map before and after the regional overlap processing of the cluster map using the method of this embodiment. The local maps in the figure all have a certain regional overlap before processing, as shown in the red box in the figure. Since the overlapping area can only be displayed as one color in the cluster map, the overlap of the two colors cannot be directly seen in the figure, and the approximate position of the regional overlap can only be indicated by the red box. After the entire cluster map is processed by the method of this embodiment, the regional overlap disappears, and the overall layout has not changed significantly. The change in local shape is caused by convex polygon filling, virtual block segmentation, etc., which can be understood as part of the cost of clear regional boundaries. This change is within an acceptable range. At the same time, the background color of the area of the same data class has also changed. This is because each area will be randomly colored each time the map is generated, not a change in the data class; the data class is identified by the numbers 1, 2, 3, 4, 5, 6, 7, 8, and the same numbers before and after processing represent the same class.
[0052] In summary, this embodiment provides an adaptive processing method for regional overlap of cluster maps. First, it is determined whether there is a regional overlap problem in the cluster map. If so, considering the optimization of overall visualization, the regional boundary is first converted into a convex polygon during the processing, and the overlapping area is determined according to the size of the convex polygon. The overlapping area is then divided into two parts using a geometric method, and finally the abnormal points in the two parts are processed, thereby solving the regional overlap problem of the cluster map and improving the clarity of the class boundary. This method is suitable for data of different data magnitudes and different distributions. Regional overlap can be eliminated only by judging the geometric relationship. No parameter setting is required. It has high robustness and achieves true adaptation. At the same time, this method can improve the accuracy of the map, so that the map has clear class boundaries, improve the quality of visualization, as well as the transparency and comprehensibility of the data, and reduce the problem of ambiguity in visualization.
[0053] Figure 5 A schematic diagram of the structure of an electronic device provided by an embodiment of the present invention is shown in FIG. Figure 5 As shown, the device includes a processor 60, a memory 61, an input device 62 and an output device 63; the number of processors 60 in the device can be one or more. Figure 5 A processor 60 is taken as an example; the processor 60, the memory 61, the input device 62 and the output device 63 in the device can be connected by a bus or other means. Figure 5 The example of connecting through bus is taken in the following.
[0054] The memory 61 is a computer-readable storage medium that can be used to store software programs, computer executable programs and modules, such as program instructions / modules corresponding to the region overlap adaptive processing method of the cluster map in the embodiment of the present invention. The processor 60 executes various functional applications and data processing of the device by running the software programs, instructions and modules stored in the memory 61, that is, realizing the region overlap adaptive processing method of the cluster map described above.
[0055] The memory 61 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system and at least one application required for a function; the data storage area may store data created according to the use of the terminal, etc. In addition, the memory 61 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other non-volatile solid-state storage device. In some instances, the memory 61 may further include a memory remotely arranged relative to the processor 60, and these remote memories may be connected to the device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0056] The input device 62 may be used to receive input digital or character information and generate key signal input related to user settings and function control of the device. The output device 63 may include a display device such as a display screen.
[0057] An embodiment of the present invention further provides a computer-readable storage medium on which a computer program is stored. When the program is executed by a processor, the method for adaptively processing regional overlap of a cluster map of any embodiment is implemented.
[0058] The computer storage medium of the embodiment of the present invention can adopt any combination of one or more computer-readable media. The computer-readable medium can be a computer-readable signal medium or a computer-readable storage medium. The computer-readable storage medium can be, for example, but not limited to, a system, device or device of electricity, magnetism, light, electromagnetic, infrared, or semiconductor, or any combination of the above. More specific examples (non-exhaustive list) of computer-readable storage media include: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In this document, a computer-readable storage medium can be any tangible medium containing or storing a program, which can be used by an instruction execution system, a device or a device or used in combination with it.
[0059] Computer-readable signal media may include data signals propagated in baseband or as part of a carrier wave, which carry computer-readable program code. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than a computer-readable storage medium, which may send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, apparatus, or device.
[0060] The program code embodied on the computer readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.
[0061] Computer program code for performing the operations of the present invention may be written in one or more programming languages or a combination thereof, including object-oriented programming languages such as Java, Smalltalk, C++, and conventional procedural programming languages such as C or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through 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., through the Internet using an Internet service provider).
[0062] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or replace some or all of the technical features therein by equivalents. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the technical solutions of the embodiments of the present invention.
Claims
1. A method for adaptively processing regional overlap of cluster maps, characterized in that: include: S10, obtaining areas of each type of multiple data types in the cluster map; S20, for two overlapping target areas, dividing the overlapping area into two virtual blocks respectively belonging to the two target areas; S30, taking the two target areas as the first target area and the second target area respectively, taking two virtual blocks belonging to the first target area and the second target area respectively as the first virtual block and the second virtual block respectively; extracting a first data point located in the second virtual block from the first target area; Extracting second data points located in the first virtual block from the second target area; comparing the number of the first data points and the second data points, recording the larger number of points as a, and the smaller number of points as b; Selecting b data points farthest from the boundary line of the two virtual blocks from the data points a in number, and exchanging the area information with the data points b in number; wherein the extraction includes using a judgment function of a point in a polygon to sequentially judge whether a data point in a target area is located in a virtual block of another target area; S40: Update the boundaries of each target area according to the replaced data points.
2. The method according to claim 1, characterized in that The S20 includes: If the two areas intersect and the intersecting portion is not a line segment, the two areas are determined as two overlapping target areas; Fill the two target areas into two convex polygons respectively; The area where the two convex polygons intersect is determined as the overlapping area of the two target areas.
3. The method according to claim 1, characterized in that: The step of dividing the overlapping area into two virtual blocks respectively belonging to the two target areas includes: Determine a first straight line passing through the centers of the two target areas; Determine a second straight line passing through the center of the overlapping area and perpendicular to the first straight line; Two blocks in the overlapping area respectively located on both sides of the second straight line are used as two virtual blocks respectively belonging to the two target areas.
4. The method according to claim 3, characterized in that The step of taking two blocks located on both sides of the second straight line in the overlapping area as two virtual blocks belonging to the two target areas respectively includes: Substituting the center coordinates of any target area into the equation of the second straight line to obtain a first result; Substituting the center coordinates of the blocks in the overlapping area located on either side of the second straight line into the equation of the second straight line to obtain a second result; If the first result and the second result have the same sign, the block on either side is determined to be a virtual block belonging to any target area.
5. The method according to claim 1, characterized in that S40 includes: Creating a first circumscribed polygon of first data points that are replaced with each other, and a second circumscribed polygon of second data points that are replaced with each other; Taking a difference set between the first target area and the first circumscribed polygon, and taking a union set between the first target area and the second circumscribed polygon, to update the boundary of the first target area; The boundary of the second target area is updated by taking a difference set between the second target area and the second circumscribed polygon and taking a union set between the second target area and the first circumscribed polygon.
6. The method according to claim 1, characterized in that In the case where there are multiple pairs of two overlapping target areas, S20 includes: optionally dividing the overlapping area into two virtual blocks respectively belonging to the two target areas if there are two overlapping target areas; Correspondingly, after S40, it also includes: S50. Re-execute S20-S50 according to the updated region boundary until all the latest overlapping regions are processed.
7. An electronic device, characterized in that: include: one or more processors; a memory for storing one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors implement the area overlap adaptive processing method of the cluster map described in any one of claims 1-6.
8. A computer-readable storage medium, characterized in that: A computer program is stored thereon, and when the program is executed by a processor, the method for adaptively processing area overlap of a cluster map as described in any one of claims 1 to 6 is implemented.
Citation Information
Patent Citations
Geofence generation method and device, computer equipment and storage medium
CN110765219A
Method and device for constructing network area map and electronic equipment
CN113656653A