CN113658033A - GPU (graphics processing Unit) method for calculating point set in given area - Google Patents

GPU (graphics processing Unit) method for calculating point set in given area Download PDF

Info

Publication number
CN113658033A
CN113658033A CN202110963505.8A CN202110963505A CN113658033A CN 113658033 A CN113658033 A CN 113658033A CN 202110963505 A CN202110963505 A CN 202110963505A CN 113658033 A CN113658033 A CN 113658033A
Authority
CN
China
Prior art keywords
points
given area
point
polygon
values
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.)
Granted
Application number
CN202110963505.8A
Other languages
Chinese (zh)
Other versions
CN113658033B (en
Inventor
李辉
杨琪婷
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Xidian University
Original Assignee
Xidian University
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 Xidian University filed Critical Xidian University
Priority to CN202110963505.8A priority Critical patent/CN113658033B/en
Publication of CN113658033A publication Critical patent/CN113658033A/en
Application granted granted Critical
Publication of CN113658033B publication Critical patent/CN113658033B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T1/00General purpose image data processing
    • G06T1/20Processor architectures; Processor configuration, e.g. pipelining
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T15/003D [Three Dimensional] image rendering
    • G06T15/005General purpose rendering architectures

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Graphics (AREA)
  • Image Generation (AREA)

Abstract

The invention discloses a GPU method for calculating a point set in a given area, which comprises the following steps: 1) filtering out data points outside the given area, converting position coordinates of the remaining data points into screen space coordinates, expanding and batching the remaining data points to construct a mapping relation between the user points and ID values thereof, and triangularizing the given area to form a plurality of polygons; 2) calculating the aggregation result of the polygon intersection cells by utilizing an OpenGL graphic API (application program interface) to obtain the number of the expansion points in the given area; 3) the method has the advantages that the number of the extension points in the given area is converted into the ID value of the distinguishable point, the ID set of the target point is found by using a bitmap mapping technology, and the distinguishable property of each point in the point set in the given area is realized.

Description

