Summary of the invention
In view of this, the invention provides a kind of decision method and device of spatial entities type of barrier, to solve in the prior art the type of barrier decision process complexity of massive spatial data, treatment effeciency is low, judges the problem of weak effect, and its concrete scheme is as follows:
A kind of decision method of spatial entities type of barrier comprises:
From the spatial entities to be analyzed that sorts according to default ordering rule, choose current spatial entities to be analyzed;
According to predefined view control parameter, the original coordinates conversion of the luv space data of described current spatial entities to be analyzed is obtained the view coordinate of view window;
Analyze the type of barrier of described spatial entities in described view window;
Whether the type of barrier of judging described spatial entities meets default effective spatial entities condition, if, determine that then described spatial entities is useful space entity, if not, determine that then described spatial entities is the idle space entity;
Choose described useful space entity;
With described useful space entity transmission to client.
Preferably, described view window utilizes data structure to represent according to described view control parameter, be specially: the pixel of representing described view window according to described view control parameter with described raster data structure, described pixel is the uniform grid unit that described view window plane is divided into, described pixel is the essential information storage unit in the described raster data, the coordinate position of described pixel number determines that the initial value of setting the raster data of the described pixel of expression all is 0 according to described pixel corresponding row number and row in described view window.
Preferably, the process of the type of barrier of the described spatial entities of described analysis in described view window comprises:
Whether the value of judging the pixel that need draw when described spatial entities shows in described view window all is 1, if be 1 all, then described type of barrier is for blocking fully; If be 0 all, then described type of barrier is not for being blocked; If part is 1, then described type of barrier is partial occlusion.
Preferably, when the type of barrier of described spatial entities for not being blocked and/or during partial occlusion, pixel value is that 0 pixel assignment is 1 in the pixel that described spatial entities need be drawn when described view window shows.
Preferably, the condition of described default effective spatial entities comprises: type of barrier is the spatial entities that is not blocked and part is blocked for spatial entities or the type of barrier that is not blocked.
Preferably, institute's view control parameter comprises: the outsourcing rectangle parameter of view mode and view window; Described view mode comprises: two-dimensional model and three dimensional pattern, and the outsourcing rectangle parameter of described view window comprises: the height of the width of the outsourcing rectangle of view window and the outsourcing rectangle of view window;
When described view mode is two-dimensional model, described view control parameter also comprises: spatial entities in described view window centre coordinate point and view in the magnification ratio of space entity, the perhaps magnification ratio of space entity in the rectangular extent of search space entity and the view;
When described view mode was three dimensional pattern, described view control parameter also comprised: viewpoint parameter and projective parameter, described viewpoint parameter comprise the vector that target location that position, the viewpoint of viewpoint in world coordinate system is observed and virtual camera make progress; Described projective parameter comprises: rectangular projection and perspective projection.
Preferably, when the view mode in the described view control parameter was two-dimensional model, described default ordering rule sorted to spatial entities for the backward according to the spatial entities drawing order.
Preferably, when the view mode in the described view control parameter was three dimensional pattern, described default ordering rule was for to sort to spatial entities from viewpoint order from the close-by examples to those far off according to spatial entities.
A kind of decision maker of spatial entities type of barrier comprises:
Choose the unit, be used for choosing current spatial entities to be analyzed from the spatial entities to be analyzed that sorts according to default ordering rule;
Coordinate transformation unit according to predefined view control parameter, obtains the original coordinates conversion of the luv space data of described current spatial entities to be analyzed on the view coordinate of view window;
The type of barrier analytic unit is used for analyzing described spatial entities in the type of barrier of described view window;
Judging unit is used for judging whether the type of barrier of described spatial entities meets default effective spatial entities condition, if, determine that then described spatial entities is useful space entity, if not, determine that then described spatial entities is the idle space entity;
Choose the unit, be used for choosing described useful space entity, and with described useful space entity transmission to client.
From above-mentioned technical scheme as can be seen, the decision method of the disclosed spatial entities type of barrier of the embodiment of the invention, according to predefined view control parameter the original coordinates conversion of the luv space data of spatial entities is obtained view coordinate in the view window, the situation of blocking when judging that by analyzing described view coordinate described spatial entities shows, simplified in the prior art blocking the computation process of calculating between the spatial entities, reduced calculated amount, improve the judgement efficient to type of barrier, solved the problem of the complicated difficulty of real-time judge process of magnanimity spatial entities type of barrier.
Embodiment
Below in conjunction with the accompanying drawing in the embodiment of the invention, the technical scheme in the embodiment of the invention is clearly and completely described, obviously, described embodiment only is the present invention's part embodiment, rather than whole embodiment.Based on the embodiment among the present invention, those of ordinary skills belong to the scope of protection of the invention not making the every other embodiment that obtains under the creative work prerequisite.
The present invention studies spatial data with the angle that view shows, angle from view, under the situation that the resolution of view window is determined, many magnanimity no matter, many meticulous spatial datas, be used for view window and show that needed maximum useful space data are constant, it is exactly the required spatial data of whole pixels that is used for having filled view window, because the sum of all pixels that view window can show is limited, no matter the amount of spatial data has much, the pixel that we can see is determined, if the spatial entities gland of drawing behind the spatial entities of drawing the earlier quilt, the spatial entities that then is equivalent to draw the back has blocked the spatial entities of first drafting, if block fully, the spatial entities that is blocked fully from the angle of view demonstration is not need to read, transmission or draw in view window.
Specifically, the procedure for displaying of spatial entities generally is: at first to take out and pass to the spatial entities user through transmission medium be client to the spatial entities that will meet given space condition by spatial data index, after then the spatial data of spatial entities being carried out a series of geometric transformation and handling, be transformed to the coordinate points on the two dimensional image; According to display parameter, spatial entities finally is tiled into image pixel by drawing algorithm, is depicted as a width of cloth two-dimensional grid image, shows or output at screen, as computer screen demonstration, printout and the output of generation image file etc. on paper.The wherein drafting of spatial entities, finally being drawn algorithm is summed up as the operation of pixel one by one, the present invention is exactly on the basis based on above-mentioned spatial data procedure for displaying, according to predefined view control parameter, the original coordinates of the luv space data of spatial entities is transformed to the view coordinate that utilizes the view window that data structure represents according to view control parameter, come the demonstration situation of analysis space entity on the actual view window that shows by the pixel of analyzing and the processing spatial entities need be drawn when described view window shows, and then the situation of blocking between the analysis space entity, so that subsequent processes can be chosen or the transmission space entity targetedly according to the result who analyzes, simplify type of barrier calculation process and calculated amount in the prior art, improved efficient and the accuracy judged.For convenience of description, to need the spatial data of the spatial entities handled to be referred to as the luv space data in the present specification, the coordinate of the spatial data that need handle is referred to as the original coordinates of luv space data, need the coordinate points of the spatial data of processing to be referred to as the original coordinates point of luv space data, or directly be referred to as the original coordinates point.Its concrete embodiment is as described below:
The flow process of the decision method of the disclosed a kind of spatial entities type of barrier of the embodiment of the invention comprises as shown in Figure 1:
Step S11, from the spatial entities to be analyzed that sorts according to default ordering rule, choose current spatial entities to be analyzed;
When the view mode in the described view control parameter was two-dimensional model, described default ordering rule sorted to spatial entities for the backward according to the spatial entities drawing order.When the view mode in the described view control parameter was three dimensional pattern, described default ordering rule was for to sort to spatial entities from viewpoint order from the close-by examples to those far off according to spatial entities.
Step S12, according to predefined view control parameter, the original coordinates conversion of the spatial data of described current spatial entities to be analyzed is obtained the view coordinate of view window;
View control parameter in the present embodiment comprises: the outsourcing rectangle parameter of view mode and view window.It is two-dimensional model or three dimensional pattern that view mode namely preestablishes view window according to the view window of reality.The outsourcing rectangle parameter of view window is display space view of entities window ranges (0,0, ViewWidth, ViewHeight), scope as the computer screen map display window, comprise: the height ViewHeight of the width ViewWidth of the outsourcing rectangle of view window and the outsourcing rectangle of view window, by these two parameters, can determine in the actual view window to be used for to show the magnitude range of the window of image.Can obtain simultaneously the size for the raster data of expression view window.As with pixel value of m byte representation, represent that then the size of the raster data of view window is: (ViewWidth*ViewHeight*m).And will be 0 for the initial value assignment of the raster data of representing view window.
Except the outsourcing rectangle parameter that comprises view mode and view window, according to the difference of view mode, the particular content of view control parameter also is not quite similar.When view mode is two-dimensional model, the magnification ratio that also comprises space entity in the rectangular extent of search space entity and the view, can also utilize the centre coordinate point of described spatial entities under described view window to replace the rectangular extent of search space entity, as long as can realize that the original coordinates conversion with the luv space data obtains the view coordinate of view window.The rectangular extent of search space entity refers to the spatial entities in this scope is presented in the view window, the outsourcing rectangle of the spatial entities that in view window, can show just, and its concrete value range is set according to the demonstration situation of reality.When view mode is three dimensional pattern, also comprise viewpoint parameter and projective parameter, described viewpoint parameter comprises the position O (x of viewpoint in predefined world coordinate system
o, y
o, z
o), x
o, y
o, z
oThree components of expression viewpoint in world coordinate system, the target location A (x that viewpoint is observed
a, y
a, z
a) and the vectorial up (x that makes progress of virtual camera
Up, y
Up, z
Up); Described projective parameter comprises: rectangular projection and perspective projection.Or according to viewing matrix and projection matrix that above-mentioned parameter obtains, utilize viewing matrix and projection matrix to carry out coordinate transform.According to different view control parameters, the original coordinates of luv space data is transformed to the view coordinate of the view window under the associative mode.
The data of described view coordinate correspondence are viewdata, determine view control parameter after, utilize data structure to represent view window according to view control parameter.Expression view window described herein can be the actual Physical View window that can show, also can be the logical view Windows that generate in order to analyze.
When utilizing raster data structure to represent view window, represent the two-dimensional grid image with raster data, showing that the view window plane is divided into uniform grid, each grid cell is called pixel, raster data structure is exactly pel array, each pixel in the grid is information memory cell the most basic in the raster data, and its coordinate position can number be determined with row number and row.Because raster data is by certain regularly arranged, so the spatial entities position of expression relation is among the implicit number of being expert at, row number.Each pixel value is used for representing the attribute of spatial entities or the coding of attribute.
According to predefined view control parameter, the original coordinates conversion of the luv space data that receive is obtained view coordinate under the view window coordinate system, view coordinate points under the original coordinates point respective view window coordinates system of luv space data, each view coordinate points is come the block situation of analysis space entity when the actual view window that shows shows with corresponding according to the pixel of the represented view window of view control parameter with raster data by the pixel that the analysis space entity need be drawn when described view window shows.
Step S13, the type of barrier of the described spatial entities of analysis in described view window;
Type of barrier comprises: block fully, namely the representation space entity is blocked fully by other spatial entities; Partial occlusion represents that namely described spatial entities is by other spatial entities partial occlusion; Be not blocked, namely the representation space entity is not blocked by other spatial entities.
Concrete deterministic process can obtain the pixel that spatial entities need be drawn at the procedure for displaying on the actual view window by the virtual space entity when view window shows, the procedure for displaying of spatial entities generally is: after the spatial data of spatial entities is carried out a series of geometric transformation and handles, be transformed to the coordinate points on the two dimensional image; According to display parameter, spatial entities finally is tiled into image pixel by drawing algorithm, is depicted as a width of cloth two-dimensional grid image, shows or output at screen.The present invention is based on said process, by described view coordinate according to drawing algorithm (as the drawing algorithm Bresenham algorithm of line segment) obtain spatial entities as described in the pixel that need draw when showing of view window, judge the described value that needs the pixel of drafting then, if all be 1, then described type of barrier is for blocking fully; If be 0 all; Then described type of barrier is not for being blocked; If part is 1, then described type of barrier is partial occlusion, that is to say, and be 1 as long as in the described pixel that needs to draw pixel value is arranged, described spatial entities has just been blocked by other spatial entities.As long as in the described pixel that needs to draw pixel value being arranged is 0, described spatial entities is not just blocked by other spatial entities fully.
When described spatial entities is not blocked fully by other spatial entities, namely when the type of barrier of described spatial entities for not being blocked and/or during partial occlusion, indicating described spatial entities if desired draws in described pixel, then pixel value is that 0 pixel assignment is 1 in the pixel that described spatial entities need be able to be drawn when described view window shows, in the process that guarantees follow-up decision space entity type of barrier, if there is other spatial entities also will show in above-mentioned pixel, will be judged as and be blocked, to guarantee the accuracy of decision process.
The analysis of in the present embodiment view coordinate being carried out or processing are the processing of carrying out after making up with single pixel or with a plurality of pixels, can set concrete processing mode flexibly according to the needs of actual conditions.Its concrete operations at pixel remove and comprise to the pixel assignment, being about to spatial data carries out outside the rasterizing, also comprise read pixel and pixel value is judged, when pixel is represented with a plurality of bits, can show as to the whole assignment of a pixel or to any one or a plurality of assignment of carrying out in a plurality of bits of expression pixel the assignment of pixel; The operation of read pixel also can show as integral value to a pixel read with read pixel in the value of certain or certain several bits; In like manner, the judgement of pixel value is also judged for the implication to the value representative of the integral value of a pixel or certain or certain several bits.
As a pixel with the view window of 4 bit data representations simulation, wherein represent whether to have key element rasterizing on this pixel with first bit, second bit represents whether to have line feature rasterizing on this pixel, whether the 3rd bit has face key element rasterizing on this pixel, and the 4th bit is used for the abbreviation of space vector data.At first define several constants:
For example, as follows to the corresponding pixel operation method of space of lines entity:
The assign operation of pixel: with the constant line of definition with pixel value or operation pixel is carried out assignment, realize the rasterizing of luv space data.As give P (x, y) pixel line rasterizing operation, P (x, y)=P (x, y) line; Remove the operation of luv space data rasterizing, carry out after the negate with the removing with operation of pixel value with the constant line of definition, as remove P (x, y) the pixel line rasterizing is operated, P (x, y)=P (x, y) ﹠amp;~line.
Read pixel value: P (x, the value of raster data y) is exactly P (x, y) value of pixel;
Pixel value decision: for example, judge whether pixel is operated by the luv space data rasterizing, with constant line the judging with operation with pixel value of definition.As judge P (x, y) whether pixel by the wiregrating operation of formatting, then judge P (x, y); Whether the value of line greater than 0, if greater than 0, then P (x, y) pixel is by space of lines entity rasterizing, if equal 0, then (x, y) pixel is not by space of lines entity rasterizing for P.
Can operate according to the method described above equally for the corresponding pixel operation of other spatial entities.
After this step, can also comprise:
Step S14, judge whether to exist the spatial entities to be analyzed that is untreated, if then execution in step S15 if not, then finishes;
Step S15, judge whether there is unprocessed pixel in the described view window, if, then return step S11, if not, then finish.
In the decision method of the type of barrier of the disclosed spatial entities of present embodiment, the situation of the blocking when pixel that need draw when described view window shows by the analysis space entity is come the demonstration of analysis space entity on the actual view window that shows, the calculated amount of blocking calculating between the assurance spatial entities is little, algorithm is simply efficient, solve the problem of the complicated difficulty of real-time judge of magnanimity spatial entities type of barrier, improved the accuracy of judging efficient and result of determination.
The present invention discloses the decision method of the above-mentioned spatial entities type of barrier of a kind of foundation, the decision space entity is the method for useful space entity, the spatial entities of described useful space entity for being revealed after the pixel in the view window is drawn.Idiographic flow as shown in Figure 2, the present embodiment disclosed method is applied to server end, is example with the two dimension view pattern, comprising:
Step S21, from the spatial entities that the backward according to the spatial entities drawing order sorts, choose current spatial entities to be analyzed;
Step S22, according to predefined view control parameter, the original coordinates conversion of the spatial data of described current spatial entities to be analyzed is obtained the view coordinate of view window;
View in present embodiment control parameter is the view control parameter of view window of the actual displayed of client.
Step S23, judge whether the value of the pixel of required drafting when described spatial entities shows all is 1 in described view window, if, execution in step S24a then, if be 0 all, execution in step S24b then, if part is 1, execution in step S24c then;
Step S24a, determine that its type of barrier is for blocking fully;
Step S24b, determine that its type of barrier is not for being blocked;
Step S24c, determine that type of barrier is partial occlusion;
Step S25, judge whether its type of barrier meets default effective spatial entities condition, if, execution in step S26a then, if not, execution in step S26b then;
Default effective spatial entities condition in the present embodiment is that type of barrier is the spatial entities that is not blocked.
Step S26a, determine that described spatial entities is useful space entity, execution in step S27;
Step S26b, determine that described spatial entities is the idle space entity, execution in step S28;
Step S27, the pixel assignment that described useful space entity need be drawn when described view window shows are 1, draw in described pixel to indicate the entity that had living space.
When needs indicate described useful space entity when described pixel is drawn, the pixel assignment that described useful space entity need be able to be drawn when described view window shows is 1 equally, be used for this pixel of expression and be used for showing described useful space entity, will be used for showing that the pixel value of effective spatial entities is as differentiating the basis in the process that guarantees follow-up decision space entity type of barrier, if there is other spatial entities also will show in above-mentioned pixel, will be blocked, to guarantee the accuracy of decision process.Simultaneously, if spatial entities has graphic information, when analyzing and handle, to consider graphic information, be transparent or semitransparent as the graphic information of face entity, if this face entity is useful space entity, but all pixels that will draw of this face entity not carry out assignment be 1 operation.
Step S28, judge whether to exist the spatial entities to be analyzed that is untreated, if then execution in step S29 if not, then finishes;
Step S29, judge whether there is unprocessed pixel in the described view window, if, then return step S21, if not, then finish.
The method of the disclosed judgement useful space of present embodiment entity, spatial data to client-requested is anticipated, view control parameter according to the actual displayed of client, determine that the spatial entities that can effectively show is useful space entity in the view window of reality, it is follow-up can to increase the step that useful space entity is chosen and transmitted accordingly, when having guaranteed the harmless demonstration of data, reduce volume of transmitted data greatly, improved data transmission efficiency and display efficiency.
This method is applied to server end, the view control parameter of the view window that the mass data of the spatial entities of client-requested is shown according to client is handled, the type of barrier of analysis space entity on described view window, and then judge whether this type of barrier meets default useful space entity condition, thereby obtaining to can't harm the valid data that show in client transmits, and need not to be transmitted in the data that to see on the display interface of client, reduce volume of transmitted data, improved transfer efficiency.
The method of the disclosed judgement useful space of present embodiment entity does not limit its concrete application scenarios, it can be arranged on client equally, type of barrier to the magnanimity spatial entities data that show is judged, and according to the useful space entity condition of current setting, show to determine useful space entity, thereby guaranteed need not show the data that to see in the procedure for displaying, improved display efficiency, as be applied under this scene, can also comprise the step that the useful space entity of determining is shown in the above-mentioned steps.
Certainly, present embodiment does not limit above-mentioned two kinds of application scenarioss, can set up the use scene of this method according to the applicable cases of reality on their own, equally can be applied to the client and server end simultaneously yet.And after useful space entity is judged; can comprise equally the data of useful space entity are carried out subsequent treatment such as abbreviation, progressive transmission; enumerate no longer one by one at this; everyly utilize the above-mentioned scheme that the spatial entities type of barrier is judged to carry out the process that useful space entity is judged, all belong to the protection domain of present embodiment.
The present invention discloses a kind of decision maker of spatial entities type of barrier, its structure as shown in Figure 3, comprise: choose unit 31, coordinate transformation unit 32, type of barrier analytic unit 33, wherein, choosing unit 31 is used for choosing current spatial entities to be analyzed from the spatial entities to be analyzed that sorts according to default ordering rule; Coordinate transformation unit 32 is used for according to predefined view control parameter, the original coordinates conversion of the luv space data of described current spatial entities to be analyzed is obtained the view coordinate of view window; Type of barrier analytic unit 33 is used for analyzing described spatial entities in the type of barrier of described view window.
Wherein, the processing procedure of each unit is as described below:
Choose the unit and from the spatial entities to be analyzed that sorts according to default ordering rule, choose current spatial entities to be analyzed, if two-dimensional model, then default ordering rule sorts for the backward according to the spatial entities drawing order, if three dimensional pattern, then default ordering rule is chosen the spatial entities after the ordering according to the order of sequence for to sort from viewpoint order from the close-by examples to those far off according to spatial entities.Coordinate transformation unit is carried out coordinate transform with the original coordinates of the spatial data of the spatial entities chosen according to view control parameter, transform to the view coordinate that utilizes under the view window that data structure represents according to view control parameter, utilize the type of barrier of type of barrier analytic unit analysis space entity, detailed process comprises whether the value of judging described spatial entities pixel of required drafting in described view window all is 1, if be 1 all, then described type of barrier is for blocking fully; If be 0 all, then described type of barrier is not for being blocked; If part is 1, then described type of barrier is partial occlusion, thus the type of barrier of determining current analyzed spatial entities be block fully, partial occlusion or be not blocked.
After intact to the present space entity handles, judge whether this spatial entities is last spatial entities, if, then finish, if not, then judge and utilize in the view window that data structure represents, whether also have untreated pixel, if, then according to above-mentioned order, choose next spatial entities, handle, if there is not untreated pixel in the view window, then finish, up to whole spatial entities are handled, do not exist till the untreated pixel in the view window of perhaps utilizing data structure to represent.
Can also comprise effective spatial entities determining unit in this device, it has preestablished the condition of useful space entity, it can be the spatial entities that is not blocked, it also can be the spatial entities of partial occlusion, or both combinations, judge whether the type of barrier of spatial entities meets the condition of useful space entity, if meet, determine that then described spatial entities is useful space entity, the pixel assignment that also described useful space entity need be able to be drawn when described view window shows in the subsequent process is 1, draws in described pixel to indicate the entity that had living space.
The implementation of the decision maker of the disclosed spatial entities type of barrier of present embodiment is corresponding to the disclosed method embodiment flow process of the invention described above embodiment, be preferable device embodiment, its concrete implementation can not repeat them here referring to said method embodiment.
The decision maker of spatial entities type of barrier disclosed by the invention can be arranged in the computing machine, also can be arranged on mobile phone or other can use in the equipment of the present invention, or other smart machines.It both can be arranged on server end, before the data with client-requested send, at first the type of barrier of spatial entities is judged, also it can be arranged on client, before spatial entities being sent to actual view window, type of barrier to spatial entities is judged, perhaps is arranged on the server and client side simultaneously, selects to be handled jointly by which side or both sides according to actual conditions.
Each embodiment adopts the mode of going forward one by one to describe in this instructions, and what each embodiment stressed is and the difference of other embodiment that identical similar part is mutually referring to getting final product between each embodiment.For the disclosed device of embodiment, because it is corresponding with the embodiment disclosed method, so description is fairly simple, relevant part partly illustrates referring to method and gets final product.
The professional can also further recognize, unit and the algorithm steps of each example of describing in conjunction with embodiment disclosed herein, can realize with electronic hardware, computer software or the combination of the two, for the interchangeability of hardware and software clearly is described, composition and the step of each example described in general manner according to function in the above description.These functions still are that software mode is carried out with hardware actually, depend on application-specific and the design constraint of technical scheme.The professional and technical personnel can specifically should be used for using distinct methods to realize described function to each, but this realization should not thought and exceeds scope of the present invention.
The method of describing in conjunction with embodiment disclosed herein or the step of algorithm can directly use the software module of hardware, processor execution, and perhaps the combination of the two is implemented.Software module can place the storage medium of any other form known in random access memory (RAM), internal memory, ROM (read-only memory) (ROM), electrically programmable ROM, electrically erasable ROM, register, hard disk, moveable magnetic disc, CD-ROM or the technical field.
To the above-mentioned explanation of the disclosed embodiments, make this area professional and technical personnel can realize or use the present invention.Multiple modification to these embodiment will be apparent concerning those skilled in the art, and defined General Principle can realize under the situation that does not break away from the spirit or scope of the present invention in other embodiments herein.Therefore, the present invention will can not be restricted to these embodiment shown in this article, but will meet the wideest scope consistent with principle disclosed herein and features of novelty.