CN111915665B - Method for judging points in polygon by using simplified intersection calculation on computer - Google Patents

Method for judging points in polygon by using simplified intersection calculation on computer Download PDF

Info

Publication number
CN111915665B
CN111915665B CN202010703960.XA CN202010703960A CN111915665B CN 111915665 B CN111915665 B CN 111915665B CN 202010703960 A CN202010703960 A CN 202010703960A CN 111915665 B CN111915665 B CN 111915665B
Authority
CN
China
Prior art keywords
polygon
intersection
ray
grid
edge
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202010703960.XA
Other languages
Chinese (zh)
Other versions
CN111915665A (en
Inventor
王文成
王盛春
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Institute of Software of CAS
Original Assignee
Institute of Software of CAS
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Institute of Software of CAS filed Critical Institute of Software of CAS
Priority to CN202010703960.XA priority Critical patent/CN111915665B/en
Publication of CN111915665A publication Critical patent/CN111915665A/en
Application granted granted Critical
Publication of CN111915665B publication Critical patent/CN111915665B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/60Analysis of geometric attributes
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F17/00Digital computing or data processing equipment or methods, specially adapted for specific functions
    • G06F17/10Complex mathematical operations

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Mathematical Physics (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Algebra (AREA)
  • Computational Mathematics (AREA)
  • Geometry (AREA)
  • Mathematical Analysis (AREA)
  • Mathematical Optimization (AREA)
  • Pure & Applied Mathematics (AREA)
  • Databases & Information Systems (AREA)
  • Software Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Image Generation (AREA)

Abstract

The invention relates to a method for judging points in a polygon by using simplified intersection calculation on a computer, which comprises the following steps: reading the vertex coordinates of the polygon into a computer memory to generate a polygonal bounding box, performing uniform grid division on the polygonal bounding box, and generating a strip-shaped structure parallel to one coordinate axis in a grid unit; meanwhile, judging whether the segment divided by the intersection point of the grid line and the edge of the polygon is positioned in/out of the polygon; for a test point, a ray is emitted from the test point and is parallel to a coordinate axis parallel to the generation of the strip structure; counting the number of polygon edges intersected by the ray until the ray reaches an unambiguous grid line segment; and according to the parity of the intersection times and the attribute that the grid line segment reached by the ray is positioned in/out of the polygon, whether the test point is positioned in the polygon can be known. The invention can greatly simplify the intersection calculation, efficiently utilize the parallel processing capability of the computer and greatly improve the calculation efficiency.

Description

Method for judging points in polygon by using simplified intersection calculation on computer
Technical Field
The invention belongs to the field of computer algorithm, computer graphics, computational geometry and geographic information system processing, in particular to a method for judging and calculating points in a polygon, which comprises the following steps: and (3) judging whether the position of a point in the space is positioned in a space area defined by a polygon.
Background
The judgment and calculation of points in a polygon is a basic calculation technology in computer graphics, calculation geometry and geographic information system processing, namely, for a polygon, whether any test point is positioned in the polygon is judged. This is a lot of work, with the relatively extensive ray-based and uniform mesh-based methods being used. Ray method, that is, a ray is sent from a test point, and the number of times of intersection between the ray and the edge of the polygon is counted. If the intersection times are even numbers, the test points are outside the polygon; otherwise, it is inside. Ray method requires intersection tests with each edge of the polygon, with a computational complexity of o (N), where N is the number of edges of the polygon. In order to reduce the calculation complexity, various methods are provided, in which a polygon is pre-processed to some extent, for example, the polygon is divided into trapezoids or convex polygons, then the local area where the test point is located can be quickly located, and then judgment and calculation are performed according to the condition of the local area. This method can reduce the number of sides of the polygon to be detected, and the computational complexity can be reduced to O (logN). However, pretreatment by such a method is troublesome. Therefore, the uniform grid method provides that the polygonal bounding box is divided into rectangular grids aligned with coordinate axes, so that simple preprocessing can be performed, and detection of the test points can be limited to local areas adjacent to the grid units. After comparing various methods, the uniform grid method is an efficient point-in-polygon judgment and calculation method suitable for practical application. Furthermore, a method for combining the ray method with the uniform grid method is provided, the attribute that each grid intersection point is positioned inside/outside the polygon is calculated, then the test points are connected with the grid intersection points of the grid units where the test points are positioned, and the ray method can be locally used for judging and calculating the points in the polygon. Since one mesh intersection is associated with multiple mesh cells, the edges of the polygons in these several mesh cells are detected. For this purpose, some methods propose that the attribute of the central point of each grid unit located inside/outside the polygon is calculated firstly, then the connection processing is carried out between the test point and the central point of the grid unit where the test point is located, and the judgment calculation method of the attribute of the central point of the grid located inside/outside the polygon and the optimization processing of the grid resolution are improved, and the methods for carrying out robust processing on some ambiguous situations can reduce the calculation complexity of the preprocessing of the uniform grid method to O (N) and reduce the expected value of the complexity of the test calculation to O (1).
Although the combination of the ray method and the uniform grid method minimizes the computational complexity, the intersection operation of the basic test ray and the edge of the polygon still has more computations such as multiplication, addition and the like, and the computation cost is still higher for a computer processor.
Disclosure of Invention
In order to solve the above technical problems, the present invention provides a method for determining a point in a polygon on a computer by using simplified intersection calculation, so as to simplify the intersection calculation and facilitate efficient use of parallel processing capability of the computer, thereby improving the efficiency of determining and calculating the point in the polygon. The invention further improves the combination of the ray method and the grid method. Firstly, the ray emitted from the test point is fixed in the direction parallel to a coordinate axis, so that a coordinate of the intersection point can be known in advance, and the complexity of intersection calculation of the ray and the edge of the polygon is reduced. Meanwhile, the strip-shaped structures are managed on the fragments of the sides of the polygons in the grid units, so that the sides in each strip-shaped structure can intersect with the rays in the strip-shaped structure, in this way, a large number of sides which do not intersect with the rays in the grid units do not need to be subjected to intersection calculation with the rays, and in this way, the GPU is favorably used for performing parallel calculation to improve the efficiency better, and time-consuming bifurcation processing is not needed to judge whether the rays intersect with the sides possibly.
The technical scheme of the invention is a method for judging points in a polygon, which simplifies intersection calculation, and comprises the following steps:
reading vertex coordinates of a polygon into a memory of a computer to generate a bounding box of the polygon, so that the boundaries of the bounding box are positioned outside the polygon; carrying out uniform grid division aligned with coordinate axes on a bounding box of the polygon, dividing the grid lines into a plurality of segments according to intersection points of the sides of the polygon and the grid lines parallel to the X axis or the Y axis, and judging and recording the attributes of the segments of each grid line positioned inside/outside the polygon;
generating a strip-shaped structure in each grid unit to manage the polygonal edge segments contained in the grid units, wherein one strip-shaped structure is formed by taking an edge parallel to a Y axis or an X axis as a boundary, so that the polygonal edge segments intersect with the boundaries of two ends of the strip-shaped structure;
when test points are input for detection in the step (3), a single processor or a plurality of parallel processors are utilized, for each test point, a ray parallel to the Y axis or the X axis is sent out from the test point, the intersection point of the ray and the grid line parallel to the X axis or the Y axis is gradually calculated from near to far until the attribute of the intersection point positioned inside/outside the polygon can be obtained from the attribute of the section of the grid line positioned inside/outside the polygon, and at the moment, the advancing of the ray is terminated;
Calling relevant strip structures to be used, and performing judgment calculation of points in a polygon in an independent processor or a parallel processor; at the moment, for a ray emitted from a test point, calculating the intersection condition of the ray and the edge of the polygon in the passing strip-shaped structure, and counting the intersection times of the ray and the edge of the polygon;
and (5) obtaining the attribute of the test point inside/outside the polygon according to the results of the steps (3) and (4).
Further, the step (1) of determining the attribute that the segment of the grid line divided by the intersection point of the grid line and the edge of the polygon is located inside/outside the polygon includes the following steps:
(1.a) regarding a grid line as a ray emitted from an outermost point of the grid line, and intersecting the edge of the polygon to obtain the condition that the grid line intersects the edge of the polygon;
(1.b) the outermost points of the grid lines are located outside the polygon. Meanwhile, according to the ray method in which the point is determined and calculated within the polygon, it is known that the attributes of adjacent segments of the grid line, which are located inside/outside the polygon, are alternately changed, and thus, the attributes of the segments on the grid line, which are located inside/outside the polygon, are known.
Further, the step (2) establishes a strip structure for the edge segments of the polygons in each grid cell to manage, and includes the following steps:
(2.a) for the edge segments in a grid cell, generating a plurality of parallel lines parallel to the Y or X coordinate axis based on the X or Y coordinate values of their end points located in the grid cell, and dividing the grid cell into a plurality of stripe-like structures by using the parallel lines as boundaries;
(2.b) each strip-like structure records the edge it contains without recording the coordinates of the end points of the edge segments.
Furthermore, the ray emitted when the test is performed on one test point in the step (3) is parallel to the boundary edge of the strip-shaped structure.
Further, when the step (3) performs intersection from near to far between the ray emitted from the test point and the grid line, it is determined whether the attribute of the intersection point located inside/outside the polygon can be known by the attribute of the grid line segment located inside/outside the polygon, and thus it is determined whether the ray stops advancing; if so, stopping the ray from advancing; otherwise, the ray is subject to intersection with the subsequent grid line.
Further, when the intersection test is performed on the edge of the polygon in each strip structure that a test ray passes through in the step (4), it is not necessary to detect whether the edge intersects with the ray before the intersection is determined, so that the parallel capability of the computer is used conveniently, for example, time-consuming bifurcation processing when the GPU is used is reduced. When the intersection point of the ray and one edge is calculated, one coordinate value of the intersection point is known and is the coordinate value of the coordinate axis vertical to the ray; and judging the size of the other coordinate value of the intersection point and the other coordinate value of the test point to know whether the ray and the edge are really intersected or not.
Further, in the step (5), the results of the steps (3) and (4) are integrated to obtain the attribute that the test point is located inside/outside the polygon, and the processing is as follows:
(5.a) if the intersection point of the ray and the grid line is positioned in the polygon when the ray stops advancing, and the intersection times of the ray and the edge of the polygon are even numbers, the test point is positioned in the polygon; otherwise, outside;
(5, b) if the intersection point of the ray and the grid line is positioned outside the polygon when the ray stops advancing, and the test point is positioned outside the polygon when the intersection frequency of the ray and the edge of the polygon is an even number; otherwise, it is inside.
Has the beneficial effects that:
the invention can greatly save operations such as multiplication, addition and the like in the intersection calculation, can efficiently use the parallel processing capability of a computer such as GPU and the like, and can greatly improve the judgment calculation efficiency of points in the polygon.
Drawings
FIG. 1 is a diagram illustrating intersection calculation between the sides of a polygon and grid lines, and then determining the attribute of the horizontal grid line segment inside/outside the polygon according to the intersection condition. Meanwhile, the strip-shaped structure of each grid unit is organized so as to effectively manage the edge segments in each grid unit;
FIG. 2 is a diagram showing the intersection of a test point outgoing line with a horizontal grid line and calculating the intersection of the ray with the edge of the passing strip structure, thereby determining whether the test point is located within a polygon;
FIG. 3 is a method of statistical processing of intersection of rays with edges of a polygon when the rays are collinear with the edges of the polygon or when the rays pass through vertices of the polygon;
FIG. 4 is a diagram of 4 polygons used for testing, (a) a polygon with a small number of sides; (b) polygons with small number of sides and more balanced distribution; (c) polygons with a large number of sides but an unbalanced distribution; (d) many sides and more evenly distributed polygons.
FIG. 5 is a flow chart of the method of the present invention.
Detailed Description
The technical solution in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention. It should be apparent that the described embodiments are only a part of the embodiments of the present invention, and not all embodiments, and all other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present invention are within the protection scope of the present invention without inventive efforts.
The invention relates to a point-in-polygon judgment method for simplifying intersection calculation by using a computer, which can be used for various scenes in engineering, for example, in a geographic information system, area limitation is carried out on roads, buildings, parks and the like in an area in a polygon mode; when some target is to be located, for example, whether a certain car is located on a certain road or in a certain park, etc., the present invention can be used for quick retrieval. Or, when flood floods a city, the area covered by the flood can be expressed by polygons, and then the invention can be used for quickly knowing which positions are not covered by the flood and are safe.
According to one embodiment of the present invention, without loss of generality, the present invention generates both the strip structure and the test rays in directions parallel to the Y-axis, and the rays are emitted upward (in directions where the Y-coordinate gradually increases) from the test points, as shown in fig. 1.
According to one embodiment of the present invention, the above method of the present invention is divided into two stages:
the first stage is to preprocess the polygon;
and a second stage: and judging whether a test point is positioned in the polygon or not according to the preprocessing result.
The working steps of the first stage are as follows:
1) and detecting the X coordinates and the Y coordinates of all the vertexes of the polygon to obtain the minimum X coordinate, the minimum Y coordinate, the maximum X coordinate and the maximum Y coordinate. And then respectively reducing the minimum X coordinate and the minimum Y coordinate by a preset value, and respectively increasing the maximum X coordinate and the maximum Y coordinate by a preset value, thereby obtaining the bounding box of the polygon, wherein the boundaries of the bounding box are positioned outside the polygon.
2) And carrying out uniform mesh subdivision with mesh resolution optimization on the bounding box. The lengths Mx and My of each Grid cell along the direction of the X, Y axis are calculated according to the Method In "hanging Li and Wenching Wang.2014.Point-In-Polygon Tests by Applying the Ray Crossing Method Local Via Grid Point. International Journal of electric Engineering 21,3(2014), 85-92", respectively:
Mx=k*sqrt(M*W/H),
My=k*sqrt(M*H/W)
Here, k is an empirical coefficient, and is generally set to 1; w and H are the width and height of the bounding box, respectively; m is according to "Borut
Figure BDA0002593991880000051
and Ivana Kolingerova.2001.A cell-based point-in-polygon algorithm suitable for large sets of points.Computers&Geosciences 27,10(2001), 1135-1145. "the total number of grid cells obtained is typically about NWhere N is the number of sides of the polygon.
3) And calculating the X coordinates of the intersection points of the edges of each polygon and the grid lines parallel to the X axis, wherein the X coordinates of each intersection point can be gradually obtained by applying iterative addition according to the characteristic that the distances between adjacent grid lines parallel to the X axis are equal. As shown in FIG. 1, the coordinates X1 of the intersection of the edge AB and the grid line parallel to the X axis are equally spaced from X2 and X2 is equally spaced from X3.
4) Dividing each grid line parallel to the X axis into a plurality of segments according to the intersection points of the sides of the polygon and the grid lines parallel to the X axis; the properties of these segments, which lie inside/outside the polygon, can be obtained and recorded according to ray methods. At this time, for the case where the edge of the polygon is collinear with the grid line parallel to the X-axis, it is alone a segment on the grid line, and the attribute that lies inside/outside the polygon is marked as "ambiguous".
5) According to the intersection points of the sides of the polygons and the grid lines, the fragments of the sides of the polygons in each grid unit can be known; the X-coordinate of the end points of the segments of the edges is either the X-coordinate of the intersection of the edge with the grid lines parallel to the X-axis or the X-coordinate of the grid lines parallel to the Y-axis. And generating a vertical line parallel to the Y axis as a boundary line of the strip-shaped structures according to the X coordinates of the end points to obtain a strip-shaped structure division result of the grid unit, and recording the contained edges in each strip-shaped structure (without recording the end point coordinates of the edge segments). The property that the upper boundary of a bar-like structure is inside/outside the polygon is that its segment on the grid line parallel to the X-axis is inside/outside the polygon, since its upper boundary must be inside a segment of the grid line. The grid cell, which contains point C in fig. 1, is divided into 3 stripe structures.
The working steps in the second stage are as follows:
(1) and generating an upward ray parallel to the Y axis according to the X coordinate of the test point.
(2) The intersection of the ray with the grid lines parallel to the X-axis is computed from near to far until the intersection is known to be within/outside the polygon.
(3) For each strip structure through which the ray passes, the intersection condition of the ray and the edge therein is detected. At this time, the X coordinate of the intersection is known, and it is only necessary to calculate the Y coordinate of the intersection and find it from the line equation of the side and the X coordinate of the ray. If the obtained Y coordinate is smaller than the Y coordinate of the test point, the edge is positioned below the test point and cannot be intersected with the ray; otherwise, it is a true intersection. If true intersection is carried out, the number of times of intersection is counted and increased by 1 time; otherwise, if the situation is not the real intersection situation, statistics is not carried out. For the case where the ray passes through a vertex of the polygon or is collinear with an edge of the polygon, the intersection statistics proceed in the manner shown in FIG. 3:
3.1) if one vertex of the polygon passed by the ray and 2 edges related to the vertex are positioned at the same side of the ray, the 2 edges related to the vertex are not subjected to statistical processing; otherwise, the 2 edges associated with the vertex are counted as the ray intersecting the edge of the polygon 1 time.
3.2) if the ray is collinear with one side of the polygon, the 2 sides related to the side are positioned at the same side of the ray, and the side and the 2 sides related to the side are not subjected to statistical processing; otherwise, the edge and the associated 2 edges are counted as the ray intersecting the edge of the polygon 1 time.
(4) According to the attribute that the intersection point of the ray and the grid line parallel to the X axis is positioned inside/outside the polygon and the statistics of the intersection times of the ray and the edge of the polygon, whether the test point is positioned inside the polygon can be known. If the intersection times are even numbers, the test points and the intersection points have the same attribute of being positioned inside/outside the polygon; otherwise, their properties inside/outside the polygon are reversed. As shown in fig. 2, the number of intersections is an odd number and the test point q is located inside the polygon because the intersection of the ray with the horizontal grid line is now located outside the polygon.
The invention can use the GPU of the computer to perform parallel computation so as to improve the detection speed. At this time, all the strip structures are loaded into a global memory of the GPU; then, according to the parallel processing capacity of the GPU, grouping a plurality of test points to be processed, and enabling each group to be processed by one processor in the GPU; finally, calling the relevant strip structures used by each processor, namely, judging and calculating the points in the polygon in parallel in each processor of the GPU.
The invention is tested on a computer, and the comparison Method is the most efficient Grid Method GCP (hanging Li and Wencheng Wang 2014.Point-In-Poly Tests by Applying the Ray Crossing Method Locally Via Grid Point International Journal of electric Engineering 21,3(2014), 85-92.) known at present. According to the number of the sides of the polygon and whether the distribution of the sides of the polygon is uniform, 4 polygons are selected for testing, and the polygons are from (Borut)
Figure BDA0002593991880000061
and Ivana Kolingerova.2001.A cell-based point-in-polygon algorithm suitable for large sets of points.Computers&Geosciences 27,10(2001), 1135-1145). These 4 polygons are shown in fig. 4, (a) Pol10, (b) Pol100, (c) Pol1249, (d) Pol28000, with 10, 100, 1249, and 28000 sides, respectively. 1000000 points are randomly and uniformly sampled in a polygonal bounding box as test points. Correlation tests all computers were configured with an Intel (R) core (TM) i7-8700 CPU,16GB memory, and an NVIDIA GeForce GTX 1080Ti GPU (with 16GB memory space).
The experimental results for these 2 method comparisons are as follows:
Figure BDA0002593991880000071
acceleration ratio calculation: (t1-t2)/t2, t1 and t2 are the time spent by GCP and the present invention, respectively.
Statistics of the various types of calculations used to perform these tests:
Figure BDA0002593991880000072
Figure BDA0002593991880000081
Re1, re2, re3 are savings in the number of multiply, add, and compare operations required by the present invention compared to the GCP method, respectively, which are calculated as: the number of operations required by the present invention/the number of corresponding operations required by GCP.
From the above experimental results, although the method requires more calculation and more space to store the preprocessing result in the preprocessing stage, the increase is not very large. During detection and calculation, the invention can greatly save the number of multiplication, addition and comparison operations, thereby greatly improving the detection speed; moreover, the invention can obtain higher operation efficiency on the GPU than on the CPU because of efficiently utilizing the parallel processing capability of the computer.
The invention has not been described in detail and is within the skill of the art.
The above description is only a part of the embodiments of the present invention, but the scope of the present invention is not limited thereto. Any changes or substitutions that may be easily made by those skilled in the art within the technical scope of the present disclosure are intended to be included within the scope of the present disclosure.