GPU (graphics processing Unit) method for calculating point set in given area
Technical Field
The invention belongs to the technical field of computers, and relates to a GPU (graphics processing unit) method for calculating a point set in a given area.
Background
In computer graphics, computational geometry, geographic information systems, and other technologies, it is often necessary to determine the positional relationship between points and polygons. Many mobile applications generate large amounts of spatial data, such as social media applications, car pooling programs, and weather alerting programs. Computing a set of points within a given area is important for low latency and fast response times for these services and applications and programs.
The prior patent CN105869188A discloses a detection method and system for determining the orientation relation of a point to a polygon, wherein a test point is constructed as the origin of an XY rectangular coordinate system, the coordinate position of each vertex of the polygon is constructed accordingly, and whether the point is in any polygon is determined by determining whether each vertex of the polygon is on the same side of a coordinate axis and the number of times of intersection between a connecting line of two consecutive points satisfying different points on one side of a y axis and an X axis positive half axis. Obviously, such a determination is required once for each test point, and when the number of the tested points is extremely large, the consumed time is increased linearly. Meanwhile, since each vertex of the polygon also needs to be judged, when the polygon is complex and the data volume of the test point is large, the interactive time requirement cannot be met.
The prior patent CN106843633A discloses a method for determining whether a contact is inside an irregular polygon, which has the core idea of ray method, but combines ray method with contact determination. Starting from the test point, a ray is led out, and the number of the intersection points of the ray and all the edges of the irregular polygon is seen. If the number of the intersection points is an odd number, the test point is in the irregular polygon, and if the number of the intersection points is an even number, the test point is out of the irregular polygon. This method is simple to implement, but the time complexity is also related to the number of sides of the polygon and the number of test points. The method is only suitable for the situation of small data volume, and has no good expansibility in the current big data era.
The prior patent CN111915665A discloses a method for determining points in a polygon by using simplified intersection calculation on a computer, which utilizes the parallel processing capability of a GPU to improve the calculation efficiency. Firstly, an outer bounding box is established for any polygon, uniform grid division is carried out on the bounding box, and a strip-shaped structure parallel to a coordinate axis is generated in a grid unit to judge whether a segment divided by the cell is in/out of the polygon. And a ray is led out from the test point and is parallel to the coordinate axis parallel to the bar-shaped structure when the bar-shaped structure is generated. The number of times of intersection of the point with the polygon is counted by using the attribute statistics of the cell. Compared with the first two methods, the method has remarkable efficiency improvement, but when the polygon is complex, the cells of the method need to be divided into fine cells to ensure the accuracy. Meanwhile, if there are multiple polygons, each polygon needs to be subdivided and then determined.
In addition, in the current method for solving the problem of calculating the point set in the region, a convex hull is constructed for the data points, whether the convex hull is completely contained in the given polygonal region is judged, the vertexes of the convex hull which is not contained in the given region are deleted continuously, and the point set in the region is calculated when the convex hull is reconstructed until the vertexes of the convex hull and the contained points are all contained in the region. This method, although fast, is only suitable for convex polygons and is not suitable for small range lookups on large data point sets. There are also tree-structure-index-based lookups that are only applicable to rectangles. The above mentioned methods are all mathematical in nature and do not take into account the expansion of the visualization requirements.
In summary, the key point of calculating the point set in the region is to find a method which can quickly calculate the result on the premise of meeting the precision requirement and is suitable for the requirements of the modern big data era. With the dependence of people on electronic products, the application scenarios of the point sets in the query region are continuously widened, and a given calculation region may be composed of a plurality of complex polygons with different complex shapes. And with the widening of application population, the visualization requirement for the use of some non-technical personnel is further provided.
Disclosure of Invention
The present invention is directed to overcome the above drawbacks of the prior art, and provides a GPU method for calculating a point set in a given area, which has the characteristics of high precision and fast calculation speed.
In order to achieve the above object, the GPU method for calculating a set of points within a given region according to the present invention comprises the steps of:
1) filtering out data points outside the given area, converting position coordinates of the remaining data points into screen space coordinates, expanding and batching the remaining data points to construct a mapping relation between the user points and ID values thereof, and triangularizing the given area to form a plurality of polygons;
2) calculating the aggregation result of the polygon intersection cells by utilizing an OpenGL graphic API (application program interface) to obtain the number of the expansion points in the given area;
3) and converting the number of the extension points in the given area into the ID value of the distinguishable point, and finding the ID set of the target point by using a bitmap mapping technology to realize the distinguishability of each point in the point set in the given area.
Storing ID values by utilizing four channels [ R, G, B, A ] predefined by each pixel, wherein each channel can hold 32bit numerical values, and constructing the relation between the ID of the data points and the number of the expansion points by adopting a bitmap mapping technology.
Sending the preprocessed data points into a vertex renderer, and rendering each data point to a pixel block through rasterization to obtain space aggregation information of the point and a screen space;
and sending the data of the polygon into a vertex renderer, reading the red channel numerical values of pixel blocks rendered by the polygon, accumulating to obtain an aggregation result of the points and the polygon, and taking the aggregation result as the number of the extension points in the given area.
And calculating a mapping function by using the number of the rendering batch and the number of the extension points, restoring the ID value of the data point of the batch in the given area, and rendering for a plurality of times to obtain the ID values of all target points.
The invention has the following beneficial effects:
the GPU method for calculating the point set in the given area solves the problem of calculating the point set in the polygon by combining the GPU rendering technology and bitmap mapping during specific operation, is suitable for any arbitrary polygon, and compared with the other methods for calculating the point set in the area, the property of the polygon and the number of the polygons have little influence on time overhead, so the GPU method is suitable for calculating a plurality of complex polygons in large-scale data points.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, are included to provide a further understanding of the invention, and are incorporated in and constitute a part of this specification, illustrate exemplary embodiments of the invention and together with the description serve to explain the invention and not to limit the invention. In the drawings:
FIG. 1 is a frame diagram of the present invention;
FIG. 2 is a flow chart of module 2 of the present invention;
fig. 3 is a flowchart of the resolution of the point ID in the present invention.
Detailed Description
The present invention will be described in detail below with reference to the embodiments with reference to the attached drawings. It should be noted that the embodiments and features of the embodiments in the present application may be combined with each other without conflict.
The following detailed description is exemplary in nature and is intended to provide further details of the invention. Unless otherwise defined, all technical terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. The terminology used herein is for the purpose of describing particular embodiments only and is not intended to be limiting of exemplary embodiments according to the invention.
Referring to fig. 1, 2 and 3, the GPU method for calculating a set of points inside a given area according to the present invention comprises the following steps:
data preprocessing of data points
To avoid meaningless processing operations, the points that are not possible within the area range are filtered out, i.e. the points whose maximum longitude and latitude values are outside the maximum and minimum longitude and latitude of a given area, then the coordinates of the remaining points are converted into screen space coordinates, the remaining points are all possible to exist within the area, in order to keep ID information during the operation of the GPU rendering module, a bitmap mapping relationship of the point number of the data point and the ID value thereof is constructed, the values of the first few bits of the ID thereof are stored depending on the lot number, referring to FIG. 3, the first three columns of the first row, a point with an ID of 62, the last bit of 62/10 of 6 is omitted, the point is divided into lots with a number of 6, and since 62% of 10 of 2 is 2, the last bit of 2 is 2, the point is expanded to 4 (2)2) Since a rendering batch represents the module 2 and the module 3, and the sparsity of the data contained in each batch has a direct relationship with the time overhead, a process of renumbering points is added, and discontinuous data points are uniformly assigned with a continuous code ID to ensure that the points have the same position coordinatesThe space of each batch can be occupied, and the mapping of the whole ID is not carried out because the aggregation condition of points and the canvas is recorded by utilizing the color channel value of the pixel block, and the color channel can only store 32 bits of data at most, so that the [ R, G, B and A ] can be used up even if the [ R, G, B and A ] are used up]The capacity of four channels can store only a point having an ID value of 128(4 × 32) at maximum. Bitmap mapping is done because there may be multiple data points in a point set with the same or similar ID, resulting in them being rendered on the same pixel block, and therefore a method is needed to distinguish the set of ID values recorded with the color channel.
Data preprocessing of polygons
The given area can be composed of one or any number of arbitrary polygons, so that each polygon needs to be subjected to triangulation operation and spatial coordinate conversion, a poly2tri library commonly used in the field of games is selected, the polygons are triangulated, and vertices after triangulation are recorded, so that data preparation is provided for rendering of the polygons in the module 2.
GPU rendering
Firstly, a virtual screen with all pixel blocks with zero color channel value is created, the size of the pixel block is related to the resolution, the higher the resolution is, for the same size of the virtual screen, the more its pixel blocks are, the higher the approximation degree is when rendering polygons. High resolution brings high precision and increases time cost, so an epsilon-bound parameter is set, a user can adjust the balance between precision and time cost according to actual requirements, and the Hausdorff distance is used for evaluating the approximation degree of a polygon approximated by pixels and a real polygon in an actual given area. As long as the used pixel side length is set to
Figure BDA0003222963150000061
The value of this distance must be less than or equal to epsilon, and if i is a true polygon and i' is an approximate polygon, the Hausdorff distance dH(i, i') is represented by
Figure BDA0003222963150000062
Referring to fig. 2, data of extension points is inputted to a vertex shader, and is rasterized and rendered onto a specific pixel block according to its own position information. The invention uses red channel to record the aggregation condition, that is, when each point falls on a certain pixel block, the red channel value of the pixel block is added with 1; when the polygon is rasterized and rendered to certain specific pixel blocks, the values of the red channels of the pixel blocks to which the polygon belongs are accumulated to obtain the number of the point expansion points in the polygon. In addition, the values of the color channels are controlled by means of a blending function using OpenGL custom vertex shaders and fragment shaders to implement the rendering work described above.
Mapping of points to ID values
And restoring the ID recorded by each pixel block color channel in the specified area by virtue of the batch number and the number of the extension points, solving the ID, namely converting the number of the extension points into a binary system, and finding all positions where 1 is located. And then, the product of the batch number and the lot number is multiplied by ten, and the product is added to obtain a group of ID values, referring to fig. 3, assuming that there are four data points with IDs of 62, 170, 171, and 175, and the four data points are respectively subjected to batch operation, that is, the division operation is performed on the four data points by 10, 6 is 62/10, 17 is 170/10 is 171/10 is 175/10, so the four data points are divided into two batches of numbers 6 and 7, when the point with the number of 6 is rendered, an aggregation result 4 is obtained after passing through a module 2, that is, the color channel value of the corresponding pixel with the coordinate of (x1, y1) is 4, the division operation is performed on the 4 by 2 and the module 2 continuously, and the position where the pixel is located after the pixel is converted into the binary system is found, as shown in the fourth column of the first row in fig. 2, and the position is the second position. There is therefore only one ID on the tile, this ID being 62(6 x 10+ 2). The above-mentioned steps are repeated, the ID value of the point set in the given area can be found by continuously rendering and identifying the ID, because the maximum position of 1 in the identification aggregation result is 31, the time for identifying all the positions of 1 is not too long, and the rendering speed is very fast because the rendering is carried out on the GPU, so that the response time can be ensured even though a plurality of batches of rendering and identification ID values are required to operate.
Finally, it should be noted that: the above embodiments are only for illustrating the technical solutions of the present invention and not for limiting the same, and although the present invention is described in detail with reference to the above embodiments, those of ordinary skill in the art should understand that: modifications and equivalents may be made to the embodiments of the invention without departing from the spirit and scope of the invention, which is to be covered by the claims.

