CN109582745A - The method of differential ray method decision-point and closed figure positional relationship - Google Patents

The method of differential ray method decision-point and closed figure positional relationship Download PDF

Info

Publication number
CN109582745A
CN109582745A CN201810740596.7A CN201810740596A CN109582745A CN 109582745 A CN109582745 A CN 109582745A CN 201810740596 A CN201810740596 A CN 201810740596A CN 109582745 A CN109582745 A CN 109582745A
Authority
CN
China
Prior art keywords
point
value
closed
line
ray
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.)
Pending
Application number
CN201810740596.7A
Other languages
Chinese (zh)
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.)
Individual
Original Assignee
Individual
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 Individual filed Critical Individual
Priority to CN201810740596.7A priority Critical patent/CN109582745A/en
Publication of CN109582745A publication Critical patent/CN109582745A/en
Pending legal-status Critical Current

Links

Abstract

The present invention provides the method for a kind of quick decision-point and polygon relationship, has done larger improvement to traditional radiographic method.Figure is converted into a polygon for connection composition using differential thought, and the data structure of fast searching is created to save the information of these points, by the ray of traditional radiographic method-line segment relationship judgement, be converted into wait make an inventory of-data structure between value search and compare calculatings, obtain the secondary numerical value of intersection of emergent ray and figure.According to the parity of the value, by the general rule of ray method, obtain wait make an inventory of the positional relationship with polygon.Time complexity is O (1), does not have correlativity with number of edges N, in complex figure, the higher calculating occasion of precision requirement, performance has a distinct increment compared with conventional method.

Description

