A kind of method setting up fence in three dimensions
Technical field
The present invention relates to set up the method for fence, a kind of method setting up fence in three dimensions.
Background technology
Geographical fence is to build a virtual geographical frontier in space.At present, traditional geographical fence technology, is all one virtual geographical frontier of structure in two-dimensional space, and is all based on the map platform of two dimension to generate the generation of fence and to be analyzed.In the three-dimensional environment possessing elevation change, fence not only to consider the geographical environment of two dimension, and it is also contemplated that geographical elevation changes the impact on geographical position.In two-dimensional space, fence is that the drafting by planar polygons is set up, and two dimension exhibition method can not express the impact of the fence boundary geographical for two dimension of the factor such as architectural environment, space landform in true three-dimension space well.For the fence under complicated geographical environment, traditional two-dimentional geography fence easily causes the dislocation of boundary position during creating, and can not express the elevation fluctuations in real three dimensions in two-dimensional scene.In three dimensions, need to identify that the polygon that user inputs is set up fence and indexed, then according within fence index judges whether the position at spatial point data place is in fence, set up the fence in space by user.
Summary of the invention
A kind of method setting up fence in three dimensions of the present invention aims to provide a kind of method setting up geography fence in three dimensions, traditional fence is made to extend in three dimensions, set up space electronic fence index, and determine the fence at point data place in space.Set up fence for true three-dimension space and reliable method is provided.
The present invention is a kind of, and to set up the method and technology scheme of fence in three dimensions as follows:
The present invention first passes through and sets up the point data in-scope that fence index judges in space, then sets up fence edge determination index and detects three dimensions geography fence border, finally sets up three dimensions fence
The point data place fence judging in space by setting up fence index sets up three dimensions fence, comprises altogether 10 steps, which includes fence index and sets up and the judgement of point data place fence.
The flow process that fence index is set up includes:
Step 1: in three dimensions according to the polygon of user's request index building, and divide polygon data according to gridding, obtains multiple space lattices that polygon is corresponding;
Step 2: in three-dimensional scenic, obtains grid corresponding to first step space lattice, and all of point in traveling through grid, it is simple to it is set up index by next step;
Step 3: in the three-dimensional scenic set up, according to the corresponding relation between grid and polygon, set up index file;
Step 4: in three-dimensional scenic, is applied to the index file established in next step fence judgement;
The flow process that point data place fence judges includes:
Step 5: in three-dimensional scenic, the three-dimensional coordinate data of the spatial point inquired about as required, grid is calculated.In the calculation, according to the index file set up in the 3rd step, the polygon that grid is corresponding is inquired about;
Step 6: obtained in the polygon that grid is corresponding by inquiry, uses the mode of traversal to perform this operation;
Step 7: within the scope of whether the point judged in three-dimensional scenic by elevation is in polygonal elevation, if within, jump to the 8th step, if not within polygon, then continues executing with the 9th step;
Within the scope of whether step 8 is positioned at polygonal elevation by the point that ray algorithm judges in three-dimensional scenic.If within, then continue executing with the 9th step, if not within the scope of polygon, then redirect execution the tenth step;
Step 9: by judging whether the point in space is positioned at polygon, can add time polygon to the result set returned;
Step 10: whether there is also, in the range of judging polygon, the point also not inquired, if also having, being back to the 3rd step, and repeating above-mentioned several steps.If it is not, the result set output that will return, as the fence in three dimensions.
Detect three dimensions geography fence border by setting up fence edge determination index, comprise altogether four steps:
Step 11: draw a polygon A by graphics mode, this polygonal shape is determined by user;
Step 12: two-way (error in judgement) offsets with distance as Δ respectively to this polygon about A, obtains the polygon that different 2 offset distance is all Δ;
Step 13: 2 polygonal meshes step 12 obtained become a polygon;
Step 14: the flow process that the final polygon obtaining step 12 is set up according to aforesaid fence index indexes to create space lattice.Index eventually through space lattice, the geography fence border of polygon A can be detected in space.
A kind of method setting up fence in three dimensions of the present invention is relative to the advantage of conventional art: judge point data place fence by setting up fence index in space, and then set up the fence in three dimensions, it is achieved that fence foundation in three dimensions and the basis of use.By creating space lattice index, geography fence bounds in three dimensions is detected, simplify the input of user, it is achieved that for the accurate detection on the border of three-dimensional geography fence.
Accompanying drawing explanation
Fig. 1 is the fence index Establishing process figure of the embodiment of the present invention.
Fig. 2 is the flow chart of the point data place fence judgement of the embodiment of the present invention
Fig. 3 is the detection geography fence border flow chart of the embodiment of the present invention.
Detailed description of the invention
Accompanying drawing 1 is the fence index Establishing process figure of the embodiment of the present invention, comprises 6 steps altogether, and existing details are as follows:
Step 100, input needs to set up the polygon of index;
Step 101, carries out gridding process to polygon data, obtains multiple space lattices that this polygon is corresponding;
Step 102, obtains grid corresponding to this polygon (traversal grid), in order to it is set up index by next step;
Step 103, sets up the index relative between grid and polygon;
Step 104, it may be judged whether the grid that poll this polygon complete is corresponding, if also grid exists, jumps to step 102, if grid has traveled through, jumps to step 105;
Step 105, the polygon inputting step 100 is set up grid index and is terminated.
Accompanying drawing 2 is the flow chart of the point data place fence judgement of the embodiment of the present invention, comprises 8 steps altogether.It is existing that details are as follows:
Step 200, input need inquiry space coordinates point P (x, y, z);
Step 201, according to P, (x, y, z) calculate grid, the index that step 103 is set up in 1 with reference to the accompanying drawings, the polygon that inquiry grid is corresponding;
Step 202, obtains the polygon (traversal polygon) in corresponding polygon;
Whether step 203, by elevation decision-point P within the scope of polygonal elevation.If it does not, jump to step 206;If it is, continue next step 204;
Whether step 204, by ray algorithm decision-point P within the scope of polygon.If it does not, jump to step 206: if it is, continue next step 205;
Step 205, it is determined that some P is in this polygon, adds this polygon to the result set returned.
Step 206, it may be judged whether there is also poll complete grid inner polygon and be not polled to.If it is, jump to step 202;If it does not, continue next step 207;
Step 207, returns the result set that step 205 obtains.
Accompanying drawing 3 is the flow chart of the method on the detection three dimensions geography fence border of the embodiment of the present invention
Fence edge determination for the embodiment of the present invention indexes Establishing process figure, comprises four steps altogether, and existing details are as follows:
Step 300: user inputs the polygon (in example as a example by rectangle) specified;
Step 301: the offset operation being Δ (error in judgement) to the two-way enforcement in this polygon left and right distance, obtains the polygon (dotted portion) that 2 offset distances are Δ;
Step 302: 2 polygons (dotted portion) step 301 obtained are merged into a polygon;
Step 303: the final polygon obtaining step 302 sets up space lattice index.Index eventually through space lattice, utilize aforesaid fence index establishing method (step 100 to step 207), polygonal geography fence border can be detected in space.