Claims (4)

1. A GPU method for computing a set of points within a given region, comprising the steps of:
1) filtering out data points outside the given area, converting position coordinates of the remaining data points into screen space coordinates, expanding and batching the remaining data points to construct a mapping relation between the user points and ID values thereof, and triangularizing the given area to form a plurality of polygons;
2) calculating the aggregation result of the polygon intersection cells by utilizing an OpenGL graphic API (application program interface) to obtain the number of the expansion points in the given area;
3) and converting the number of the extension points in the given area into the ID value of the distinguishable point, and finding the ID set of the target point by using a bitmap mapping technology to realize the distinguishability of each point in the point set in the given area.
2. A GPU method for calculating a set of points inside a given area according to claim 1, characterised in that the ID values are stored using four channels [ R, G, B, a ] predefined per pixel, each capable of accommodating 32bit values, the relationship between the data point ID and the number of extension points being constructed using bitmap mapping techniques.
3. The GPU method for calculating a point set within a given region according to claim 1, wherein preprocessed data points are sent to a vertex renderer, and each data point is rendered to a pixel block through rasterization to obtain spatial aggregation information of the points and a screen space;
and sending the data of the polygon into a vertex renderer, reading the red channel numerical values of pixel blocks rendered by the polygon, accumulating to obtain an aggregation result of the points and the polygon, and taking the aggregation result as the number of the extension points in the given area.
4. The GPU method for calculating a point set inside a given area according to claim 1, wherein a mapping function is calculated by using the number of rendering batches and the number of extension points, the ID values of the data points inside the given area of the batch are restored, and the ID values of all target points are obtained after rendering for a plurality of times.
CN202110963505.8A 2021-08-20 2021-08-20 GPU method for calculating internal point set of given region Active CN113658033B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110963505.8A CN113658033B (en) 2021-08-20 2021-08-20 GPU method for calculating internal point set of given region

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110963505.8A CN113658033B (en) 2021-08-20 2021-08-20 GPU method for calculating internal point set of given region