Claims (6)

1. A method for determining points within a polygon using simplified intersection computations on a computer, comprising the steps of:
Reading vertex coordinates of a polygon into a memory of a computer or a cache in a GPU (graphics processing unit) to generate a bounding box of the polygon, so that the boundaries of the bounding box are all positioned outside the polygon; carrying out uniform grid division aligned with coordinate axes on a bounding box of the polygon, dividing the grid lines into a plurality of segments according to intersection points of the sides of the polygon and the grid lines parallel to the X axis or the Y axis, and calculating the attribute of each grid line segment inside/outside the polygon;
generating a strip-shaped structure in each grid unit to manage the edge segments of the polygons contained in the grid units, wherein one strip-shaped structure is formed by taking the edge parallel to the Y axis or the X axis as a boundary, so that the edge segments of the polygons intersect with the boundaries of the two ends of the strip-shaped structure;
when the test points are input for detection in the step (3), a plurality of parallel processors are utilized, for each test point, a ray parallel to a Y axis or an X axis is sent out, intersection points of the ray and grid lines parallel to the X axis or the Y axis are gradually calculated from near to far until the intersection points are positioned in/out of the polygon, the attribute of the intersection points positioned in/out of the polygon can be obtained from the attribute of the section of the grid lines positioned in/out of the polygon, and at the moment, the advancing of the ray is terminated;
Calling relevant strip structures to be used by a processor, calculating the intersection condition of a ray emitted from a test point and the edge of the polygon in a parallel processor, and counting the intersection times of the ray and the edge of the polygon;
and (5) obtaining the attribute of the test point inside/outside the polygon according to the results of the steps (3) and (4).
2. A method for determining points within a polygon using simplified intersection computations on a computer as claimed in claim 1, wherein:
the step (1) is to judge the attribute that the segment divided by the intersection point of the grid line and the edge of the polygon is positioned inside/outside the polygon, and the steps are as follows:
(1.a) regarding a grid line as a ray emitted from an outermost point of the grid line, and intersecting the edge of the polygon to obtain the condition that the grid line intersects the edge of the polygon;
(1, b) the outermost point of the grid line is located outside the polygon, and according to the ray method in which the point is determined and calculated within the polygon, it is known that the attribute of adjacent grid line segments located inside/outside the polygon is changed alternately, and thus, the attribute of each segment located inside/outside the polygon on the grid line is known.
3. A method for determining points within a polygon using simplified intersection computations on a computer as claimed in claim 1, wherein:
And (2) establishing a strip structure for the edge segments of the polygons in each grid unit to manage: the method comprises the following steps:
(2.a) for the edge segments in a grid cell, generating a plurality of parallel lines parallel to the Y or X coordinate axis based on the X or Y coordinate values of their end points located in the grid cell, and dividing the grid cell into a plurality of stripe-like structures by using the parallel lines as boundaries;
(2.b) each strip-like structure records the edge it contains without recording the coordinates of the end points of the edge segments.
4. A method for determining points within a polygon using simplified intersection computations on a computer as claimed in claim 1, wherein:
and (3) rays emitted when a test point is tested in the step (3) are parallel to the boundary edge of the strip-shaped structure.
5. A method for determining points within a polygon using simplified intersection computations on a computer as claimed in claim 1, wherein:
when the ray emitted from the test point and the grid line are intersected from near to far, judging whether the attribute of the grid line segment where the intersection point is located is known or not, and determining whether the ray stops advancing or not; if the intersection point is known, the attribute of the intersection point positioned in/out of the polygon is equal to the attribute of the section of the grid line positioned in/out of the polygon, and the ray stops advancing; otherwise, the ray is subject to intersection with the subsequent grid line.
6. A method of point-in-polygon decision on a computer using simplified intersection calculations as claimed in claim 1, wherein:
in the step (5), the results of the steps (3) and (4) are integrated to obtain the attribute that the test point is positioned inside/outside the polygon, and the processing is as follows:
(5.a) if the intersection point of the ray and the grid line is positioned in the polygon when the ray stops advancing, and the intersection frequency of the ray and the edge of the polygon is an even number, the test point is positioned in the polygon; otherwise, outside;
(5, b) if the intersection point of the ray and the grid line is positioned outside the polygon when the ray stops advancing, and the test point is positioned outside the polygon when the intersection frequency of the ray and the edge of the polygon is an even number; otherwise, it is inside.
CN202010703960.XA 2020-07-21 2020-07-21 Method for judging points in polygon by using simplified intersection calculation on computer Active CN111915665B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010703960.XA CN111915665B (en) 2020-07-21 2020-07-21 Method for judging points in polygon by using simplified intersection calculation on computer

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010703960.XA CN111915665B (en) 2020-07-21 2020-07-21 Method for judging points in polygon by using simplified intersection calculation on computer