The method of differential ray method decision-point and closed figure positional relationship
Technical field
The present invention relates in Distribution GIS application, the point and any enclosed graph position on map are quickly identified The method of relationship.
Background technique
Decision-point is in polygonal region or outside polygonal region, and the acquisition of this positional relationship is navigation, height The important technology in the fields such as precision positioning, automatic Pilot, with extensive in traffic, scientific research;Such as shared bicycle, shared automobile Charter business activity in, need to judge whether bicycle, automobile enter no-parking zone, once judgement enter prohibition parking area domain and User is prepared to stop, operation enterprise need to using prompt alarm, can not the means such as winding-up remind user to sail out of.
The judgement to point and polygon relationship is usually realized according to topological ray method, as shown in Fig. 1:
A ray is done based on the point, whether all sides for calculating polygon one by one intersect with ray, if intersection number is surprise Number, then decision-point is in polygon, if number is even number or is 0 for intersection, decision-point is outside polygon, such as attached drawing 1:
1: the intersection number on each side of ray and polygon that green point is done to the right is 4, is even number, determines this in polygon It is external;
Point between 2:1,2, does to the right ray, and the intersection number with polygon is odd number, determines that the point exists respectively 2,3,4 The inside of polygon.
The polygon for being N for number of edges, above-mentioned traditional radiographic method need to carry out each edge and are calculated with ray, and judgement is No intersection, N side will compare one by one, and time complexity is O (N);Inspur Communicate Information System Co., Ltd's application " 201510255047.7 " patent, " CN201810029493.X " patent of Alibaba Group Holdings Limited's application are to upper State ray method to improve, but do not avoid the judgement one by one to point or line segment, complexity there is no the optimization on the order of magnitude, " 201610242654.4 " patent of Shanghai Zhuo Yi Science and Technology Co., Ltd. application has been done ray method and has largely been improved, Time complexity is reduced to O (㏒ N), it is more outstanding scheme.
Summary of the invention
The method of a kind of quick decision-point and polygon relationship is now provided, time complexity is O (1), is not had with number of edges N Correlativity, in complex figure, the higher calculating occasion of precision requirement, performance is compared with the side that conventional method and above-mentioned patent provide Method has a distinct increment.
Mathematical thought of the invention, from newton-Leibniz differential theory, topological ray method rule, And the general rule of graphical measurement.The knowledge of the Data Structure and Algorithm of Computer Subject has been used simultaneously.
The method of differential ray method decision-point and closed figure positional relationship, implementation process are as follows:
1: figure is converted into a polygon for connection composition using differential thought, these points are referred to as point on line, it is characterized in that: On figure line, the coordinate value projected in X-axis is equidistant (△ x).Newdata structure saves the information put on line;
2: the ray of ray method-line segment relationship is judged, be converted into wait make an inventory of-line on point constitute the value between data structure and search It is calculated with comparing, obtains and intersect time numerical value required for ray method;
3: according to the parity for intersecting time numerical value, by the general rule of ray method, obtaining and closed wait make an inventory of with the position of polygon System.
Detailed description of the invention
The figure of 1 ray method of attached drawing describes.
Attached drawing 2 is wired to polygon with point on line to describe general curve figure.
The data structure of the invention of attached drawing 3: " look-up table-array " of coordinate value composition is put on line.
Attached drawing 4 does not find corresponding X-coordinate value wait make an inventory of on look-up table.
Attached drawing 5 has found corresponding X-coordinate value wait make an inventory of on look-up table, and the number for being greater than the point of its Y value is even Number.
Attached drawing 6 has found corresponding X-coordinate value wait make an inventory of on look-up table, and the number for being greater than the point of its Y value is odd number.
Specific embodiment
Any closed figure in two-dimentional X-Y cartesian cartesian coordinate system, such as rectangle, triangle, diamond shape, parallel four side Shape, circle, ellipse and other irregular closed figures are all that (straight-line segment is one kind of curved segments by curved segments Special shape) composition.And differential method can be used in curved segments, with the specified point (hereinafter referred to as point on line) on curve Line is simulated one by one, these points are characterized in: the △ x at equal intervals in X-axis.According to the thought of the differential calculus limit, as long as △ x foot Enough small, lim(△ x-> 0), unlimited is approached original curve by the line of specified point.It is formed using the line of specified point polygon Shape will be closer to original figure.A typical closed figure will be fastened by two-dimensional coordinate below: this is illustrated for oval Invention.Such as attached drawing 2, in the case where specific △ x value, ellipse can be described as the polygon of the line put on 12 lines combination on figure Shape.This 12 points are (X1, Y1), (X1, Y2), (X1+ △ x, Y3), (X1+2 △ x, Y4), (X1+3 △ x, Y5), (X1+4 respectively △ x, Y6), (X1+5 △ x, Y7), (X1+5 △ x, Y8), (X1+4 △ x, Y9), (X1+3 △ x, Y10), (X1+2 △ x, Y11), (X1+ △ x, Y12).
According to the principle of measurement, if △ x is sufficiently small, using △ x as precision when measurement, arbitrary point T to be determined The X axis coordinate value Xt of (hereinafter referred to as wait make an inventory of, coordinate Xt, Yt) can be measured into 1+△ x's of a reference values X Integral multiple.
Thinking of the invention is to exchange the promotion of time performance for using memory space.It is bent on closed figure according to the differential method Line is converted into putting the polygon of composition in X-axis on equally spaced line, and the ray in ray method is special to be turned to perpendicular on X axis Ray judges ray in traditional radiographic method-line segment intersection, is converted to wait make an inventory of the lookup-for constituting data structure with point on line Numerical value multilevel iudge, then finds the intersection points of ray and figure, to determine point and figure according to the rule of ray method Positional relationship.
Program generally comprises Data Structure and Algorithm.The method that the present invention prepares data structure is: closed figure is converted At the set put on line, and it is stored in storage medium according to the following rules: point the inside X maximum value Xmax, minimum value Xmin on storage line; Point on the identical line of X value is stored, its Y-coordinate axle sequence is saved as into an array;By taking aforementioned ellipse as an example, the number of composition is put on line It is as follows according to structure:
Xmax is X1+5 △ x, Xmin X1;
Y2 and Y1 sequential storage corresponds to key value X1 at an array;
Y3 and Y12 sequential storage corresponds to key value X1+ △ x at an array;
Y4 and Y11 sequential storage corresponds to key value X1+2 △ x at an array;
Y5 and Y10 sequential storage corresponds to key value X1+3 △ x at an array;
Y6 and Y9 sequential storage corresponds to key value X1+4 △ x at an array;
Y7 and Y8 sequential storage corresponds to key value X1+5 △ x at an array;
A look-up table (hereinafter referred to as look-up table), the storage of the table sequence in addition are established with the form of array on a storage medium The corresponding array first address of specific X value:
1st node is directed toward the corresponding array of key value X1;
2nd node is directed toward the corresponding array of key value X1+ △ x;
3rd node is directed toward the corresponding array of key value X1+2 △ x;
4th node is directed toward the corresponding array of key value X1+3 △ x;
5th node is directed toward the corresponding array of key value X1+4 △ x;
6th node is directed toward the corresponding array of key value X1+5 △ x;
The data structure of generation is shown in attached drawing 3.
Algorithm of the invention will determine (Xt, the Yt) point whether in closed figure, first according to X-coordinate to be made an inventory of Value Xt is retrieved in sequential search table, sees if there is corresponding X-coordinate value:
If Xt is less than Xmin(, that is, X1 greater than Xmax(, that is, X1+5 △ x) or Xt)
So, T does not have corresponding X-coordinate value on look-up table;
Otherwise,
T has corresponding X-coordinate value on look-up table.
If T does not have corresponding X-coordinate value on look-up table, such as attached drawing 4, large circle point is (Xt, Yt), and Xt is less than Xmin. Illustrate to be parallel to Y direction and do ray wait make an inventory of as starting point, it is either upwards or downward, and on any line of figure Point is without intersection.It, should be wait make an inventory of outside figure according to the rule of ray method.
If T has corresponding X-coordinate value on look-up table, illustrate wait the straight line perpendicular to X-axis where making an inventory of, with figure There is crosspoint.At this time according to the rule of ray method, wait making an inventory of along this, along the ray done in Y-axis, judgement and figure intersection point Figure and relationship to be made an inventory of can be obtained in number;To obtain intersection point number, the present invention compares each in array corresponding to Xt one by one The size of the Y value and Y value to be made an inventory of put on a line:
There are even number or 0 if it is greater than point on the line of Y value to be made an inventory of, illustrates to wait making an inventory of along this, along doing in Y-axis Ray and original image have even number or 0 crosspoint, should be wait make an inventory of outside figure according to the rule of ray method.
If having odd number greater than point on the line of Y value to be made an inventory of in array corresponding to Xt, illustrate that the ray and original image have Odd number crosspoint should be wait make an inventory of inside figure according to the rule of ray method;
Such as attached drawing 6, coordinate (Xt, Yt) to be made an inventory of, Xt is equal to X1+ △ x, then second node is looked on look-up table, and finds pair The Y value array answered has two Y values of Y3, Y12 in the array, and through comparing, Y3 is greater than Yt, and Y12 is less than Yt, illustrates to be checked along this Point, the ray and original image done in parallel Y-axis have 1 crosspoint (X1+ △ x, Y3), and 1 is odd number, according to the rule of ray method, The point should be in figure.
Above-mentioned X-Y coordinate is replaced with into Y-X coordinate system, latitude and longitude coordinates system, be perhaps transformed into three-dimensional system of coordinate or The calculating greater than Yt will be compared to be changed to be less than the calculating of Yt, as long as meeting following 2 features is regarded as derivative of the invention Form, in the range of the present invention is protected:
1: using the differential method by graphics decomposition at the polygon for putting composition on line equidistant in certain reference axis, whether with this Invent the data structure provided;
2: the ray of ray method-line segment relationship being judged, the coordinate value that point is constituted between data structure on point-line is converted into and looks into It looks for, compare and intersect time numerical value, the algorithm whether provided with the present invention required for obtaining ray method.

Claims (15)

1. the method for differential ray method decision-point and closed figure positional relationship, it is characterised in that: will be closed using differential thought Figure is converted into an inscribed polygon for connection composition, these points are referred to as point on line, and newdata structure saves point on line Information;Whether overlapping relation judges ray-line segment that ray method in topology is required, and is converted into point on point-line to be determined Information constitutes the value between data structure and searches and compare calculating, obtains and intersects time numerical value required for ray method;According to ray The principle of method when intersection number is 0 or even number, is put except complex figure, when intersection number is odd number, is put in complex figure Within.
2. the method for differential ray method decision-point and closed figure positional relationship according to claim 1, which is characterized in that The setting method put on its line are as follows: in some number axis X-axis of plane where closed figure, from 0 point, two sides in left and right A straight line perpendicular to X-axis is done to every dx, the point that straight line intersects with closed figure, point as on line, phase on closed figure Point connection generates line segment on two adjacent lines, and all line segments constitute the inscribed polygon of figure.
3. the method for differential ray method decision-point and closed figure positional relationship according to claim 2, which is characterized in that The value of dx is determined by measurement accuracy, required precision is higher, and dx setting is smaller, and inscribed polygon is closer with closed figure, Closed figure is replaced to judge to carry out position with inscribed polygon, error is also just smaller.
4. the method for differential ray method decision-point and closed figure positional relationship according to claim 2, which is characterized in that The plane can be Descartes's X-Y coordinate, and the number axis of projection can be X-axis, be also possible to Y-axis;The plane is also possible to ball Face latitude and longitude coordinates system, the number axis of projection can be longitudinal axis, be also possible to latitude axis.
5. the method for differential ray method decision-point and closed figure positional relationship according to claim 1, it is characterised in that: Data structure composed by putting on line, by point on the line of identical X value, Y axis coordinate value constitutes a subset and closes;Each subclass By X value carry out sequence arrangement, a big set is constituted.
6. the method for differential ray method decision-point and closed figure positional relationship according to claim 5, which is characterized in that The subclass of composition is put on the line of identical X value, inside can be by the size carry out sequence arrangement of Y value.
7. the method for differential ray method decision-point and closed figure positional relationship according to claim 5, which is characterized in that Subclass can be realized with the continuity array of computer program design, can also be realized with the chained list of discreteness.
8. the method for differential ray method decision-point and closed figure positional relationship according to claim 5, which is characterized in that Each subclass is distributed by the size order of X value in big set, and corresponding subclass and right can have been searched whether according to X Which subclass answered.
9. the method for differential ray method decision-point and closed figure positional relationship according to claim 5, which is characterized in that Big set saves X value maximum value and minimum value in each subclass.
10. the method for differential ray method decision-point and closed figure positional relationship according to claim 8, feature exist The management to subclass is realized in the continuity array of, big set computer program design.
11. the method for differential ray method decision-point and closed figure positional relationship according to claim 1, feature exist In the X axis coordinate value of point to be determined determines its value precision by measurement accuracy, it is believed that be some multiple of dx.
12. the method for differential ray method decision-point and closed figure positional relationship according to claim 1, feature exist In, based on point to be determined perpendicular to X-axis, to Y-axis above do ray;According to ray method principle, if the ray with it is polygon Shape intersect number be 0 or even number when, put except inscribed polygon, intersection number be odd number when, point inscribed polygon it It is interior.
13. the method for differential ray method decision-point and closed figure positional relationship according to claim 12, feature exist In, if the X value of point to be determined, not between subclass X value maximum value each in set big in claim 9 and minimum value, The Intersecting of line and polygon number of penetrating that then point to be determined is done perpendicular to X-axis is 0, according to regular point of ray method polygon it Outside.
14. the method for differential ray method decision-point and closed figure positional relationship according to claim 12, feature exist In, if the X value of point to be determined, in the inner big set of claim 9 between each subclass X value maximum value and minimum value, It then according to the regularity of distribution of claim 8 lining set, is retrieved in the corresponding subclass of X value, according to claim 5, son The Y value put on each line is contained in set, the Y value with point to be determined is compared one by one, and records the Y put on subset middle line Value is greater than the number of the Y value of point to be determined, this number is the number that Intersecting of line and polygon is penetrated in claim 12, according to The rule of ray method, if this number is even number, point to be determined is in outside of polygon, if this number is odd number, Point to be determined is in polygonal internal.
15. the method for differential ray method decision-point and closed figure positional relationship according to claim 14, feature exist In if pressing method for claim 6 on subset middle line, in advance by Y value size carry out sequence arrangement, then in claim Judge to put the Y value with point to be determined on intra-subset line in 14, can accelerate to compare speed;If point is also pressed simultaneously on subset middle line Method for claim 7 is realized by continuity array, then the Y value put on subset middle line just constitutes successional sequence Array can be searched with dichotomy, further quickening search speed.
CN201810740596.7A 2018-07-07 2018-07-07 The method of differential ray method decision-point and closed figure positional relationship Pending CN109582745A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810740596.7A CN109582745A (en) 2018-07-07 2018-07-07 The method of differential ray method decision-point and closed figure positional relationship

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810740596.7A CN109582745A (en) 2018-07-07 2018-07-07 The method of differential ray method decision-point and closed figure positional relationship

Publications (1)

Publication Number Publication Date
CN109582745A true CN109582745A (en) 2019-04-05

Family

ID=65919575

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810740596.7A Pending CN109582745A (en) 2018-07-07 2018-07-07 The method of differential ray method decision-point and closed figure positional relationship

Country Status (1)

Country Link
CN (1) CN109582745A (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110493724A (en) * 2019-08-22 2019-11-22 北京云中融信网络科技有限公司 Position monitoring method, device, server and computer readable storage medium
CN110874102A (en) * 2020-01-16 2020-03-10 天津联汇智造科技有限公司 Virtual safety protection area protection system and method for mobile robot
CN111405473A (en) * 2020-03-10 2020-07-10 南京智鹤电子科技有限公司 Line deviation detection method and device and electronic equipment
CN112819986A (en) * 2021-02-03 2021-05-18 广东共德信息科技有限公司 Attendance system and method

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110493724A (en) * 2019-08-22 2019-11-22 北京云中融信网络科技有限公司 Position monitoring method, device, server and computer readable storage medium
CN110874102A (en) * 2020-01-16 2020-03-10 天津联汇智造科技有限公司 Virtual safety protection area protection system and method for mobile robot
CN111405473A (en) * 2020-03-10 2020-07-10 南京智鹤电子科技有限公司 Line deviation detection method and device and electronic equipment
CN111405473B (en) * 2020-03-10 2021-10-08 南京智鹤电子科技有限公司 Line deviation detection method and device and electronic equipment
CN112819986A (en) * 2021-02-03 2021-05-18 广东共德信息科技有限公司 Attendance system and method

Similar Documents

Publication Publication Date Title
CN109582745A (en) The method of differential ray method decision-point and closed figure positional relationship
Goodchild Spatial thinking and the GIS user interface
KR102005343B1 (en) Partitioned space based spatial data object query processing apparatus and method, storage media storing the same
CN108229740B (en) Method and device for determining business circle boundary, server and storage medium
CN105469445B (en) A kind of step-length changeably drawing generating method
US8874375B2 (en) Digital map projection
CN114373111A (en) Fusion method based on twin data driving and engine system
CN110110021A (en) Coordinate transformation method, terminal and storage medium between a kind of high-precision local map
CN105956994A (en) Graph processing method and device based on rasterized superposition analysis
Chaudhry et al. Indexing of real time geospatial data by IoT enabled devices: Opportunities, challenges and design considerations
Skiadopoulos et al. A family of directional relation models for extended objects
CN116433794B (en) Processing method and system for three-dimensional model in CAE software
CN117009411A (en) Method, device and computer readable storage medium for meshing space storage and indexing based on point cloud data
Glasgow A formalism for model-based spatial planning
CN109859287A (en) A method of automatically generating vector sector
CN109816783B (en) Mapping method for realizing three-dimensional modeling by coordinate diffusion
Zhang et al. A Robot Navigation System in Complex Terrain Based on Statistical Features of Point Clouds
Zhao et al. Fast k-nearest neighbor on a navigation mesh
US11163808B2 (en) Hexagon clustering of spatial data
CN111737894B (en) Particle rapid positioning method for triangular surface gridding finite element particle simulation
CN117033675B (en) Safe space calculation generation method and device based on city live-action model
WO2023207364A1 (en) Map data loading method and apparatus, computer device, and storage medium
Hou et al. Path planning for mobile robots based on improved A* algorithm
Behmann et al. Probabilistic 3d point cloud fusion on graphics processors for automotive (poster)
Zhang et al. Processing Conflict-Aware $ k $ Nearest Neighbor Queries in Euclidean Space

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
WD01 Invention patent application deemed withdrawn after publication

Application publication date: 20190405

WD01 Invention patent application deemed withdrawn after publication