Publications (2)

Publication Number Publication Date
CN113658033A true CN113658033A (en) 2021-11-16
CN113658033B CN113658033B (en) 2023-08-18

Family

ID=78491859

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110963505.8A Active CN113658033B (en) 2021-08-20 2021-08-20 GPU method for calculating internal point set of given region

Country Status (1)

Country Link
CN (1) CN113658033B (en)

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20060256112A1 (en) * 2005-05-10 2006-11-16 Sony Computer Entertainment Inc. Statistical rendering acceleration
US20150287158A1 (en) * 2014-04-05 2015-10-08 Sony Computer Entertainment America Llc Method for efficient re-rendering objects to vary viewports and under varying rendering and rasterization parameters
CN106530208A (en) * 2016-11-22 2017-03-22 中国人民解放军理工大学 GPU-based method for calculating random polygon intersection area

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20060256112A1 (en) * 2005-05-10 2006-11-16 Sony Computer Entertainment Inc. Statistical rendering acceleration
US20150287158A1 (en) * 2014-04-05 2015-10-08 Sony Computer Entertainment America Llc Method for efficient re-rendering objects to vary viewports and under varying rendering and rasterization parameters
CN106530208A (en) * 2016-11-22 2017-03-22 中国人民解放军理工大学 GPU-based method for calculating random polygon intersection area

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
钱归平;童若锋;: "实时网格编辑的扩展中值坐标方法", 计算机辅助设计与图形学学报, no. 10 *

Also Published As

Publication number Publication date
CN113658033B (en) 2023-08-18

Similar Documents

Publication Publication Date Title
CN110990516B (en) Map data processing method, device and server
US11875513B2 (en) Self-adaptive point cloud stripe division method
CN111369657B (en) Three-dimensional thermodynamic diagram generation method and device, computer equipment and storage medium
US7652677B2 (en) Graphics system employing pixel mask
CN110633262B (en) Spark-based map intersection area calculation method and system
CN102722885B (en) Method for accelerating three-dimensional graphic display
CN109636893B (en) Analysis and rendering method of three-dimensional OBJ model and MTL material in iPhone
CN110990612A (en) Method and terminal for rapidly displaying vector big data
US9576381B2 (en) Method and device for simplifying space data
CN116628123B (en) Dynamic slice generation method and system based on spatial database
Masood et al. High‐performance virtual globe GPU terrain rendering using game engine
CN113658033A (en) GPU (graphics processing Unit) method for calculating point set in given area
CN116363324A (en) Two-dimensional and three-dimensional integrated rendering method for situation map
CN115858659A (en) Vector track display method and device, computer equipment and storage medium
CN110619675B (en) OsgEarth-based surface vector data loading method
Masood et al. A novel method for adaptive terrain rendering using memory-efficient tessellation codes for virtual globes
CN112730743A (en) Interaction method and device for air quality mode forecast data
CN117557711B (en) Method, device, computer equipment and storage medium for determining visual field
Qiu et al. An effective visualization method for large-scale terrain dataset
CN106033451B (en) A kind of instant rendering method of the density map of cellular traffic and device
CN117830587B (en) Map annotation drawing method and device, computer equipment and storage medium
CN117744187B (en) CAD drawing method, device, computer equipment and storage medium
CN116310226B (en) Three-dimensional object hierarchical model generation method, device, equipment and storage medium
CN117237503B (en) Geographic element data accelerated rendering and device
CN117744186B (en) CAD rasterization method, CAD rasterization device, computer equipment and storage medium

Legal Events

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