Coordinate point position relation determination method and device, equipment, medium and program
By dividing the polygon into inner and outer rectangles, and using the positional relationship between the coordinate point and the rectangle to quickly determine whether the coordinate point is inside the polygon, the problems of large computational complexity and high complexity in the existing technology are solved, and efficient positional relationship calculation is achieved.
Patent Information
- Application Number
- CN202510908048.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-02
- Publication Date
- 2025-10-24
AI Technical Summary
The existing technology has a large amount of calculation and high computational complexity when judging whether a coordinate point is located inside a polygon, and there are precision errors. Especially for polygons with complex shapes, the computational efficiency is low.
By dividing the target polygon into an inner rectangle and an outer rectangle, the positional relationship between the coordinate point and the inner rectangle and the outer rectangle is determined respectively, thereby quickly judging the inner and outer positional relationship between the coordinate point and the polygon, avoiding the calculation of polygon vertices and edge intersection traversal.
The calculation amount and complexity of the position relationship of the coordinate points are reduced, the calculation efficiency is improved, and it is possible to quickly and accurately determine whether the coordinate points are located inside the polygon.
Smart Images

Figure CN120833368A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] Embodiments of the present application relate to the technical field of data processing and graph analysis, and particularly relate to a coordinate point position relationship determination method and device, electronic equipment, storage medium and program. BACKGROUND
[0002] In the field of computer graphics and geographic information systems, determining whether a point is inside a polygon is a basic and important task. With the continuous expansion of application scenarios, such as map services and spatial analysis, the demand for fast and accurate point location determination methods is increasing.
[0003] Currently, there are generally two methods commonly used to determine whether a coordinate point belongs to the inside of a specified polygon. The first is the angle method, and the second is the ray method. Among them, the angle method usually takes the coordinate point as the vertex, starts from any vertex of the polygon, traverses each edge clockwise, and calculates the angle (note the positive and negative) of the vertex to the two vertices of the edge. The angle results of each edge are added up. If the final angle is 0°, it means that the coordinate point is outside the polygon; if the angle is 360° or -360°, it means that the coordinate point is inside the polygon. The ray method usually takes the coordinate point as the starting point and draws a ray in any direction. The number of intersections of the ray with the edges of the polygon is recorded, and the final number of intersections of the ray with the edges of the polygon is determined. For example, if the coordinate point is inside the polygon, the ray will first cross the edge of the polygon and then be outside the polygon; the second time it crosses the edge of the polygon will return to the inside of the polygon. When the number of intersections is odd, it means that the coordinate point is inside the polygon; otherwise, it is outside the polygon.
[0004] The inventors found the following defects in the prior art during the implementation of the present application: The angle method needs to calculate each polygon vertex, especially for polygons with a large number of vertices or complex shapes, the calculation amount is large, the calculation complexity is high, and the efficiency is low. When calculating the angle, floating-point operations may cause precision errors, especially when dealing with points close to the boundary, which may result in incorrect judgment. The ray method needs to traverse all edges to calculate the intersection, and when the number of edges is large or the polygon is complex, the calculation amount will increase, and there is also the problem of high calculation complexity and low efficiency. At the same time, when the ray intersects with a vertex of the polygon, special processing is required to determine whether to increase the number of intersections, i.e. additional business logic is required to handle the number of times under special circumstances, thereby further causing the problem of high calculation complexity. SUMMARY
[0005] The embodiments of the present application provide a coordinate point position relationship determination method and device, electronic equipment, storage medium and program, which can reduce the calculation amount and calculation complexity of the position relationship of the coordinate point, and further improve the calculation efficiency of the position relationship of the coordinate point.
[0006] According to an aspect of the present application, a method for determining position relationship of a coordinate point is provided, which comprises:
[0007] dividing a target polygon into inner rectangles and outer rectangles; wherein, the inner rectangles are rectangles located inside the target polygon, and the outer rectangles are rectangles including edges of the target polygon, and coverage areas of each of the inner rectangles and each of the outer rectangles include the complete target polygon; the target polygon is a polygon applied in the field of computer graphics and / or the field of geographic information system;
[0008] determining a first position relationship between a target coordinate point and the inner rectangles, or determining a second position relationship between the target coordinate point and the outer rectangles;
[0009] determining an inner-outer position relationship between the target coordinate point and the target polygon according to the first position relationship or the second position relationship.
[0010] According to another aspect of the present application, a device for determining position relationship of a coordinate point is provided, which comprises:
[0011] an inner-outer rectangle dividing module, configured to divide a target polygon into inner rectangles and outer rectangles; wherein, the inner rectangles are rectangles located inside the target polygon, and the outer rectangles are rectangles including edges of the target polygon, and coverage areas of each of the inner rectangles and each of the outer rectangles include the complete target polygon; the target polygon is a polygon applied in the field of computer graphics and / or the field of geographic information system;
[0012] a first position relationship determining module, configured to determine a first position relationship between a target coordinate point and the inner rectangles, or determine a second position relationship between the target coordinate point and the outer rectangles;
[0013] a second position relationship determining module, configured to determine an inner-outer position relationship between the target coordinate point and the target polygon according to the first position relationship or the second position relationship.
[0014] According to another aspect of the present application, an electronic device is provided, which comprises:
[0015] at least one processor; and
[0016] a memory connected with the at least one processor in communication; wherein,
[0017] The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor to enable the at least one processor to perform the position relationship determination method of the coordinate point according to any one of the embodiments of the present application.
[0018] According to another aspect of the present application, a computer readable storage medium is provided, which stores computer instructions for enabling a processor to implement the position relationship determination method of the coordinate point according to any one of the embodiments of the present application when executed by the processor.
[0019] According to another aspect of the present application, a computer program product is also provided, which comprises a computer program for implementing the position relationship determination method of the coordinate point according to any one of the embodiments of the present application when executed by a processor.
[0020] According to the embodiments of the present application, after a target polygon is determined according to the application in the field of computer graphics and / or the field of geographic information system, an inner rectangle located inside the target polygon and an edge outer rectangle including the target polygon are divided from the target polygon, so that the coverage area of each inner rectangle and each outer rectangle includes the complete target polygon. The coverage area of each inner rectangle and each outer rectangle including the complete target polygon can be understood as that the edges of the target polygon and the corresponding area are covered by all the inner rectangles and outer rectangles. After the inner rectangle and the outer rectangle of the target polygon are divided, a first position relationship between the target coordinate point and the inner rectangle is determined, or a second position relationship between the target coordinate point and the outer rectangle is determined, so as to determine the inside-outside position relationship between the target coordinate point and the target polygon according to the first position relationship or the second position relationship. The above technical solution can quickly determine whether the coordinate point belongs to the inside of the target polygon by using the position relationship between the coordinate point and the rectangle divided from the target polygon, and solves the problems of large calculation amount, high calculation complexity and low calculation efficiency of the existing position relationship determination method of the coordinate point, so as to reduce the calculation amount and the calculation complexity of the position relationship of the coordinate point, and further improve the calculation efficiency of the position relationship of the coordinate point.
[0021] It should be understood that the content described in this part is not intended to identify key or important features of the embodiments of the present application, nor is it used to limit the scope of the present application. Other features of the present application will become apparent from the following description. BRIEF DESCRIPTION OF DRAWINGS
[0022] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed in the embodiment description will be briefly introduced below. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can also be obtained by those skilled in the art without creative labor.
[0023] Figure 1 is a flow chart of a coordinate point position relationship determination method provided by an embodiment of the present application;
[0024] Figure 2 is a flow chart of another coordinate point position relationship determination method provided by an embodiment of the present application;
[0025] Figure 3 is an effect schematic diagram of dividing a target polygon into inner rectangles and outer rectangles provided by an embodiment of the present application;
[0026] Figure 4 is an effect schematic diagram of dividing a target polygon into outer rectangles provided by an embodiment of the present application;
[0027] Figure 5 is an effect schematic diagram of determining a target reference angle for an outer rectangle of a first classification type provided by an embodiment of the present application;
[0028] Figure 6 is an effect schematic diagram of determining a target reference angle for an outer rectangle of a second classification type provided by an embodiment of the present application;
[0029] Figure 7 is a schematic diagram of a coordinate point position relationship determination device provided by an embodiment of the present application;
[0030] Figure 8 is a structural schematic diagram of an electronic device provided by an embodiment of the present application. DETAILED DESCRIPTION
[0031] In order to enable persons skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be described clearly and completely below with reference to the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by persons skilled in the art without creative labor should belong to the protection scope of the present application.
[0032] It is to be understood that the terminology "first", "second" and the like used in the specification and the claims of the application as well as the foregoing drawings is merely intended to distinguish between similar objects and not to imply a specific order or sequence thereof. It is to be understood that the data used herein can be interchanged, where appropriate, so that the embodiments of the application described herein can be carried out in other than the order shown or described herein. Furthermore, the term "comprising" and "including" and the like as used herein is intended to be synonymous with the term "including" and / or the term "containing", for example, in that when a process, method, article, or apparatus includes a list of steps or elements, the process, method, article, or apparatus is not necessarily limited to those steps or elements specifically listed, but can include additional or other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
[0033] Figure 1 is a flowchart of a coordinate point position relationship determination method provided by an embodiment of the application. The embodiment can be applicable to determining the position relationship between a coordinate point and a polygon according to two different types of rectangles divided from the polygon. The method can be executed by a coordinate point position relationship determination device, which can be implemented in software and / or hardware and generally integrated in an electronic device. The electronic device can be a terminal device or a server device, as long as it can execute the coordinate point position relationship determination method. The embodiment of the application does not limit the specific type of the electronic device. Correspondingly, as shown in Figure 1 the method includes the following operations.
[0034] S110, dividing an inner rectangle and an outer rectangle from a target polygon; wherein the inner rectangle is a rectangle located inside the target polygon, and the outer rectangle is a rectangle including the edges of the target polygon, the coverage area of each inner rectangle and each outer rectangle including the complete target polygon; the target polygon is a polygon applied in the field of computer graphics and / or geographic information system.
[0035] The target polygon can be any polygon applied in the field of computer graphics and / or geographic information system, and the embodiment of the application does not limit the specific shape and application field of the target polygon. The inner rectangle can be a rectangle located in the internal area of the target polygon. The outer rectangle can be a rectangle including the edges of the target polygon. That is, a part of the area of the outer rectangle is located inside the target polygon, and a part of the area of the outer rectangle is located outside the target polygon.
[0036] In some application scenarios, it is required to determine whether a coordinate point is in a specified polygon region. For example, whether a monitored object leaves a set electronic fence region, whether a shared bicycle parking position is in a restricted region, and the like. Therefore, in the embodiments of the present application, a target polygon can be determined according to a polygon applied in the field of computer graphics and / or the field of geographic information system.
[0037] In the field of computer graphics, there are various applications of determining the positional relationship between a coordinate point and a polygon. For example, in the application scenario of graphics rendering, especially in 3D graphics rendering, it is crucial to determine whether a point is inside a polygon for realizing various visual effects. For example, when realizing a shadow effect, it is required to determine whether a light source point is inside a certain polygon to determine whether the polygon casts a shadow, and the like. In addition, a path planning and navigation system also requires determining whether a coordinate point is inside or outside a polygon to determine the feasibility and safety of a path. For example, in automatic driving and robot navigation, by determining whether a point is inside or outside a polygon, it can be determined whether the driving path of a robot or a vehicle is safe to avoid colliding with obstacles. For another example, in a scan line filling algorithm, it is determined whether a pixel point is located inside a polygon contour in each row to determine whether to color. For another example, in a graphics editor, a user clicks to select a graphics object, and in game development, a character or a prop is selected, and the like, which all require real-time determination of whether a coordinate point corresponding to a mouse is inside a polygon boundary.
[0038] In the field of geographic information system, there are also various applications of determining the positional relationship between a coordinate point and a polygon. For example, in a GIS (Geographical Information System) system, a device can be taken as a coordinate point, and an administrative region can be taken as a target polygon, so as to filter devices located in the administrative region according to the positional relationship between the coordinate point and the target polygon. Alternatively, a vehicle can be taken as a coordinate point that changes dynamically in real time, and a geographic fence can be taken as a target polygon, so as to analyze whether a mobile target such as a vehicle in a specific geographic fence enters an electronic fence. For another example, a sensor and the like can be taken as a coordinate point, and an administrative region can be taken as a target polygon, so as to calculate a sensor data point covered by the polygon according to the positional relationship between the coordinate point and the target polygon.
[0039] Correspondingly, after the target polygon is determined, the target polygon can be divided into rectangles. When the target polygon is divided into rectangles, two ways can be used. Specifically, the internal region of the target polygon can be divided into multiple rectangles as internal rectangles of the target polygon. The internal rectangles can only be located in the internal region of the target polygon. The edges of the target polygon can be divided into multiple rectangles including the edges of the target polygon as external rectangles of the target polygon. The external rectangles are partially located in the internal region of the target polygon and partially located in the external region of the target polygon. The edges of the target polygon located in the internal region of the external rectangles can be a complete edge of the target polygon or a partial edge of the target polygon, and the embodiments of the present application do not limit this. The total region covered by each internal rectangle and each external rectangle needs to include the complete target polygon.
[0040] S120, determining a first position relationship between the target coordinate point and the internal rectangle, or determining a second position relationship between the target coordinate point and the external rectangle.
[0041] The target coordinate point can be a coordinate point that needs to analyze the specific position relationship with the target polygon. The first position relationship can reflect the position relationship between the target coordinate point and the internal rectangle. The second position relationship can reflect the position relationship between the target coordinate point and the external rectangle.
[0042] Correspondingly, after the internal rectangle and the external rectangle are divided from the target polygon, the position relationship between the target coordinate point and the target polygon can be determined based on the internal rectangle and the external rectangle. Specifically, the position relationship between the target coordinate point and the internal rectangle can be determined as the first position relationship, or the position relationship between the target coordinate point and the external rectangle can be determined as the second position relationship. The first position relationship can reflect whether the target coordinate point is located in the internal rectangle, and the second position relationship can reflect whether the target coordinate point is located in the internal region of the target polygon region included by the external rectangle.
[0043] S130, determining the internal-external position relationship between the target coordinate point and the target polygon according to the first position relationship or the second position relationship.
[0044] Correspondingly, after the first position relationship or the second position relationship is determined, since the first position relationship can reflect whether the target coordinate point is located in the internal rectangle, and the second position relationship can reflect whether the target coordinate point is located in the internal region of the target polygon region included by the external rectangle, the internal-external position relationship between the target coordinate point and the target polygon can be further determined according to the first position relationship or the second position relationship. That is, whether the target coordinate point is located in the internal region of the target polygon is determined according to the first position relationship or the second position relationship.
[0045] Specifically, if the target coordinate point is determined to be inside the inner rectangle according to the first position relationship, or the target coordinate point is determined to be inside the target polygon region included by the outer rectangle according to the second position relationship, it can be determined that the target coordinate point is inside the target polygon. If the target coordinate point is determined not to be inside the inner rectangle according to the first position relationship, and the target coordinate point is determined to be outside the target polygon region included by the outer rectangle according to the second position relationship, it can be determined that the target coordinate point is outside the target polygon. Or, if the target coordinate point is determined not to be inside the inner rectangle according to the first position relationship, and the target coordinate point is determined to be outside the outer rectangle according to the second position relationship, it can be determined that the target coordinate point is outside the target polygon.
[0046] Therefore, the above-mentioned position relationship determination method of the coordinate point does not need to calculate the vertices of the polygon, and does not need to traverse all the edges of the polygon to calculate the intersection condition, but only needs to divide the target polygon into an inner rectangle and an outer rectangle, and determine the position relationship between the coordinate point and the inner and outer rectangles to quickly determine the inside and outside position relationship between the coordinate point and the polygon, which can greatly reduce the calculation amount and the calculation complexity, thereby improving the calculation efficiency.
[0047] According to the present embodiment, after determining the target polygon in the field of computer graphics and / or geographic information system, the inner rectangle inside the target polygon and the outer rectangle including the edges of the target polygon are divided, so that the coverage areas of the inner rectangles and the outer rectangles include the complete target polygon. After the inner rectangle and the outer rectangle of the target polygon are divided, the first position relationship between the target coordinate point and the inner rectangle is determined, or the second position relationship between the target coordinate point and the outer rectangle is determined, so as to determine the inside and outside position relationship between the target coordinate point and the target polygon according to the first position relationship or the second position relationship. The above technical solution can quickly determine whether the coordinate point belongs to the inside of the target polygon by using the position relationship between the coordinate point and the rectangle divided for the target polygon, solve the problems of large calculation amount, high calculation complexity and low calculation efficiency of the existing position relationship determination method of the coordinate point, and can reduce the calculation amount and the calculation complexity of the position relationship of the coordinate point, thereby improving the calculation efficiency of the position relationship of the coordinate point.
[0048] Figure 2 is a flowchart of another position relationship determination method of a coordinate point provided by the present embodiment, and the present embodiment is based on the above-mentioned embodiment. In the present embodiment, various specific optional implementation manners of determining the first position relationship and the second position relationship, and determining the inside and outside position relationship between the target coordinate point and the target polygon according to the first position relationship or the second position relationship are given. Correspondingly, as shown in Figure 2 the method of the present embodiment can include:
[0049] S210, dividing the target polygon into inner rectangles and outer rectangles.
[0050] The inner rectangle is a rectangle located inside the target polygon, and the outer rectangle is a rectangle including the edges of the target polygon. The coverage area of each inner rectangle and each outer rectangle includes the complete target polygon. The target polygon is a polygon applied in the field of computer graphics and / or geographic information system.
[0051] In an optional embodiment of the present application, the step of dividing the target polygon into inner rectangles and outer rectangles can include: dividing a plurality of outer rectangles according to each edge of the target polygon; determining the remaining internal area of the target polygon according to the target polygon and the outer rectangles when it is determined that the division of the outer rectangles is completed; and dividing each inner rectangle in the remaining internal area of the target polygon.
[0052] The remaining internal area can be the range of the internal area of the target polygon other than the area included by the outer rectangle.
[0053] Optionally, when the target polygon is divided into inner rectangles and outer rectangles, each edge of the target polygon can be first decomposed, and each edge can be divided into a corresponding outer rectangle. Optionally, the diagonal line of the outer rectangle can be a part of the edge of the target polygon, or the entire edge of the target polygon. That is, one edge of the target polygon can be divided into at least one outer rectangle. When the division of the outer rectangles of the target polygon is completed, each edge of the target polygon is decomposed and surrounded by the outer rectangle. At this time, if there is a remaining area in the internal area of the target polygon that is not divided into a corresponding outer rectangle, the remaining internal area of the target polygon can be further determined according to the target polygon and the outer rectangles, and the inner rectangle can be further divided in the remaining internal area of the target polygon. Optionally, when the inner rectangle is further divided in the remaining internal area of the target polygon, the division of the edge of the outer rectangle can be referred to, or other strategies can be referred to for division, as long as the remaining internal area of the target polygon can be completely divided. The embodiments of the present application do not limit the way of dividing the inner rectangle in the remaining internal area of the target polygon.
[0054] Figure 3 FIG. 1 is an effect diagram of dividing a target polygon into inner rectangles and outer rectangles according to an embodiment of the present application. In a specific example, as shown in FIG. 1, the target polygon can be first divided into inner rectangles, and then each edge of the target polygon can be further divided into a corresponding outer rectangle. As long as the coverage area of each inner rectangle and each outer rectangle can include the complete target polygon (including the edge and the internal area of the target polygon), the specific way of dividing the inner rectangle and the outer rectangle is not limited in the embodiments of the present application. Figure 3 Optionally, the target polygon can be first divided into inner rectangles, and then each edge of the target polygon can be further divided into a corresponding outer rectangle. As long as the coverage area of each inner rectangle and each outer rectangle can include the complete target polygon (including the edge and the internal area of the target polygon), the specific way of dividing the inner rectangle and the outer rectangle is not limited in the embodiments of the present application.
[0055] It should be noted that the outer rectangle and the inner rectangle can have an area overlap. Figure 4 is a schematic diagram of the effect of dividing the target polygon into an outer rectangle according to an embodiment of the present application. In a specific example, as shown in the figure, among the two outer rectangles divided from the target polygon, the smaller outer rectangle is completely inside the larger outer rectangle, that is, the areas of the two outer rectangles completely overlap. Figure 4
[0056] S220, determining whether the target coordinate point is located in the inner region of the target inner rectangle, if yes, executing S230; otherwise, executing S240.
[0057] In actual business scenarios, once the information of the region is determined, the polygon of the region is rarely modified subsequently. Generally, the position of the coordinate point between the regions has a normal distribution relationship, and the probability of the coordinate point near the boundary of the region is relatively small, and the probability of the coordinate point in the position relatively far from the inner and outer boundaries is relatively large. Although it is troublesome to determine the relationship between the target coordinate point and the target polygon, it is very simple to determine the position relationship between the target coordinate point and the inner rectangle and the outer rectangle of the target polygon. Therefore, after the inner rectangle and the outer rectangle are divided from the target polygon, it can be first determined whether the target coordinate point is located in the inner region of the target inner rectangle.
[0058] In an optional embodiment of the present application, the determination that the target coordinate point is located in the inner region of the target inner rectangle can include: determining the coordinates of a first reference vertex and a second reference vertex of the current inner rectangle; in a case where it is determined that the horizontal coordinate of the target coordinate point is greater than or equal to the horizontal coordinate of the first reference vertex and less than or equal to the horizontal coordinate of the second reference vertex, and it is determined that the vertical coordinate of the target coordinate point is greater than or equal to the vertical coordinate of the first reference vertex and less than or equal to the vertical coordinate of the second reference vertex, determining that the current inner rectangle is the target inner rectangle, and determining that the target coordinate point is located in the inner region of the target inner rectangle.
[0059] Among them, the current inner rectangle can be the currently analyzed inner rectangle. The first reference vertex and the second reference vertex can be two vertices of the current inner rectangle located on the same diagonal.
[0060] In a specific example, it is assumed that the left lower vertex of the current inner rectangle is taken as the first reference vertex, and the right upper vertex is taken as the second reference vertex, the coordinates of the first reference vertex are (x1, y1), the coordinates of the second reference vertex are (x2, y2), and the coordinates of the target coordinate point are (x, y). It is only necessary to ensure that x1<=x<=x2 and y1<=y<=y2, so that the target coordinate point is inside the current inner rectangle, and the current inner rectangle can be determined as the target inner rectangle; otherwise, the target coordinate point is not inside the current inner rectangle.
[0061] It can be seen that by dividing the target polygon into a plurality of inner rectangles, the position relationship between the target coordinate point and the target polygon can be determined by judging whether the target coordinate point is in the inner rectangle. If the target coordinate point is in the inner rectangle, it is determined that the target coordinate point is in the target polygon. The target polygon is rectangularized, and the position relationship between the target coordinate point and the target polygon can be quickly determined by the rectangularization.
[0062] S230, determining that the first position relationship between the target coordinate point and the inner rectangle is an inner-rectangle-internal relationship.
[0063] The number of the target inner rectangles is at least one.
[0064] If it is determined that the target coordinate point is in the inner region of the target inner rectangle, it is determined that the first position relationship between the target coordinate point and the inner rectangle is an inner-rectangle-internal relationship. That is, the inner-rectangle-internal relationship indicates that the target coordinate point is in the inner rectangle. It can be understood that since the inner rectangles may have overlapping regions, the number of the target inner rectangles including the target coordinate point can be one or more. When the number of the target inner rectangles is more than one, it indicates that the target coordinate point is in the overlapping region of the target inner rectangles.
[0065] S240, judging whether the target coordinate point is in the target inner region of the target outer rectangle. If yes, S250 is executed; otherwise, S260 is executed.
[0066] The target inner region of the target outer rectangle is the overlapping region of the target outer rectangle and the target polygon. That is, the target inner region is the region in the target polygon included in the target outer rectangle.
[0067] Correspondingly, if the target coordinate point is not in the inner region of any inner rectangle, the position relationship between the target coordinate point and the outer rectangle can be further determined.
[0068] S250, determining that the second position relationship between the target coordinate point and the outer rectangle is an outer-rectangle-internal relationship.
[0069] The number of the target outer rectangles is at least one.
[0070] Specifically, it can be determined whether the target coordinate point is located in the target inner region of the target outer rectangle. If it is determined that the target coordinate point is located in the target inner region of the target outer rectangle, it can be directly determined that the second positional relationship between the target coordinate point and the outer rectangle is an outer rectangle inner relationship. That is, the outer rectangle inner relationship indicates that the target coordinate point is located in the target polygon region inside the outer rectangle. It can be understood that, since the outer rectangle can have an area overlap, the number of target outer rectangles including the target coordinate point can be one or multiple. When the number of target outer rectangles is multiple, it indicates that the target coordinate point is located in the overlapping region of the target polygon regions inside each target outer rectangle.
[0071] It can be understood that, since there can also be an area overlap between the outer rectangle and the inner rectangle, if a target coordinate point is located in the target inner region of the target inner rectangle and also located in the target inner region of the target outer rectangle, it can be determined that the first positional relationship between the target coordinate point and the inner rectangle is an inner rectangle inner relationship, and the second positional relationship between the target coordinate point and the outer rectangle is an outer rectangle inner relationship.
[0072] In an optional embodiment of the present application, the determination that the target coordinate point is located in the target inner region of the target outer rectangle can include: determining an outer rectangle including the target coordinate point as the target outer rectangle; determining a target reference angle according to the type of the target outer rectangle; calculating a coordinate point reference angle formed by a line connecting the target coordinate point and a third reference vertex of the target outer rectangle and a reference edge of the target outer rectangle; and determining that the target coordinate point is located in the target inner region of the target outer rectangle in a case where a size relationship between the coordinate point reference angle and the target reference angle meets a preset condition.
[0073] The target reference angle can be an angle determined according to the type of the target outer rectangle, and is used for reference comparison of the size relationship of the corresponding angle of the target coordinate point. The target reference angle can be an inner angle of the target outer rectangle. The third reference vertex can be one of the vertices of the target outer rectangle. Specifically, the third reference vertex can be a vertex on a target diagonal line of the target outer rectangle, and the target diagonal line can be a diagonal line formed by the edges of the target polygon in the target outer rectangle. The reference edge of the target outer rectangle can be one of the edges of the target outer rectangle. The coordinate point reference angle can be an inner angle generated based on the target coordinate point and the reference edge of the target outer rectangle.
[0074] In the judgment of whether the target coordinate point is located in the target internal region of the target outer rectangle, the outer rectangle including the target coordinate point can be first screened and determined as the target outer rectangle. Further, the type of the target outer rectangle is analyzed, and the target reference angle is determined according to the type of the target outer rectangle. It can be understood that the type of the target outer rectangle is different, and the type and number of the determined target reference angle are also different. That is, the number of the target reference angle can be one or more. Optionally, the target reference angle can be an angle type for limiting the target coordinate point to be located in the target internal region of the target outer rectangle. Meanwhile, the coordinate point reference angle formed by the line connecting the target coordinate point and the third reference vertex of the target outer rectangle and the reference edge of the target outer rectangle can be calculated. The type of the target outer rectangle is different, and the selection manner of the reference edge of the target outer rectangle is also different. After the target reference angle and the coordinate point reference angle are determined, the positional relationship between the target coordinate point and the target polygon can be determined by judging the size relationship between the target reference angle and the coordinate point reference angle. Only when the size relationship between the coordinate point reference angle and the target reference angle meets the preset condition, it can be determined that the target coordinate point is located in the target internal region of the target outer rectangle.
[0075] In an optional embodiment of the present application, before the target reference angle is determined according to the type of the target outer rectangle, the method can further include: determining an associated current region shape and a fourth reference vertex of the target outer rectangle and the target polygon; wherein the fourth reference vertex is a vertex corresponding to two edges of the target polygon included in the associated current region shape; a straight line reference line is made in the horizontal direction or the vertical direction with the fourth reference vertex as the reference; in the case that the straight line reference line is determined to be in the internal region of the associated current region shape, it is determined that the type of the target outer rectangle is a first classification type; in the case that the straight line reference line is determined to be in the external region of the associated current region shape, it is determined that the type of the target outer rectangle is a second classification type.
[0076] The associated current region shape can be a shape formed by the adjacent two edges of the target polygon and the related outer rectangle, and belonging to the internal region of the target polygon. In the above adjacent two edges, one edge is located in the target outer rectangle, and the other edge is located in the vector outer rectangle of the target outer rectangle. The first classification type can be the type of the outer rectangle through which the straight line reference line can pass the current region shape internal region of the target polygon. The second classification type can be the type of the outer rectangle through which the straight line reference line cannot pass the current region shape internal region of the target polygon.
[0077] In the embodiment of the present application, as Figure 3As shown, the diagonal lines of the divided outer rectangles can overlap with the sides of the target polygon. Each outer rectangle can include a portion of the target polygon. The target outer rectangles can be classified based on the current regional shape associated with the target polygon. Specifically, the vertices corresponding to the two sides of the target polygon included in the associated current regional shape can be used as fourth reference vertices, and a straight reference line can be drawn from the fourth reference vertex in the horizontal direction (i.e., the horizontal axis) or the vertical direction (i.e., the vertical axis). The relationship between the straight reference line and the associated current regional shape is further determined. If it is determined that the straight reference line is within the internal area of the associated current regional shape, that is, a straight reference line parallel to the horizontal axis or the vertical axis can be drawn in the internal area of the associated current regional shape based on the fourth reference vertex, then the type of the target outer rectangle can be determined as the first classification type. If it is determined that the straight reference line is outside the associated current regional shape, that is, a straight reference line parallel to the horizontal axis or the vertical axis cannot be drawn in the internal area of the associated current regional shape based on the fourth reference vertex, then the type of the target outer rectangle can be determined as the second classification type.
[0078] Exemplary, reference Figure 3 Outer rectangle 1, with vertex A in outer rectangle 1 serving as the fourth reference vertex. The two sides of the target polygon at vertex A in outer rectangle 1 and outer rectangle 2 form the associated current region shapes of outer rectangle 1 and outer rectangle 2. Using vertex A as a reference, a vertical reference line M can be drawn. This line M lies within the internal region of the associated current region shapes of outer rectangle 1 and outer rectangle 2. Therefore, outer rectangle 1 and outer rectangle 2 can be determined to be of the first classification type.
[0079] Exemplary, reference Figure 3 Outer rectangle 6 is drawn, with vertex E in outer rectangle 6 serving as the fourth reference vertex. The two sides of the target polygon at vertex E within outer rectangle 6 form the associated current region shape corresponding to outer rectangle 6. Using vertex E as a reference, straight reference lines are drawn vertically and horizontally. These lines in either direction lie outside the associated current region shape of outer rectangle 6. Therefore, outer rectangle 6 can be determined to be of the second classification type.
[0080] Accordingly, when the target outer rectangle is of the first classification type, the side of the target outer rectangle that is located within the interior of the target polygon and includes the third reference vertex can be used as the reference side of the target outer rectangle. When the target outer rectangle is of the second classification type, the side of the target outer rectangle that includes the third reference vertex can be used as the reference side of the target outer rectangle, and the angle formed by the line connecting the target coordinate point and the third reference vertex of the target outer rectangle and the reference side of the target outer rectangle can be used as the coordinate point reference angle.
[0081] In an optional embodiment of the present application, the determining the target reference angle according to the type of the target outer rectangle can include: in a case where it is determined that the type of the target outer rectangle is a first classification type, taking an included angle formed by a side of the target outer rectangle located inside the target polygon and including the third reference vertex and a side of the target polygon at opposite diagonal lines of the target outer rectangle as the target reference angle; in a case where it is determined that the type of the target outer rectangle is a second classification type, taking an included angle formed by a side of the target outer rectangle located outside the target polygon and including the third reference vertex and a side of the target polygon at opposite diagonal lines of the target outer rectangle as a first target reference angle, and taking an included angle formed by two sides of the target polygon inside the target outer rectangle as a second target reference angle.
[0082] In the above embodiment, the first target reference angle and the second target reference angle can be two different target reference angles determined for the target outer rectangle of the second classification type.
[0083] Specifically, in a case where the type of the target outer rectangle is the first classification type, the judging whether the size relationship between the coordinate point reference angle and the target reference angle satisfies the preset condition can be based on the following manner: if the coordinate point reference angle is less than the target reference angle, it can be determined that the size relationship between the coordinate point reference angle and the target reference angle satisfies the preset condition, and it can be further determined that the target coordinate point is located in the target inner region of the target outer rectangle; if the coordinate point reference angle is greater than the target reference angle, it can be determined that the size relationship between the coordinate point reference angle and the target reference angle does not satisfy the preset condition, and it can be further determined that the target coordinate point is located in a target outer region of the target outer rectangle, which is a region of the target outer rectangle other than the target inner region; if the coordinate point reference angle is equal to the target reference angle, it can be determined that the target coordinate point is located on a side of the target outer rectangle.
[0084] Figure 5 is an effect diagram of the present application for determining a target reference angle for an outer rectangle of a first classification type. In a specific example, as shown in Figure 3 and Figure 5 , the target reference angle is determined as an included angle formed by a side of the target outer rectangle located inside the target polygon and including the third reference vertex and a side of the target polygon at opposite diagonal lines of the target outer rectangle. Figure 3For example, taking the outer rectangle 1 in FIG. 1 as a target outer rectangle, assuming that a target coordinate point (x, y) is located in the outer rectangle 1, and a diagonal AC of the outer rectangle 1 is a target diagonal, a vertex A or a vertex C can be determined as a third reference vertex. For example, assuming that the vertex C (x1, y1) is determined as the third reference vertex, an angle 1 formed by a side BC of the outer rectangle 1, which is located inside the target polygon and includes the third reference vertex, and a side of the target polygon on the diagonal AC of the target outer rectangle can be taken as a target reference angle. At this time, the side BC of the outer rectangle 1, which is located inside the target polygon and includes the third reference vertex, can be taken as a reference side of the outer rectangle 1. Further, a coordinate point reference angle, i.e., an angle 2, formed by a line connecting the target coordinate point (x, y) and the third reference vertex, i.e., the vertex C (x1, y1), of the outer rectangle 1 and the reference side BC of the outer rectangle 1 can be calculated synchronously. If the angle 2 is less than or equal to the angle 1, it is indicated that the target coordinate point is located in the target inner region of the outer rectangle 1.
[0085] Specifically, for the scenario in which the type of the target outer rectangle is the second classification type, when judging whether the size relationship between the coordinate point reference angle and the target reference angle satisfies the preset condition, the following manner can be used for judgment: if the coordinate point reference angle is greater than the first target reference angle and less than the second target reference angle, it can be determined that the size relationship between the coordinate point reference angle and the target reference angle satisfies the preset condition, and further it can be determined that the target coordinate point is located in the target inner region of the target outer rectangle. If the coordinate point reference angle is less than the first target reference angle or greater than the second target reference angle, it can be determined that the size relationship between the coordinate point reference angle and the target reference angle does not satisfy the preset condition, and further it can be determined that the target coordinate point is located in a target outer region of the target outer rectangle, which is a region of the target outer rectangle other than the target inner region. If the coordinate point reference angle is equal to the first target reference angle or the second target reference angle, it can be determined that the target coordinate point is located on a side of the target outer rectangle.
[0086] Figure 6 is an effect diagram of determining a target reference angle for an outer rectangle of the second classification type provided by an embodiment of the present application. In a specific example, as shown in Figure 3 and Figure 6 , the target reference angle is determined as an angle 1 formed by a side BC of an outer rectangle 1, which is located inside a target polygon and includes a third reference vertex, and a side of the target polygon on a diagonal AC of the target outer rectangle. Figure 3For example, taking the outer rectangle 6 in FIG. 6 as a target outer rectangle, assuming that a target coordinate point (x, y) is located in the outer rectangle 6, and the diagonal EG of the outer rectangle 6 is a target diagonal, for the outer rectangle of the second classification type, a cross point formed by two edges of the outer rectangle of the second classification type belonging to the target polygon (the cross point is usually also one of the vertices of the outer rectangle) can be directly taken as a third reference vertex. Therefore, for the outer rectangle 6, the vertex E (x1, y1) can be determined as the third reference vertex, and the edge EH or the edge EF of the outer rectangle 6 located outside the target polygon and including the third reference vertex E (x1, y1) can be taken as a reference edge of the outer rectangle 6. Assuming that the edge EH of the outer rectangle 6 located outside the target polygon and including the third reference vertex E (x1, y1) is selected as the reference edge of the outer rectangle 6, the included angle ∠1 formed by the reference edge EH of the outer rectangle 6 and the edge of the target polygon at the diagonal EG of the outer rectangle 6 is taken as a first target reference angle. At the same time, the included angle ∠2 formed by the reference edge EH of the outer rectangle 6 and the line connecting the target coordinate point (x, y) and the third reference vertex E (x1, y1) is taken as a coordinate point reference angle. Further, the included angle ∠3 formed by the non-diagonal edge EI of the target polygon and the reference edge EH of the outer rectangle 6 is taken as a second target reference angle. Correspondingly, if ∠1 <= ∠2 <= ∠3, it indicates that the target coordinate point is located in the target inner region of the target outer rectangle.
[0087] S260, determining whether the first position relationship is an inner rectangle internal relationship or the second position relationship is an outer rectangle internal relationship, if yes, performing S270; otherwise, performing S280.
[0088] S270, determining that the target coordinate point is located inside the target polygon.
[0089] S280, determining that the first position relationship is an inner rectangle external relationship, and determining that the second position relationship is an outer rectangle external relationship, and further determining that the target coordinate point is located outside the target polygon.
[0090] The inner rectangle external relationship can be a position relationship in which the target coordinate point is located in an outer region of the inner rectangle. The outer rectangle external relationship can be a position relationship in which the target coordinate point is located in an outer region of an overlapping region of the outer rectangle and the target polygon.
[0091] Specifically, when determining the inside-outside position relationship between the target coordinate point and the target polygon according to the first position relationship or the second position relationship, if it is determined that the first position relationship is the inside-rectangle inside relationship, indicating that the target coordinate point is located inside the inside-rectangle, it can be determined that the target coordinate point is located inside the target polygon. Or, if it is determined that the second position relationship is the outside-rectangle inside relationship, indicating that the target coordinate point is located inside the overlapping area of the outside-rectangle and the target polygon, it can be determined that the target coordinate point is located inside the target polygon. Only when it is determined that the first position relationship is the inside-rectangle outside relationship and at the same time it is determined that the second position relationship is the outside-rectangle outside relationship, it can be determined that the target coordinate point is located outside the target polygon.
[0092] Because the shape of the polygon has randomness, when the inside-rectangle and the outside-rectangle are divided for the target polygon, the situation of partial area overlap may occur. Therefore, if the target coordinate point is located in multiple outside-rectangles at the same time, as long as the judgment result in any one of the outside-rectangles is that the target coordinate point is inside the polygon, it means that the target coordinate point is inside the target polygon; if the judgment result of all the outside-rectangles is that the target coordinate point is not inside the polygon, it means that the target coordinate point is not inside the target polygon.
[0093] The above technical solution can directly solve the position relationship judgment of most coordinate points by dividing the polygon into small rectangles and confirming the position relationship between the coordinate point and the inside-rectangle and the outside-rectangle of the polygon, thereby improving the judgment efficiency of the position relationship of the coordinate point. That is, the coordinate point in the inside-rectangle is inside the polygon; the coordinate point not in the inside-rectangle and not in the outside-rectangle is outside the polygon. For the coordinate point in the outside-rectangle, it is also simplified as an angle calculation problem, and for the position without area overlap, no matter how complex the polygon is, only one calculation is needed to obtain the final position relationship judgment result. That is, by dividing the outside-rectangle in advance, the type, coordinate position, outside-rectangle vertex coordinate, and angle value range of each outside-rectangle can be calculated in advance. Therefore, the problem of “judging whether the coordinate point is inside the polygon” is converted into the problem of “judging in which rectangle the coordinate point is” and “judging the angle calculation of the coordinate point and the vertex of the rectangle”, thereby greatly simplifying the business logic of the coordinate point position relationship judgment, reducing the calculation amount and calculation complexity of the position relationship of the coordinate point, and further improving the calculation efficiency of the position relationship of the coordinate point.
[0094] It should be noted that the related information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data for display, analyzed data, etc.) involved in the present disclosure are all information and data authorized by the user or authorized by all parties, and the collection, use, and processing of related data comply with relevant laws, regulations, and standards in the relevant region.
[0095] It should be noted that any arrangement and combination of the technical features among the above embodiments also belong to the protection scope of the present application.
[0096] Figure 7 is a schematic diagram of a position relationship determination device of a coordinate point provided by an embodiment of the present application, as shown in the figure, the device comprises an inner-outer rectangle division module 310, a first position relationship determination module 320 and a second position relationship determination module 330, wherein: Figure 7
[0097] The inner-outer rectangle division module 310 is configured to divide a target polygon into inner rectangles and outer rectangles; wherein the inner rectangle is a rectangle located inside the target polygon, and the outer rectangle is a rectangle including the edges of the target polygon, and the coverage area of each inner rectangle and each outer rectangle includes the complete target polygon; the target polygon is a polygon applied in the field of computer graphics and / or the field of geographic information system;
[0098] The first position relationship determination module 320 is configured to determine the first position relationship between the target coordinate point and the inner rectangle, or determine the second position relationship between the target coordinate point and the outer rectangle;
[0099] The second position relationship determination module 330 is configured to determine the inner-outer position relationship between the target coordinate point and the target polygon according to the first position relationship or the second position relationship.
[0100] According to the polygon applied in the field of computer graphics and / or the field of geographic information system, an embodiment of the present application determines the target polygon, divides the target polygon into inner rectangles located inside the target polygon and outer rectangles including the edges of the target polygon, so that the coverage area of each inner rectangle and each outer rectangle includes the complete target polygon. The coverage area of each inner rectangle and each outer rectangle including the complete target polygon can be understood as that the edges of the target polygon and the corresponding area are covered by all the inner rectangles and outer rectangles. After the inner rectangles and outer rectangles of the target polygon are divided, the first position relationship between the target coordinate point and the inner rectangle is determined, or the second position relationship between the target coordinate point and the outer rectangle is determined, so as to determine the inner-outer position relationship between the target coordinate point and the target polygon according to the first position relationship or the second position relationship. The above technical solution can quickly determine whether the coordinate point belongs to the inside of the target polygon by using the position relationship between the coordinate point and the rectangle divided for the target polygon, solves the problems of large calculation amount, high calculation complexity and low calculation efficiency of the existing position relationship determination method of the coordinate point, can reduce the calculation amount and calculation complexity of the position relationship of the coordinate point, and further improve the calculation efficiency of the position relationship of the coordinate point.
[0101] Optionally, the inner-outer rectangle dividing module 310 is further configured to divide the plurality of outer rectangles according to each side of the target polygon; determine a remaining internal area of the target polygon according to the target polygon and the outer rectangles in a case that the division of the outer rectangles is determined to be completed; and divide each inner rectangle in the remaining internal area of the target polygon.
[0102] Optionally, the first position relationship determining module 320 is further configured to determine that the first position relationship between the target coordinate point and the inner rectangle is an inner-rectangle internal relationship in a case that the target coordinate point is determined to be located in an internal area of the target inner rectangle; the number of the target inner rectangle is at least one; and determine that the second position relationship between the target coordinate point and the outer rectangle is an outer-rectangle internal relationship in a case that the target coordinate point is determined to be located in a target internal area of the target outer rectangle; the number of the target outer rectangle is at least one; and the target internal area of the target outer rectangle is an overlapping area of the target outer rectangle and the target polygon.
[0103] Optionally, the first position relationship determining module 320 is further configured to determine the coordinates of a first reference vertex and a second reference vertex of a current inner rectangle; and determine that the current inner rectangle is the target inner rectangle and the target coordinate point is located in an internal area of the target inner rectangle in a case that the horizontal coordinate of the target coordinate point is greater than or equal to the horizontal coordinate of the first reference vertex and less than or equal to the horizontal coordinate of the second reference vertex, and the vertical coordinate of the target coordinate point is greater than or equal to the vertical coordinate of the first reference vertex and less than or equal to the vertical coordinate of the second reference vertex.
[0104] Optionally, the first position relationship determining module 320 is further configured to determine an outer rectangle including the target coordinate point as the target outer rectangle; determine a target reference angle according to the type of the target outer rectangle; calculate a coordinate point reference angle formed by a line connecting the target coordinate point and a third reference vertex of the target outer rectangle and a reference side of the target outer rectangle; and determine that the target coordinate point is located in a target internal area of the target outer rectangle in a case that the size relationship between the coordinate point reference angle and the target reference angle meets a preset condition.
[0105] Optionally, the first position relationship determining module 320 is further configured to: determine an associated current region shape of the target outer rectangle and the target polygon and a fourth reference vertex; the fourth reference vertex is a vertex corresponding to two edges of the target polygon included in the associated current region shape; a straight reference line is drawn in a horizontal direction or a vertical direction with the fourth reference vertex as a reference; in a case where it is determined that the straight reference line is inside the associated current region shape, it is determined that the type of the target outer rectangle is a first classification type; in a case where it is determined that the straight reference line is outside the associated current region shape, it is determined that the type of the target outer rectangle is a second classification type.
[0106] Optionally, the first position relationship determining module 320 is further configured to: in a case where it is determined that the type of the target outer rectangle is the first classification type, determine an included angle between an edge of the target outer rectangle located inside the target polygon and including the third reference vertex and an edge of the target polygon as the target reference angle; in a case where it is determined that the type of the target outer rectangle is the second classification type, determine an included angle between an edge of the target outer rectangle located outside the target polygon and including the third reference vertex and an edge of the target polygon as a first target reference angle, and determine an included angle between an edge of the target polygon and an edge of the target outer rectangle not forming a diagonal line as a second target reference angle.
[0107] Optionally, the second position relationship determining module 330 is further configured to: in a case where it is determined that the first position relationship is the inner rectangle inside relationship, or it is determined that the second position relationship is the outer rectangle inside relationship, determine that the target coordinate point is located inside the target polygon; in a case where it is determined that the first position relationship is the inner rectangle outside relationship, and it is determined that the second position relationship is the outer rectangle outside relationship, determine that the target coordinate point is located outside the target polygon.
[0108] The above-mentioned coordinate point position relationship determining apparatus can perform the coordinate point position relationship determining method provided by any embodiment of the present application, and has the corresponding function modules and beneficial effects of performing the method. Technical details not described in detail in the present embodiment can be referred to the coordinate point position relationship determining method provided by any embodiment of the present application.
[0109] Since the above-mentioned coordinate point position relationship determining device is a device that can execute the coordinate point position relationship determining method in the embodiments of the present application, based on the coordinate point position relationship determining method in the embodiments of the present application, those skilled in the art can understand the specific implementation of the coordinate point position relationship determining device in the embodiments and various changes thereof, so how the coordinate point position relationship determining device implements the coordinate point position relationship determining method in the embodiments of the present application will not be described in detail here. As long as the device used to implement the coordinate point position relationship determining method in the embodiments of the present application is implemented by those skilled in the art, it belongs to the scope of protection of the present application.
[0110] Figure 8 A structural diagram of an electronic device 10 that can be used to implement embodiments of the present application is shown. The electronic device is intended to represent a variety of forms of digital computers, such as laptops, desktops, tablets, personal digital assistants, servers, blade servers, mainframes, and other appropriate computers. The electronic device can also represent various forms of mobile devices, such as personal digital processors, cellular telephones, smart phones, wearable devices (e.g., headsets, glasses, watches, etc.), and other similar computing devices. The components shown herein, their connections and relationships, and their functions, are meant to be examples only, and are not intended to limit the implementations of the present application described and / or claimed in this document.
[0111] As shown in Figure 8 The electronic device 10 includes at least one processor 11, and a memory, such as a read-only memory (ROM) 12, a random access memory (RAM) 13, etc., which is communicatively connected to the at least one processor 11, wherein the memory stores a computer program that can be executed by the at least one processor. The processor 11 can perform various appropriate actions and processes according to the computer program stored in the read-only memory (ROM) 12 or the computer program loaded from the storage unit 18 into the random access memory (RAM) 13. In the RAM 13, various programs and data required for the operation of the electronic device 10 can also be stored. The processor 11, the ROM 12, and the RAM 13 are connected to each other through a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.
[0112] A plurality of components in the electronic device 10 are connected to the I / O interface 15, including: an input unit 16, such as a keyboard, a mouse, etc.; an output unit 17, such as various types of displays, speakers, etc.; a storage unit 18, such as a magnetic disk, an optical disk, etc.; and a communication unit 19, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 19 allows the electronic device 10 to exchange information / data with other devices through a computer network, such as the Internet, and / or various telecommunications networks.
[0113] The processor 11 can be various general and / or special-purpose processing components with processing and computing capabilities. Some examples of the processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any appropriate processor, controller, microcontroller, etc. The processor 11 performs various methods and processes described above, such as the position relationship determination method of coordinate points.
[0114] Optionally, the position relationship determination method of coordinate points can include: dividing a target polygon into inner rectangles and outer rectangles; wherein the inner rectangles are rectangles located inside the target polygon, and the outer rectangles are rectangles including edges of the target polygon, and coverage areas of each of the inner rectangles and each of the outer rectangles include the complete target polygon; the target polygon is a polygon applied in the field of computer graphics and / or the field of geographic information systems; determining a first position relationship between a target coordinate point and the inner rectangle, or determining a second position relationship between the target coordinate point and the outer rectangle; and determining an inside-outside position relationship between the target coordinate point and the target polygon according to the first position relationship or the second position relationship.
[0115] In some embodiments, the position relationship determination method of coordinate points can be implemented as a computer program tangibly embodied in a computer-readable storage medium, such as the storage unit 18. In some embodiments, part or all of the computer program can be loaded and / or installed on the electronic device 10 via the ROM 12 and / or the communication unit 19. When the computer program is loaded into the RAM 13 and executed by the processor 11, one or more steps of the position relationship determination method of coordinate points described above can be performed. Alternatively, in other embodiments, the processor 11 can be configured to perform the position relationship determination method of coordinate points by any other appropriate means, such as by means of firmware.
[0116] Various embodiments of the systems and techniques described herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), system-on-chip systems (SOCs), programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments can include being implemented in one or more computer programs that are executable and / or interpreted on a programmable system that includes at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0117] Computer programs for implementing the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, such that when the computer program is executed by the processor, the functions / operations specified in the flowcharts and / or block diagrams are implemented. The computer program may be executed entirely on the machine, partially on the machine, as a stand-alone software package, partially on the machine and partially on a remote machine, or entirely on a remote machine or server.
[0118] In the context of the present invention, computer-readable storage media can be tangible media that can contain or store a computer program for use with an instruction execution system, device or equipment or used in combination with an instruction execution system, device or equipment. Computer-readable storage media can include but are not limited to electronic, magnetic, optical, electromagnetic, infrared or semiconductor systems, devices or equipment, or any suitable combination of the foregoing. Alternatively, computer-readable storage media can be machine-readable signal media. More specific examples of machine-readable storage media can include electrical connections based on one or more lines, portable computer disks, hard disks, random access memories (RAM), read-only memories (ROM), erasable programmable read-only memories (EPROM or flash memory), optical fibers, portable compact disk read-only memories (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.
[0119] To provide for interaction with a user, the systems and techniques described here can be implemented on an electronic device having a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user and a keyboard and a pointing device (e.g., a mouse or a trackball) by which the user can provide input to the electronic device. Other kinds of devices can be used to provide for interaction with a user as well; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form, including acoustic, speech, or tactile input.
[0120] The systems and techniques described here can be implemented in a computing system that includes a back end component (e.g., as a data server), or that includes a middleware component (e.g., an application server), or that includes a front end component (e.g., a user computer having a graphical user interface or a Web browser through which a user can interact with an implementation of the systems and techniques described here), or any combination of such back end, middleware, or front end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a local area network (LAN), a wide area network (WAN), a blockchain network, and the Internet.
[0121] The computing system can include clients and servers. A client and server are generally remote from each other and typically interact through a communication network. The relationship of client and server arises by virtue of computer programs running on the respective computers and having a client-server relationship to each other. A server can be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system, to solve the defects of large management difficulty and weak business scalability in traditional physical host and VPS service.
[0122] It should be understood that the various forms of flow shown above can be re-ordered, added to, or deleted from without departing from the scope of the present disclosure. For example, the steps recited in the present disclosure can be executed in parallel, executed in series, or executed in different orders, without departing from the desired results of the technical solutions of the present disclosure, which are not limited herein.
[0123] The specific implementation described above does not constitute a limitation on the protection scope of the present disclosure. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent replacements, and improvements made within the spirit and principles of the present disclosure shall be included in the protection scope of the present disclosure.
Claims
1. A method of determining positional relationships of coordinate points, characterized by, The method comprises the following steps: dividing a target polygon into inner rectangles and outer rectangles; wherein the inner rectangles are rectangles located inside the target polygon, and the outer rectangles are rectangles including edges of the target polygon, and coverage areas of each of the inner rectangles and each of the outer rectangles include the complete target polygon; the target polygon is a polygon applied in the field of computer graphics and / or the field of geographic information system; determining a first positional relationship between a target coordinate point and the inner rectangles, or determining a second positional relationship between the target coordinate point and the outer rectangles; determining an inner-outer positional relationship between the target coordinate point and the target polygon according to the first positional relationship or the second positional relationship.
2. The method of claim 1, wherein, The step of dividing the target polygon into the inner rectangles and the outer rectangles comprises the following steps: dividing a plurality of the outer rectangles according to each edge of the target polygon; in a case where it is determined that the division of the outer rectangles is completed, determining a remaining internal area of the target polygon according to the target polygon and the outer rectangles; dividing each of the inner rectangles in the remaining internal area of the target polygon.
3. The method of claim 1, wherein, The step of determining the first positional relationship between the target coordinate point and the inner rectangles comprises the following steps: in a case where it is determined that the target coordinate point is located in an internal area of a target inner rectangle, determining that the first positional relationship between the target coordinate point and the inner rectangle is an inner-rectangle-internal relationship; wherein the number of the target inner rectangles is at least one. The step of determining the second positional relationship between the target coordinate point and the outer rectangles comprises the following steps: in a case where it is determined that the target coordinate point is located in a target internal area of a target outer rectangle, determining that the second positional relationship between the target coordinate point and the outer rectangle is an outer-rectangle-internal relationship; wherein the number of the target outer rectangles is at least one; wherein the target internal area of the target outer rectangle is an overlapping area of the target outer rectangle and the target polygon.
4. The method of claim 3, wherein, The step of determining that the target coordinate point is located in the internal area of the target inner rectangle comprises the following steps: determining coordinates of a first reference vertex and a second reference vertex of a current inner rectangle; in a case where it is determined that a horizontal coordinate of the target coordinate point is greater than or equal to a horizontal coordinate of the first reference vertex and less than or equal to a horizontal coordinate of the second reference vertex, and it is determined that a vertical coordinate of the target coordinate point is greater than or equal to a vertical coordinate of the first reference vertex and less than or equal to a vertical coordinate of the second reference vertex, determining that the current inner rectangle is the target inner rectangle, and determining that the target coordinate point is located in the internal area of the target inner rectangle.
5. The method of claim 3, wherein, The step of determining that the target coordinate point is located in the target internal area of the target outer rectangle comprises the following steps: determining an outer rectangle including the target coordinate point as the target outer rectangle; determining a target reference angle according to a type of the target outer rectangle; calculating a coordinate point reference angle formed by a line connecting the target coordinate point and a third reference vertex of the target outer rectangle and a reference edge of the target outer rectangle; in a case where it is determined that a size relationship between the coordinate point reference angle and the target reference angle satisfies a preset condition, determining that the target coordinate point is located in the target internal area of the target outer rectangle.
6. The method of claim 5, wherein, Before the target reference angle is determined according to the type of the target outer rectangle, further comprising: determining an associated current region shape of the target outer rectangle and the target polygon and a fourth reference vertex; wherein the fourth reference vertex is a vertex corresponding to two edges of the target polygon included in the associated current region shape; a straight line reference line is made in a horizontal direction or a vertical direction with the fourth reference vertex as a reference; in a case where it is determined that the straight line reference line is inside the associated current region shape, it is determined that the type of the target outer rectangle is a first classification type; in a case where it is determined that the straight line reference line is outside the associated current region shape, it is determined that the type of the target outer rectangle is a second classification type.
7. The method of claim 6, wherein, The target reference angle is determined according to the type of the target outer rectangle, comprising: in a case where it is determined that the type of the target outer rectangle is the first classification type, an included angle formed by an edge of the target outer rectangle located inside the target polygon and including the third reference vertex and an edge of the target polygon in a diagonal line of the target outer rectangle is taken as the target reference angle; in a case where it is determined that the type of the target outer rectangle is the second classification type, an included angle formed by an edge of the target outer rectangle located outside the target polygon and including the third reference vertex and an edge of the target polygon in a diagonal line of the target outer rectangle is taken as a first target reference angle, and an included angle formed by an edge of the target polygon in a non-diagonal line of the target outer rectangle and an edge of the target outer rectangle located outside the target polygon and including the third reference vertex is taken as a second target reference angle.
8. The method of claim 3, wherein, The inside-outside position relationship between the target coordinate point and the target polygon is determined according to the first position relationship or the second position relationship, comprising: in a case where it is determined that the first position relationship is the inside rectangle relationship, or it is determined that the second position relationship is the outside rectangle relationship, it is determined that the target coordinate point is inside the target polygon; in a case where it is determined that the first position relationship is the inside rectangle relationship, and it is determined that the second position relationship is the outside rectangle relationship, it is determined that the target coordinate point is outside the target polygon.
9. A device for determining the positional relationship of coordinate points, characterized in that: comprising: an inside-outside rectangle division module, configured to divide a target polygon into inside rectangles and outside rectangles; wherein the inside rectangle is a rectangle located inside the target polygon, the outside rectangle is a rectangle including edges of the target polygon, and a coverage area of each of the inside rectangles and the outside rectangles includes the complete target polygon; the target polygon is a polygon applied in a field of computer graphics and / or a geographic information system; a first position relationship determination module, configured to determine a first position relationship between a target coordinate point and the inside rectangle, or to determine a second position relationship between the target coordinate point and the outside rectangle; a second position relationship determination module, configured to determine an inside-outside position relationship between the target coordinate point and the target polygon according to the first position relationship or the second position relationship.
10. An electronic device, comprising: The electronic device comprises: at least one processor; and A memory connected in communication with the at least one processor; wherein The memory stores a computer program executed by the at least one processor, and the computer program is executed by the at least one processor to enable the at least one processor to execute the coordinate point position relationship determination method in any one of claims 1-8.
11. A computer readable storage medium characterized by The computer readable storage medium stores computer instructions, and the computer instructions are used to enable the processor to implement the coordinate point position relationship determination method in any one of claims 1-8 when executed.
12. A computer program product comprising computer programs / instructions, wherein, The computer program / instructions enable the processor to implement the coordinate point position relationship determination method in any one of claims 1-8 when executed.