Publications (2)

Publication Number Publication Date
CN111915665A CN111915665A (en) 2020-11-10
CN111915665B true CN111915665B (en) 2022-05-31

Family

ID=73281319

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010703960.XA Active CN111915665B (en) 2020-07-21 2020-07-21 Method for judging points in polygon by using simplified intersection calculation on computer

Country Status (1)

Country Link
CN (1) CN111915665B (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112926123B (en) * 2021-03-17 2022-09-02 杭州品茗安控信息技术股份有限公司 Method, device, equipment and storage medium for determining position relation of building member
CN113034515A (en) * 2021-03-22 2021-06-25 易视腾科技股份有限公司 Bounding box tree-based polygon clipping method, electronic device and storage medium
CN115222806B (en) * 2022-09-20 2022-12-09 腾讯科技(深圳)有限公司 Polygon processing method, device, equipment and computer readable storage medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101114379A (en) * 2007-09-07 2008-01-30 中国科学院软件研究所 Method for judging point whether or not situated in polygon
CN102629375A (en) * 2012-01-06 2012-08-08 中国科学院软件研究所 Method for determining whether point is located in polygon
CN105184837A (en) * 2015-08-31 2015-12-23 武汉云空间地理信息技术有限公司 Vector polygon rasterization algorithm and system
WO2016116070A2 (en) * 2015-01-23 2016-07-28 中兴通讯股份有限公司 Method and device for determining locational relationship

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20120082373A1 (en) * 2010-09-30 2012-04-05 Konica Minolta Systems Laboratory, Inc. Method and system for determining whether a point is inside a polyhedron

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101114379A (en) * 2007-09-07 2008-01-30 中国科学院软件研究所 Method for judging point whether or not situated in polygon
CN102629375A (en) * 2012-01-06 2012-08-08 中国科学院软件研究所 Method for determining whether point is located in polygon
WO2016116070A2 (en) * 2015-01-23 2016-07-28 中兴通讯股份有限公司 Method and device for determining locational relationship
CN105184837A (en) * 2015-08-31 2015-12-23 武汉云空间地理信息技术有限公司 Vector polygon rasterization algorithm and system

Non-Patent Citations (4)

* Cited by examiner, † Cited by third party
Title
Point-in-Polygon Tests by Determining Grid Center Points in Advance;Jing Li 等;《IEEE》;20161006;1-7 *
加强局部简便计算的点在多边形内的高效判定;王盛春等;《图学学报》;20190415(第02期);267-273 *
基于凸片段分解和格网的点在多边形中的可见边检测;高天豪等;《计算机辅助设计与图形学学报》;20130815(第08期);1114-1120 *
基于网格中心点的点在多边形内的高效判定;李静等;《软件学报》;20120915(第09期);2481-2488 *

Also Published As

Publication number Publication date
CN111915665A (en) 2020-11-10

Similar Documents

Publication Publication Date Title
CN111915665B (en) Method for judging points in polygon by using simplified intersection calculation on computer
Huang et al. On the complexity of point-in-polygon algorithms
US8773422B1 (en) System, method, and computer program product for grouping linearly ordered primitives
US20100194751A1 (en) Ray tracing a three dimensional scene using a grid
US20210183068A1 (en) Self-Adaptive Point Cloud Stripe Division Method
CN109872396B (en) Rapid cross-section contour generation method suitable for triangular mesh model
CN102629375A (en) Method for determining whether point is located in polygon
Hegeman et al. Particle-based fluid simulation on the GPU
Liu et al. Change detection of mobile LIDAR data using cloud computing
CN108364331A (en) A kind of isopleth generation method, system and storage medium
RU2019145092A (en) METHOD AND SYSTEM FOR PREDICTING FUTURE EVENTS IN A UNMANANVED VEHICLE (SDC)
Li et al. Fast and robust GPU-based point-in-polyhedron determination
Hermann et al. Ray-traced collision detection for deformable bodies
Lin et al. OptRegion: Finding optimal region for bichromatic reverse nearest neighbors
CN115346005A (en) Data structure construction method for object plane grid based on nested bounding box concept
Li et al. Fast and robust point-in-spherical-polygon tests using multilevel spherical grids
Daescu et al. The Discrete Median and Center Line Segment Problems in the Plane.
KR100831553B1 (en) 3D ray tracing method using quad tree and method for predicting propagation characteristics using hash table
Crosnier et al. Tribox bounds for three-dimensional objects
Soukal et al. Walking algorithms for point location in TIN models
Yılmaz et al. Conservative occlusion culling for urban visualization using a slice-wise data structure
US20090313277A1 (en) System and method for 3-d map compression and intersection determination
CN113658033B (en) GPU method for calculating internal point set of given region
CN115526011B (en) Layout method and device of VOCs leakage monitoring points, electronic equipment and medium
Babai et al. Tracking sub-atomic particles through the attribute space

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant