CN101593110B - Method for judging whether coordinate belongs to region - Google Patents
Method for judging whether coordinate belongs to region Download PDFInfo
- Publication number
- CN101593110B CN101593110B CN 200910112099 CN200910112099A CN101593110B CN 101593110 B CN101593110 B CN 101593110B CN 200910112099 CN200910112099 CN 200910112099 CN 200910112099 A CN200910112099 A CN 200910112099A CN 101593110 B CN101593110 B CN 101593110B
- Authority
- CN
- China
- Prior art keywords
- execution
- coordinate points
- effective coverage
- delta
- anchor
- 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.)
- Expired - Fee Related
Links
Images
Landscapes
- Image Analysis (AREA)
Abstract
The invention discloses a method for judging whether a coordinate belongs to a region. The method decomposes the judgment whether the coordinate belongs to the region into the judgment whether one coordinate belongs to a plurality of delta-shaped regions to obtain a judgment result. The judgment whether the coordinate belongs to the delta-shaped regions has a simple algorithm, less calculation amount and various methods without floating point operation, so the method has the advantages that: 1, the method can finish the judgment whether or not a processor with floating point operation is supported; and 2, the method has high judgment efficiency and accurate judgment results.
Description
Affiliated technical field
The present invention relates to a kind of judge coordinate points whether belong to the zone method.
Background technology
In built-in terminal interface development process, often need judge that mouse or touch point are whether in certain irregular polygon zone, also be that frequent needs judge whether coordinate points belongs to the zone, when for example opening a plurality of window, to have overlapping phenomenon between window, the overlay region namely is a region of disorder, need to judge when mouse is clicked to click to belong in which window area.
In GPRS (Global Positioning System (GPS)), often need to judge certain position in which zone, also be often to need judge whether coordinate points belongs to regional, for example judges whether certain geographical disaster is positioned within certain country.
Present judgement mostly adopts interior horn cupping to judge.Because interior horn cupping needs to introduce Floating-point Computation in judging, so it has following technical matters: 1, some processor tenaculum floating-point operation not, can't finish judgement; 2, judging efficiency is low, the judged result out of true.
Summary of the invention
The invention provides a kind of judge coordinate points whether belong to the zone method, its interior horn cupping that has overcome background technology is judged existing deficiency.
The technical solution adopted for the present invention to solve the technical problems is:
A kind ofly judge whether coordinate points belongs to the method in zone, and this effective coverage is surrounded by a plurality of continuous anchor points, and this anchor point number is more than or equal to 3, this determination methods, it comprises:
Step 1 judges that the anchor point number of effective coverage is greater than 3 or equals 3, if greater than 3 execution in step 2, if equal 3 execution in step 8;
Step 2 reads three anchor points, does not have other anchor point within the delta-shaped region that these three anchor points surround;
Whether step 3 judges the clockwise angle of described three anchor points greater than 180 degree, and if it is execution in step 5, otherwise execution in step 4;
Step 4 judges whether coordinate points is positioned within the described delta-shaped region, represents that if it is this coordinate points does not belong to zone and execution in step 9, otherwise execution in step 7;
Step 5 judges whether coordinate points is positioned within the described delta-shaped region, represents that if it is this coordinate points belongs to effective coverage and execution in step 9, otherwise execution in step 6;
Step 6 resolves into decomposition region and delta-shaped region with the effective coverage, and the decomposition region is set to new effective coverage and execution in step 1;
Step 7, delta-shaped region and effective coverage sum are set to new effective coverage and execution in step 1;
Step 8 judges whether coordinate points is positioned within the described delta-shaped region, represents that if it is this coordinate points belongs to effective coverage and execution in step 9, otherwise represents that this coordinate points does not belong to zone and execution in step 9;
Step 9 draws judged result and end.
In one preferred embodiment, also comprise before this step 1:
Step 0, the interfix point of three continuous anchor points that removal is located along the same line.
In one preferred embodiment, this step 0, it comprises:
Step 01 reads three continuous anchor point d{i}, d{i+1}, and d{i+2}, wherein, i is circulation variate parameter, initial value is 0;
Step 02 judges whether three anchor points are positioned on the same straight line, and if it is execution in step 03, otherwise execution in step 04;
Step 03, the anchor point d{i+1} in the middle of deletion is positioned at, then execution in step 04;
Step 04, variate parameter i adds 1, then judges the i+1 value whether greater than the number of anchor point, and if it is execution in step 1, otherwise execution in step 01.
In one preferred embodiment, this step 2, it comprises:
Step 21 reads three anchor point d{0} in order, d{1}, and d{X}, wherein, X is circulation variate parameter, initial value is 2;
Step 22 judges within the delta-shaped region that is surrounded by three above-mentioned anchor points whether other anchor point is arranged, if having then execution in step 23, otherwise execution in step 3;
Step 23, the variate parameter X adds 1, and then execution in step 21.
The technical program is compared with background technology: the applicant will judge dexterously whether a coordinate points belongs to irregular area and resolve into and judge whether a coordinate points belongs to delta-shaped region, to draw judged result, and judge whether a coordinate points belongs to delta-shaped region, algorithm is simple, calculated amount is few, method is a lot, need not floating-point operation, so it has following advantage: 1, no matter support that the processor of tenaculum floating-point operation can both not finished judgement; 2, judging efficiency is high, and judged result is accurate.Owing to also comprising and judging one by one whether every three continuous anchor points are positioned on the same straight line, and therefore the anchor point in the middle of if it is deletion is positioned at can reduce calculation times, accelerates computing velocity.
Description of drawings
The present invention is further described below in conjunction with drawings and Examples.
Fig. 1 is whether the coordinate points of judging of a preferred embodiment of the present invention belongs to the process flow diagram of the method in zone.
Fig. 2 is that the areal map of one embodiment of the invention is processed one of schematic diagram.
Fig. 3 is that the areal map of one embodiment of the invention is processed two of schematic diagram.
Fig. 4 is that the areal map of one embodiment of the invention is processed three of schematic diagram.
Fig. 5 is that the areal map of one embodiment of the invention is processed four of schematic diagram.
Fig. 6 is that the areal map of one embodiment of the invention is processed five of schematic diagram.
Fig. 7 is that the areal map of one embodiment of the invention is processed six of schematic diagram.
Fig. 8 is that the areal map of one embodiment of the invention is processed seven of schematic diagram.
Fig. 9 is that the areal map of one embodiment of the invention is processed eight of schematic diagram.
Embodiment
A kind of judge coordinate points whether belong to the zone method, it is used among the computing equipment, this computing equipment comprises a CPU and a storer.It is used for will having overlapping phenomenon between window when opening a plurality of window, and the overlay region namely is a region of disorder, need to judge to click to belong in which window area when mouse is clicked.
Zone in the present embodiment is irregular area or regular domain, is surrounded by a plurality of continuous anchor points, and this anchor point comprises d{1}, d{2} ..., d{n}, n is more than or equal to 3.
Please refer to Fig. 1, it has illustrated a kind ofly judges whether coordinate points belongs to the process flow diagram of method in zone.A kind ofly judge whether coordinate points belongs to the method in zone, and this effective coverage is surrounded by a plurality of continuous anchor points, and this anchor point number is more than or equal to 3, this determination methods, it comprises:
Step 0, the interfix point of three continuous anchor points that removal is located along the same line; Wherein, this step 0, it specifically comprises:
Step 01 reads three continuous anchor point d{i} among storer, d{i+1}, and d{i+2}, wherein, i is circulation variate parameter, initial value is 0;
Step 02 judges whether three anchor points are positioned on the same straight line, and if it is execution in step 03, otherwise execution in step 04; This judgement can be adopted: judge whether three angles between the anchor point equal 180 degree, because this calculating all is to adopt solid point to calculate, therefore need not Floating-point Computation;
Step 03, the anchor point d{i+1} in the middle of deletion is positioned at, then execution in step 04; And
Step 04, variate parameter i adds 1, then judges the i+1 value whether greater than the number of anchor point, and if it is execution in step 1, otherwise execution in step 01;
Step 1 judges that the anchor point number of effective coverage is greater than 3 or equals 3, if greater than 3 execution in step 2, if equal 3 execution in step 8;
Step 2 reads three anchor points, does not have other anchor point within the delta-shaped region that these three anchor points surround; Wherein, this step 2, it specifically comprises:
Step 21 reads three anchor point d{0} in order among storer, d{1}, and d{X}, wherein, X is circulation variate parameter, initial value is 2;
Step 22 judges within the delta-shaped region that is surrounded by three above-mentioned anchor points whether other anchor point is arranged, if having then execution in step 23, otherwise execution in step 3; And
Step 23, the variate parameter X adds 1, and then execution in step 21;
Whether step 3 judges the clockwise angle of described three anchor points greater than 180 degree, and if it is execution in step 5, otherwise execution in step 4;
Step 4 judges whether coordinate points is positioned within the described delta-shaped region, represents that if it is this coordinate points does not belong to zone and execution in step 9, otherwise execution in step 7;
Step 5 judges whether coordinate points is positioned within the described delta-shaped region, represents that if it is this coordinate points belongs to effective coverage and execution in step 9, otherwise execution in step 6;
Step 6 resolves into decomposition region and delta-shaped region with the effective coverage, and the decomposition region is set to new effective coverage and execution in step 1;
Step 7, delta-shaped region and effective coverage sum are set to new effective coverage and execution in step 1;
Step 8 judges whether coordinate points is positioned within the described delta-shaped region, represents that if it is this coordinate points belongs to effective coverage and execution in step 9, otherwise represents that this coordinate points does not belong to zone and execution in step 9;
Step 9 draws judged result and end, and judged result is sent to next program to make the execution associative operation, for example, is the current window zone with the correlation window region division.
For the ease of the clear understanding of reader the present invention, the below describes especially exemplified by an example, and this areal map is surrounded by d{0}, d{1}, d{2}, d{3}, d{4}, d{5}, d{6}, d{7}, d{8}, d{9}.This determination methods, it comprises:
Steps A has the d4 point in the triangle that d0, d1, d2 form; There is not other point in the triangle that d1, d2, d3 form, so the delta-shaped region A_1_2_3 that selects d1, d2, d3 to form.The limit d1d2 of triangle A_1_2_3 and the clockwise angle of limit d2d3 are greater than 180 degree, as shown in Figure 2.Judge whether coordinate points is positioned within the A_1_2_3, represent that if it is this coordinate points is positioned within the zone, otherwise remove A_1_2_3 and carry out lower step;
Step B has d4, d5, d6, d8 point in the triangle that d0, d1, d3 form; There is not other point in the triangle that d1, d3, d4 form, so the delta-shaped region A_1_3_4 that selects d1, d3, d4 to form.The limit d1d3 of triangle A_1_3_4 and the clockwise angle of limit d3d4 are greater than 180 degree, as shown in Figure 3.Judge whether coordinate points is positioned within the A_1_3_4, represent that if it is this coordinate points is positioned within the zone, otherwise remove A_1_3_4 and carry out lower step;
Step C does not have other point in the triangle that d0, d1, d4 form, so the delta-shaped region A_0_1_4 that selects d0, d1, d4 to form.The limit d0d1 of triangle A_0_1_4 and the clockwise angle of limit d1d4 are greater than 180 degree, as shown in Figure 4.Judge whether coordinate points is positioned within the A_0_1_4, represent that if it is this coordinate points is positioned within the zone, otherwise remove A_0_1_4 and carry out lower step;
Step D has the d8 point on the triangle edges that d0, d4, d5 form; There is not other point in the triangle that d4, d5, d6 form, so the delta-shaped region A_4_5_6 that selects d4, d5, d6 to form.The limit d5d6 of triangle A_4_5_6 and the clockwise angle of limit d6d7 are less than 180 degree, as shown in Figure 5.Judge whether coordinate points is positioned within the A_4_5_6, represent that if it is this coordinate points is not positioned within the zone, otherwise the lower step of completion A_4_5_6 and execution;
Step e has the d8 point on the triangle edges that d0, d4, d6 form; There is not other point in the triangle that d4, d6, d7 form, so the delta-shaped region A_4_6_7 that selects d4, d6, d7 to form.The limit d4d6 of triangle A_4_6_7 and the clockwise angle of limit d6d7 are greater than 180 degree, as shown in Figure 6.Judge whether coordinate points is positioned within the A_4_6_7, represent that if it is this coordinate points is positioned within the zone, otherwise remove A_4_6_7 and carry out lower step;
Step F has the d8 point in the triangle that d0, d4, d7 form; There is not other point in the triangle that d4, d7, d8 form, so the delta-shaped region A_4_7_8 that selects d4, d7, d8 to form.The limit d4d7 of triangle A_4_7_8 and the clockwise angle of limit d7d8 are greater than 180 degree, as shown in Figure 7.Judge whether coordinate points is positioned within the A_4_7_8, represent that if it is this coordinate points is positioned within the zone, otherwise remove A_4_7_8 and carry out lower step;
Step G does not have other point in the triangle that d0, d4, d8 form, so the delta-shaped region A_0_4_8 that selects d0, d4, d8 to form.The limit d0d4 of triangle A_0_4_8 and the clockwise angle of limit d4d8 are greater than 180 degree, as shown in Figure 8.Judge whether coordinate points is positioned within the A_0_4_8, represent that if it is this coordinate points is positioned within the zone, otherwise remove A_0_4_8 and carry out lower step;
Step H as shown in Figure 9, judges whether coordinate points is positioned within the A_0_8_9, represents that if it is this coordinate points is positioned within the zone, otherwise represents that this coordinate points is not positioned within the zone.
The above embodiments, mainly be to describe as an example of the embedded type interface development and Design example, but not as limit, equally, it can be applied in judges in GPRS (Global Positioning System (GPS)) certain position is in which zone, also be that frequent needs judge that whether coordinate points belongs to the zone, for example judges whether certain geographical disaster is positioned within certain country.
The above, only for preferred embodiment of the present invention, therefore can not limit scope of the invention process with this, the equivalence of namely doing according to the present patent application claim and description changes and modifies, and all should still belong in the scope that patent of the present invention contains.
Claims (3)
1. judge whether coordinate points belongs to the method in zone, and described zone definitions is the effective coverage, and this effective coverage is surrounded by a plurality of continuous anchor points, and this anchor point number is characterized in that more than or equal to 3 for one kind: this determination methods, it comprises:
Step 1 judges that the anchor point number of effective coverage is greater than 3 or equals 3, if greater than 3 execution in step 2, is delta-shaped region and execution in step 8 if equal 3;
Step 2 reads three anchor points, does not have other anchor point within the delta-shaped region that these three anchor points surround; It comprises:
Step 21 is docile and obedient hour hands and is sequentially read three anchor point d{0}, d{1}, and d{X}, wherein, X is circulation variate parameter, initial value is 2;
Step 22 judges within the delta-shaped region that is surrounded by three above-mentioned anchor points whether other anchor point is arranged, if having then execution in step 23, otherwise execution in step 3;
Step 23, the variate parameter X adds 1, and then execution in step 21;
Step 3 is judged the clockwise angle of described three anchor points, also be clockwise angle between " d{0}d{1} " and " d{1}d{X} " whether greater than 180 degree, if it is execution in step 5, otherwise execution in step 4;
Step 4 judges whether coordinate points is positioned within the described delta-shaped region, represents that if it is this coordinate points does not belong to effective coverage and execution in step 9, otherwise execution in step 7;
Step 5 judges whether coordinate points is positioned within the described delta-shaped region, represents that if it is this coordinate points belongs to effective coverage and execution in step 9, otherwise execution in step 6;
Step 6 resolves into decomposition region and newly-generated delta-shaped region with the effective coverage, and the decomposition region is set to new effective coverage and execution in step 1;
Step 7, the delta-shaped region of step 4 and effective coverage sum are set to new effective coverage and execution in step 1;
Step 8 judges whether coordinate points is positioned within the described delta-shaped region, represents that if it is this coordinate points belongs to effective coverage and execution in step 9, otherwise represents that this coordinate points does not belong to effective coverage and execution in step 9;
Step 9 draws judged result and end.
2. according to claim 1ly a kind ofly judge that whether coordinate points belongs to the method in zone, is characterized in that: also comprise before this step 1:
Step 0, the interfix point of three continuous anchor points that removal is located along the same line.
According to claim 2 a kind of judge coordinate points whether belong to the zone method, it is characterized in that: this step 0, it comprises:
Step 01 reads three continuous anchor point d{i}, d{i+1}, and d{i+2}, wherein, i is circulation variate parameter, initial value is 0;
Step 02 judges whether three anchor points are positioned on the same straight line, and if it is execution in step 03, otherwise execution in step 04;
Step 03, the anchor point d{i+1} in the middle of deletion is positioned at, then execution in step 04;
Step 04, variate parameter i adds 1, then judges the i+1 value whether greater than the number of anchor point, and if it is execution in step 1, otherwise execution in step 01.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN 200910112099 CN101593110B (en) | 2009-06-17 | 2009-06-17 | Method for judging whether coordinate belongs to region |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN 200910112099 CN101593110B (en) | 2009-06-17 | 2009-06-17 | Method for judging whether coordinate belongs to region |
Publications (2)
Publication Number | Publication Date |
---|---|
CN101593110A CN101593110A (en) | 2009-12-02 |
CN101593110B true CN101593110B (en) | 2013-03-06 |
Family
ID=41407780
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN 200910112099 Expired - Fee Related CN101593110B (en) | 2009-06-17 | 2009-06-17 | Method for judging whether coordinate belongs to region |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN101593110B (en) |
Families Citing this family (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111273971B (en) | 2018-12-04 | 2022-07-29 | 腾讯科技(深圳)有限公司 | Method and device for processing information in view and storage medium |
CN113050659B (en) * | 2021-04-20 | 2022-05-31 | 福建首松智能科技有限公司 | Method for avoiding and scheduling multiple dish conveying robots |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
GB257059A (en) * | 1925-07-06 | 1926-08-26 | Willem Cornelis Van Der Sterr | Improvements relating to levelling staves and like surveying instruments |
EP1329692A1 (en) * | 2002-01-17 | 2003-07-23 | Robert Bosch Gmbh | Method for determining map data |
CN101033966A (en) * | 2007-04-12 | 2007-09-12 | 上海交通大学 | Photography measurement method of scene of a traffic accident |
-
2009
- 2009-06-17 CN CN 200910112099 patent/CN101593110B/en not_active Expired - Fee Related
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
GB257059A (en) * | 1925-07-06 | 1926-08-26 | Willem Cornelis Van Der Sterr | Improvements relating to levelling staves and like surveying instruments |
EP1329692A1 (en) * | 2002-01-17 | 2003-07-23 | Robert Bosch Gmbh | Method for determining map data |
CN101033966A (en) * | 2007-04-12 | 2007-09-12 | 上海交通大学 | Photography measurement method of scene of a traffic accident |
Also Published As
Publication number | Publication date |
---|---|
CN101593110A (en) | 2009-12-02 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US10288434B2 (en) | Map-centric map matching method and apparatus | |
CN108572999B (en) | Method and device for searching AOI contour of interest surface | |
CN108279016B (en) | Smoothing processing method and device for HAD map, navigation system and automatic driving system | |
CN109726489B (en) | Method and system for establishing driving assistance database | |
SE1251163A1 (en) | System and method in connection with the occurrence of vehicle trains | |
CN108229740B (en) | Method and device for determining business circle boundary, server and storage medium | |
CN104200042A (en) | Positioning-data trajectory tracking method | |
CN101727580A (en) | Image processing apparatus, electronic medium, and image processing method | |
CN105205841B (en) | The ground drawing generating method and system of GIS-Geographic Information System | |
CN101593110B (en) | Method for judging whether coordinate belongs to region | |
CN106156245B (en) | Line element merging method and device in electronic map | |
CN109341704B (en) | Map precision determination method and device | |
US7542589B2 (en) | Road position detection | |
CN114328785A (en) | Method and device for extracting road information | |
CN113742437A (en) | Map updating method and device, electronic equipment and storage medium | |
CN112966330A (en) | Wall surface generation method of crossed wall body, computer equipment and readable storage medium | |
CN108053751B (en) | Method and device for drawing direction arrow on electronic map navigation route | |
CN102496330A (en) | Isomorphic model for hexagonal grid and modeling method and application thereof | |
CN115422196A (en) | Vector data topological relation checking method | |
CN100557656C (en) | Vehicle area recognizing method | |
CN114138925A (en) | Location point belonging area retrieval method, device, electronic equipment, medium and product | |
CN113868518A (en) | Thermodynamic diagram generation method and device, electronic equipment and storage medium | |
CN109949360B (en) | Method and device for extracting road center line, electronic equipment and storage medium | |
JP2006268053A (en) | Geographical feature data processing method | |
CN104801044A (en) | Method and device for generating trajectory vertex sequence |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
C14 | Grant of patent or utility model | ||
GR01 | Patent grant | ||
C17 | Cessation of patent right | ||
CF01 | Termination of patent right due to non-payment of annual fee |
Granted publication date: 20130306 Termination date: 20130617 |