Calculation method of two-dimensional measuring line intersection point and related product
By pre-processing and rastering the two-dimensional line measurement data, combined with GPGPU parallel calculation, only intersection calculations are performed on the potential intersection area, solving the problem of inefficient computing efficiency in the existing technology and achieving efficient and accurate two-dimensional line measurement Intersection point calculation.
Patent Information
- Application Number
- CN202411184780.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-27
- Publication Date
- 2024-12-03
AI Technical Summary
The existing two-dimensional line intersection calculation methods have low calculation efficiency, especially when the number of line measurements and line segments increase, a large number of invalid calculations are required, resulting in high time complexity.
By obtaining two-dimensional line measurement data for preprocessing and rasterization, the preset line segment interception algorithm and frame buffer object are used to calculate intersection points, and only the potential intersection areas are calculated, combined with GPGPU parallel calculations, reducing the calculation complexity.
It significantly improves the efficiency of the intersection point calculation of two-dimensional measuring lines, avoids invalid calculations, can efficiently process massive data, accurately identify intersection points, and optimizes memory usage, improving the efficiency and accuracy of earthquake interpretation.
Smart Images

Figure CN119065004A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of seismic exploration, and in particular to a method for calculating intersection points of two-dimensional survey lines and related products. Background Art
[0002] The essence of line intersection is to find the intersection of the line segments in any two lines. The existing technology generally adopts the method of finding the intersection line segment by line segment. The core idea of this method is that for each line segment in any line, an intersection judgment is made with each line segment in all other lines. This method ensures that no possible intersection points are missed because it checks all possible combinations of line segment pairs. However, the significant disadvantage of this method is its low computational efficiency. As the number of lines and the number of line segments in each line increases, the number of intersection judgments required will increase dramatically, presenting a time complexity of O(n2), where n is the total number of line segments.
[0003] This technology currently lacks effective prediction of the positional relationship between line segments, resulting in its failure to perform intersection calculations only for line segments with potential intersections. When using this algorithm to calculate the intersection of a two-dimensional work area, if there is only one intersection or no intersection in actual situation, then the intersection calculations of all line segments except the intersecting line segments are invalid calculations. This indiscriminate processing method not only increases the amount of calculations, but also greatly reduces the efficiency of intersection calculations. Summary of the invention
[0004] In view of the above problems, the present invention proposes a method for calculating intersection points of two-dimensional survey lines and related products that overcome the above problems or at least partially solve the above problems.
[0005] An object of the present invention is to improve the efficiency of two-dimensional line intersection calculation.
[0006] A further object of the present invention is to avoid the occurrence of invalid calculations.
[0007] In particular, the present invention provides a method for calculating the intersection of two-dimensional survey lines, comprising:
[0008] Acquire two-dimensional survey line data and perform preprocessing to obtain a survey line tuple set;
[0009] Perform rasterization processing on the survey line tuple set to obtain survey line information;
[0010] The intersection points of the two-dimensional survey lines are obtained by calculating the survey line information through a preset line segment intersection algorithm.
[0011] Optionally, the line tuple set includes vertex coordinates, line indices, and line segment indices;
[0012] The pre-processing steps include:
[0013] Determine the two-dimensional coordinates corresponding to each vertex of the two-dimensional survey line as vertex coordinates according to the two-dimensional survey line data;
[0014] Assign a line index to the line where the vertex is located and a line segment index corresponding to the line segment where the vertex is located;
[0015] Combine vertex coordinates, line indices, and segment indices into a set of line tuples.
[0016] Optionally, before the step of rasterizing the survey line tuple set, the step further includes: passing the survey line tuple set to a vertex shader to obtain information to be processed;
[0017] The step of rasterizing the line tuple set includes: the vertex shader transmits the information to be processed to the fragment shader for rasterization processing.
[0018] Optionally, the step of performing rasterization processing includes:
[0019] Create a frame buffer object to be updated, and initialize the line information of all pixels in the frame buffer object to be updated;
[0020] Traverse all the survey lines one by one, and draw one survey line each time as the target survey line during the traversal process;
[0021] Compare the target frame buffer object where the target measurement line is located with the frame buffer object to be updated according to the information to be processed, so as to update the frame buffer object to be updated;
[0022] After the updated frame buffer object is updated, the updated frame buffer object is obtained, but there are still unrecorded measurement lines in the pixel, a new frame buffer object is added to record the unrecorded measurement lines until all measurement lines are recorded in the corresponding updated frame buffer object.
[0023] Optionally, the information to be processed includes texture coordinates of the survey line and survey line information;
[0024] The step of comparing the target frame buffer object where the target measurement line is located with the frame buffer object to be updated according to the information to be processed to update the frame buffer object to be updated includes:
[0025] Obtain the first channel value and the second channel value of the frame buffer object to be updated in the current pixel through the texture coordinates, each pixel in the frame buffer object stores four floating point values, and each floating point value corresponds to a channel value;
[0026] Determine whether the first channel value and the second channel value are initial values;
[0027] If it is an initial value, the first target channel value and the second target channel value of the target frame buffer object in the current pixel are recorded to the first channel value and the second channel value;
[0028] If it is not the initial value, determining whether the first channel value and the second channel value are the same as the first target channel value and the second target channel value respectively;
[0029] When the first channel value and the second channel value are different from the first target channel value and the second target channel value, the first target channel value and the second target channel value are used to overwrite the third channel value and the fourth channel value of the frame buffer object to be updated in the current pixel.
[0030] Optionally, the step of adding a frame buffer object to be updated and recording a measurement line that has not been recorded includes:
[0031] Traverse all the survey lines one by one. During the traversal process, only one survey line is drawn as the target survey line each time;
[0032] Obtain the first channel value and the second channel value of the updated frame buffer object and the frame buffer object to be updated in the current pixel through the texture coordinates;
[0033] Determine whether the first channel value and the second channel value of the updated frame buffer object are initial values;
[0034] In the case where the first channel value and the second channel value of the updated frame buffer object are not initial values, determining whether the first target channel value and the second target channel value of the target frame buffer object where the target measurement line is located in the current pixel are recorded in the updated frame buffer object;
[0035] If no record exists, the first target channel value and the second target channel value are recorded in the frame buffer object to be updated.
[0036] Optionally, the step of calculating the survey line information by using a preset line segment intersection algorithm to obtain the intersection point of the two-dimensional survey line includes:
[0037] Generate a first texture and a second texture corresponding to the two-dimensional survey line according to the survey line tuple set, the first texture is used to store the survey line index corresponding to the two-dimensional survey line and the starting point index corresponding to the starting point of the two-dimensional survey line, and the second texture is used to store the two-dimensional point coordinates of all the survey lines;
[0038] Acquire the two-dimensional point coordinates corresponding to all line segments in each pixel according to the first texture, the second texture and the measured line information;
[0039] When the number of line segments in a pixel exceeds a preset number, all possible line segment pairs in the pixel are obtained by permutation and combination;
[0040] The positional relationship of the line segment pairs is calculated and recorded through a preset line segment intersection algorithm to obtain the intersection point of the two-dimensional survey line.
[0041] Optionally, the step of calculating and recording the positional relationship of the line segment pairs by using a preset line segment intersection algorithm includes:
[0042] Determine whether the outer bounding boxes of two target line segments in the line segment pair intersect;
[0043] When the bounding boxes of two target line segments intersect, the cross product of the two target line segments is calculated;
[0044] When the cross product is not zero, the coordinates of the intersection point are solved using the preset line segment parameter equation;
[0045] Determine whether the intersection coordinates are inside the two target line segments;
[0046] When the coordinates of the intersection point are located inside the two target line segments, it is determined that the two target line segments intersect.
[0047] Optionally, after the step of calculating the survey line information by using a preset line segment intersection algorithm to obtain the intersection point of the two-dimensional survey line, the step further includes:
[0048] The intersection points of the two-dimensional survey lines are deduplicated using a preset deduplication algorithm.
[0049] According to another aspect of the present invention, a computer program product is provided, which includes a computer program. When the computer program is executed by a processor, the steps of any one of the above-mentioned methods for calculating intersection points of two-dimensional survey lines are implemented.
[0050] The method for calculating the intersection of two-dimensional survey lines of the present invention first obtains two-dimensional survey line data and performs preprocessing to obtain a survey line tuple set; performs rasterization processing on the survey line tuple set to obtain survey line information; and calculates the survey line information through a preset line segment intersection algorithm to obtain the intersection of the two-dimensional survey line. Through this method, a large amount of data points can be efficiently processed, and the intersection between any two survey lines can be accurately identified to avoid the occurrence of invalid calculations. And while maintaining high efficiency, it can also take into account the optimization of memory usage to quickly and accurately calculate all survey line intersections in the current two-dimensional work area, thereby improving the efficiency and accuracy of seismic interpretation.
[0051] Furthermore, the method for calculating the intersection of two-dimensional survey lines of the present invention, after calculating the intersection of two-dimensional survey lines by using a preset line segment intersection algorithm, will also perform deduplication processing on the intersection of two-dimensional survey lines by using a preset deduplication algorithm, thereby avoiding the situation in which the same intersection is calculated by multiple processing units simultaneously or independently during large-scale parallel computing, resulting in duplicate records.
[0052] Furthermore, the method for calculating the intersection of two-dimensional survey lines of the present invention, after pre-processing to obtain a survey line tuple set, passes the survey line tuple set to the vertex shader to obtain information to be processed; the vertex shader passes the information to be processed to the fragment shader for rasterization processing. This method maps the two-dimensional survey line information to the grid system, and uses the frame buffer object to efficiently record and retrieve the survey line segment index in the grid unit. This method effectively avoids the tedious intersection judgment of each line segment pair in the traditional method, and through intelligent screening of the intersection candidate area, only the intersection calculation is performed on the potential intersection area, thereby greatly reducing the calculation complexity and further improving the calculation efficiency.
[0053] Based on the following detailed description of specific embodiments of the present invention in conjunction with the accompanying drawings, those skilled in the art will become more aware of the above and other objects, advantages and features of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS
[0054] Hereinafter, some specific embodiments of the present invention will be described in detail in an exemplary and non-limiting manner with reference to the accompanying drawings. The same reference numerals in the accompanying drawings indicate the same or similar components or parts. It should be understood by those skilled in the art that these drawings are not necessarily drawn to scale. In the accompanying drawings:
[0055] Figure 1 is a schematic flow chart of a method for calculating intersection points of two-dimensional survey lines according to an embodiment of the present invention;
[0056] Figure 2 is a schematic diagram of a survey line tuple set in a method for calculating intersection points of two-dimensional survey lines according to an embodiment of the present invention;
[0057] Figure 3 is a schematic diagram of the process of FBO1 rasterization processing in a method for calculating intersection points of two-dimensional survey lines according to an embodiment of the present invention;
[0058] Figure 4 A schematic diagram of FBO1 rasterization processing in a method for calculating intersection points of two-dimensional survey lines according to an embodiment of the present invention is shown;
[0059] Figure 5 is a schematic diagram of the process of FBO2 rasterization processing in a method for calculating intersection points of two-dimensional survey lines according to an embodiment of the present invention;
[0060] Figure 6 A schematic diagram of a process of rasterization processing using two FBOs in a method for calculating intersection points of two-dimensional survey lines according to an embodiment of the present invention is shown;
[0061] Figure 7 is a pseudo code schematic diagram of an algorithm for calculating intersection points of two line segments according to a method for calculating intersection points of two-dimensional survey lines according to an embodiment of the present invention;
[0062] Figure 8 is a schematic diagram of a texture management strategy of a method for calculating intersection points of two-dimensional survey lines according to an embodiment of the present invention;
[0063] Fig. 9 It is a schematic diagram of a hash map storage structure in a deduplication algorithm of a method for calculating intersection points of two-dimensional survey lines according to an embodiment of the present invention;
[0064] Fig.10 is a schematic diagram of a computer program product according to an embodiment of the present invention;
[0065] Fig.11 is a schematic diagram of a computer-readable storage medium according to an embodiment of the present invention; and
[0066] Fig.12 is a schematic diagram of a computer device according to an embodiment of the present invention. DETAILED DESCRIPTION
[0067] It should be understood by those skilled in the art that the embodiments described below are only some embodiments of the present invention, rather than all embodiments of the present invention, and these embodiments are intended to explain the technical principles of the present invention, rather than to limit the protection scope of the present invention. Based on the embodiments provided by the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should still fall within the protection scope of the present invention.
[0068] It should be noted that the logic and / or steps represented in the flowchart or described in other ways herein, for example, can be considered as a sequenced list of executable instructions for implementing logical functions, and can be specifically implemented in any computer-readable medium for use by an instruction execution system, device or equipment (such as a computer-based system, a system including a processor, or other system that can fetch instructions from an instruction execution system, device or equipment and execute instructions), or used in combination with these instruction execution systems, devices or equipment.
[0069] At present, seismic work areas can be divided into three-dimensional work areas and two-dimensional work areas according to the measurement and processing methods. The two-dimensional work area is composed of multiple two-dimensional survey lines. The projection of the measurement information of a two-dimensional survey line in the geodetic coordinates can be abstracted as a broken line defined by multiple control points (nodes). The control points are called inflection points of the survey line, and each inflection point is defined by the geodetic coordinate system X and Y. In actual production, a two-dimensional work area may include thousands of survey lines, and each survey line has two to hundreds of inflection points.
[0070] When conducting seismic interpretation in a two-dimensional work area, a continuous profile is often created along multiple two-dimensional survey lines to observe the backbone structure of the work area or to study the local geological body morphology. At this time, the connection between the multiple survey lines spanned by this continuous profile trajectory is the intersection of the survey lines. In this process, it is particularly important to determine the intersections between these survey lines, because they are the key to connecting different survey lines to form a continuous profile. Therefore, developing an algorithm that can quickly and accurately calculate the intersections of all survey lines in the current two-dimensional work area is of immeasurable value for improving the efficiency and accuracy of seismic interpretation. The algorithm needs to be able to efficiently process a large number of data points, accurately identify the intersections between any two survey lines, and while maintaining high efficiency, take into account the optimization of memory usage to ensure stable operation in the actual production environment.
[0071] To achieve the above objectives, the present invention proposes an efficient two-dimensional line intersection algorithm to solve the problem that the traditional two-dimensional line intersection method is inefficient due to too many invalid calculations when processing large-scale line data sets. The algorithm introduces a grid mapping strategy to organize all line information into a grid system, and performs intersection calculations only on grid cells containing at least two line information through collision detection, thereby significantly reducing invalid calculations of intersections and greatly improving calculation efficiency.
[0072] In view of the inherent high parallel nature of the collision detection task, the present invention adopts an efficient strategy: that is, decomposing the collision detection task into multiple subtasks that can be processed independently in parallel, and accelerating them by utilizing the parallel computing capabilities of general-purpose graphics processing units (GPGPU). As an advanced computing platform, GPGPU's powerful parallel processing units (stream processors) can process large amounts of data simultaneously, thus showing significant computing advantages when processing large-scale two-dimensional survey line data sets. Compared with traditional CPU (central processing unit) computing, GPGPU stands out for its powerful parallel computing capabilities and high portability, especially when processing large-scale data sets. In addition, although CUDA (Compute Unified Device Architecture) is also a powerful GPU programming model, GPGPU is more suitable for the application scenarios of the present invention due to its higher programming ease and wide hardware compatibility.
[0073] Therefore, the present invention realizes efficient and accurate calculation of intersection points of two-dimensional survey lines by combining grid survey line information management, collision detection technology and GPGPU parallel computing, providing strong technical support for research and application in related fields.
[0074] Figure 1It is a schematic flowchart of a method for calculating the intersection points of two-dimensional survey lines according to an embodiment of the present invention. As Figure 1 shown, the method for calculating the intersection points of two-dimensional survey lines at least includes the following steps S101 to S103.
[0075] Step S101: Obtain two-dimensional survey line data and perform preprocessing to obtain a set of survey line tuples. In some optional embodiments, the two-dimensional survey line data refers to a polyline formed by sequentially connecting a set of points in a two-dimensional space and having the characteristics of a linear manifold, that is, there is no break and no self-intersection in the middle. Generally, it can be formally expressed as SurveyLine = {P1, P2, P3,..., Pn}, where P i =(x i , y i ) represents the i-th point on the polyline, and 2 ≤ i ≤ n. Two consecutive points P i and P i +1 (1 ≤ i < n) in SurveyLine (survey line) form a line segment, denoted as LineSegment (line segment). The intersection point of the survey lines is the unique and non-empty intersection point formed by any two non-coincident line segments between any two different SurveyLines, that is, these two line segments exactly intersect at a point in the two-dimensional space, and the intersection point is not generated due to complete or partial overlap of the line segments.
[0076] Based on this assumption, the survey line data can be preprocessed. In this process, each vertex on the survey line is assigned its corresponding two-dimensional coordinates (x, y), and at the same time, a survey line index (lineId) and a corresponding line segment index (segId) are assigned to form a set of tuples of (x, y, lineId, segId). Next, these sets of tuples will be passed to the Vertex Shader, for example Figure 2 shown. Figure 2 It is a schematic diagram of a set of survey line tuples in the method for calculating the intersection points of two-dimensional survey lines according to an embodiment of the present invention. As can be seen from Figure 2 , after the two-dimensional survey line data is preprocessed, a set of survey line tuples is obtained and then sent to the Vertex Shader. Among them, the set of survey line tuples includes vertex coordinates, survey line indices, and line segment indices. Then the Vertex Shader will pass this information to the Fragment Shader for rasterization of the survey line information.
[0077] In some optional embodiments, the steps of preprocessing generally may include: determining the two-dimensional coordinates corresponding to each vertex of the two-dimensional survey line as vertex coordinates according to the two-dimensional survey line data; assigning a survey line index to the survey line where the vertex is located and a line segment index corresponding to the line segment where the vertex is located; combining the vertex coordinates, survey line indices, and line segment indices as a set of survey line tuples.
[0078] Step S102, rasterizing the survey line tuple set to obtain survey line information. Rasterizing generally refers to the process of converting a graphic object from a vector representation to a pixel representation.
[0079] In some optional embodiments, before the step of rasterizing the line tuple set, the following steps may be generally performed: passing the line tuple set to the vertex shader to obtain information to be processed. The step of rasterizing the line tuple set may generally include: the vertex shader passing the information to be processed to the fragment shader for rasterization. Figure 2 For example, it can be seen that after the line tuple set is sent to the vertex shader, the vertex shader will process or split it to obtain the vertex position, line information, and texture coordinates to be processed. The vertex shader will then send this information to the fragment shader for rasterization. The line information in the vertex shader is only the line information of a single line, while the line information obtained after the fragment shader performs rasterization is the line information of multiple lines in the same pixel. The line information of multiple lines in the same pixel can be used to perform intersection calculations on the current pixel, thereby obtaining the intersection points between different lines.
[0080] Step S103, the line information is calculated by a preset line segment intersection algorithm to obtain the intersection of the two-dimensional line. The core of the line intersection is to accurately find all the line segments that may intersect between any two lines to determine whether they have intersections. This process relies on the line information obtained by the rasterization process in step S102, through which the line segments that may have intersections in each pixel can be efficiently located. Then, the parallel processing capability of the GPU is used to execute a fast intersection algorithm on the two line segments, thereby improving the efficiency of the entire intersection process.
[0081] The present invention combines the programming advantages of CPU and GPU. In the algorithm implementation, the CPU is mainly responsible for reading, preprocessing and task scheduling of survey line data; while the GPU uses its powerful parallel computing capabilities to focus on performing efficient intersection calculation tasks. The collaborative work of CPU and GPU not only improves the overall performance of the algorithm, but also enhances the scalability and flexibility of the system, making it able to adapt to two-dimensional survey line data sets of different sizes and complexities.
[0082] This method can efficiently process a large number of data points, accurately identify the intersections between any two survey lines, and avoid invalid calculations. It can also optimize memory usage while maintaining high efficiency to quickly and accurately calculate all survey line intersections in the current two-dimensional work area, thereby improving the efficiency and accuracy of seismic interpretation.
[0083] In some optional embodiments, the steps of performing rasterization processing may generally include: creating a frame buffer object to be updated, and initializing the line information of all pixels in the frame buffer object to be updated; traversing all the lines one by one, and drawing one line as the target line at a time during the traversal process; comparing the target frame buffer object where the target line is located with the frame buffer object to be updated according to the information to be processed, so as to update the frame buffer object to be updated; after the frame buffer object to be updated is updated, an updated frame buffer object is obtained, but there are still lines that have not been recorded in the pixel, adding a frame buffer object to be updated, and recording the lines that have not been recorded until all the lines are recorded in the corresponding updated frame buffer object. Frame Buffer Object (FBO) is a technology in computer graphics, which allows developers to output rendering results to one or more specified buffers. In addition, in the fragment shader program, the line information (lineId, segId) passed by the vertex shader needs to be accurately mapped and recorded to each pixel of the rendering output, and this process is achieved through the frame buffer object (FBO). Due to the pixel format limitation of the frame buffer, each pixel can usually only store four floating point values (R, G, B, A). In order to effectively record the measurement line information, the present invention uses the R and G channels to store the lineId and segId of the first measurement line, while the B and A channels are used to store the lineId and segId of the second measurement line. This design allows each pixel to record at most two measurement line information, namely (lineId1, segId1, lineId2, segId2), maximizing the storage capacity of the pixel. However, when the number of measurement lines covered by the pixel area exceeds two, it is necessary to flexibly increase the number of FBOs to record more measurement line information.
[0084] Optionally, the information to be processed generally includes texture coordinates of the survey line and survey line information. The step of comparing the target frame buffer object where the target survey line is located with the frame buffer object to be updated according to the information to be processed to update the frame buffer object to be updated generally may include: obtaining the first channel value and the second channel value of the frame buffer object to be updated in the current pixel through the texture coordinates, each pixel in the frame buffer object stores four floating-point values, and each floating-point value corresponds to a channel value; judging whether the first channel value and the second channel value are initial values; if they are initial values, recording the first target channel value and the second target channel value of the target frame buffer object in the current pixel to the first channel value and the second channel value; if they are not initial values, judging whether the first channel value and the second channel value are the same as the first target channel value and the second target channel value; when the first channel value and the second channel value are different from the first target channel value and the second target channel value, using the first target channel value and the second target channel value to overwrite the third channel value and the fourth channel value of the frame buffer object to be updated in the current pixel.
[0085] The floating-point values are the four floating-point values (R, G, B, A) stored in each pixel, and RGBA correspond to the first to fourth channels respectively. Generally, the two channels RG are used to record the measurement line information of the first measurement line, and the two channels BA are used to record the measurement line information of another measurement line in the current pixel. After recording, a frame buffer object can be used to determine the measurement line information of the two measurement lines that exist simultaneously in the corresponding pixel, so as to facilitate the subsequent intersection of the measurement lines.
[0086] In addition, an optional example of the initial value is zero. In the process of traversing the measurement line, a corresponding target frame buffer object (hereinafter referred to as FBO) will be created for each measurement line, so the first two target channels of the target frame buffer object will record the measurement line information of the current measurement line. Therefore, when the first channel value and the second channel value of the frame buffer object to be updated are zero, it means that the current frame buffer object to be updated (hereinafter referred to as FBO1) has not recorded the measurement line information, so the R and G components of the frame buffer object to be updated can be used to record the R and G corresponding to the current measurement line. When the first channel value and the second channel value of the frame buffer object to be updated are not zero, it means that the frame buffer object to be updated has recorded a measurement line in the current pixel, so it is necessary to first determine whether the measurement line already recorded by the frame buffer object to be updated is the same measurement line as the measurement line corresponding to the target frame buffer object. If so, continue to traverse the next measurement line. If not, use the first target channel value and the second target channel value corresponding to the current measurement line to overwrite the third channel value and the fourth channel value of the frame buffer object to be updated in the current pixel.
[0087] Through the above method, after completing the traversal of the survey lines, each time a survey line is drawn, the FBO corresponding to the survey line will be drawn and superimposed and updated with the latest FBO1 to reflect the survey line information of the latest FBO1 in real time. However, once the number of survey lines in the current pixel exceeds two, the redundant survey lines will overwrite the survey line information of the previous survey lines in the B channel and the A channel. Therefore, it is necessary to continue to create a new frame buffer object to be updated to record the survey line information corresponding to the survey lines that have not been recorded due to being covered. Optionally, the step of adding a frame buffer object to be updated and recording the measurement lines that have not been recorded can generally include: traversing all the measurement lines one by one, and in the traversal process, only drawing one measurement line at a time as the target measurement line; obtaining the first channel value and the second channel value of the updated frame buffer object and the frame buffer object to be updated in the current pixel through texture coordinates; judging whether the first channel value and the second channel value of the updated frame buffer object are initial values; if the first channel value and the second channel value of the updated frame buffer object are not initial values, judging whether the first target channel value and the second target channel value of the target frame buffer object where the target measurement line is located in the current pixel have records in the updated frame buffer object; if there are no records, recording the first target channel value and the second target channel value in the frame buffer object to be updated. When a new frame buffer object to be updated is created, it is necessary to first judge whether each traversed measurement line exists in the previously updated frame buffer object. If it does not exist, it means that the measurement line of the current pixel belongs to the covered measurement line, so it is recorded in the newly created frame buffer object to be updated, and the recording method is consistent with the previous recording method. By continuously traversing and recording in this way, all the measurement lines can be recorded in pairs into the frame buffer object, so as to facilitate the subsequent intersection calculation.
[0088] In some optional embodiments, the step of calculating the survey line information through a preset line segment intersection algorithm to obtain the intersection of the two-dimensional survey line can generally include: generating a first texture and a second texture corresponding to the two-dimensional survey line according to the survey line tuple set, the first texture being used to store the survey line index corresponding to the two-dimensional survey line and the starting point index corresponding to the starting point of the two-dimensional survey line, and the second texture being used to store the two-dimensional point coordinates of all survey lines; obtaining the two-dimensional point coordinates corresponding to all line segments in each pixel according to the first texture, the second texture and the survey line information; when the number of line segments in a pixel exceeds a preset number, arranging and combining to obtain all possible line segment pairs in the pixel; calculating and recording the positional relationship of the line segment pairs through a preset line segment intersection algorithm, thereby obtaining the intersection of the two-dimensional survey line.
[0089] In the GPU-accelerated line segment intersection algorithm, data is transmitted through textures, and the extraction of texture elements is one of the most time-consuming operations in the GPU. Therefore, an efficient texture management strategy can significantly improve the performance of the line segment intersection algorithm. An optional texture management strategy is Figure 8 As shown, Figure 8FIG. 1 is a schematic diagram of a texture management strategy for a method for calculating intersection points of two-dimensional survey lines according to an embodiment of the present invention. Figure 8 It can be seen that in the process of finding the intersection of line segments, the data is mainly stored in two two-dimensional textures: texture 1 and texture 2. Texture 1 stores the index of each line and its corresponding starting point index; texture 2 stores the two-dimensional point coordinates of all lines, and these points are arranged in the order of the lines. Similar to the rasterized line information, the present invention uses FBO to store the intersection information, and the storage structure is a four-tuple<lineId1,lineId2,x,y> , where lineId1 and lineId2 are the indexes of the two intersection lines, and (x, y) are the two-dimensional coordinates of the intersection point. Those skilled in the art can set the specific structure of the texture management strategy according to actual conditions.
[0090] In some optional embodiments, the steps of calculating and recording the positional relationship of the line segment pair through a preset line segment intersection algorithm may generally include: determining whether the bounding boxes of two target line segments in the line segment pair intersect; when the bounding boxes of the two target line segments intersect, calculating the cross product of the two target line segments; when the cross product is not zero, solving the intersection coordinates using the preset line segment parameter equation; determining whether the intersection coordinates are located inside the two target line segments; when the intersection coordinates are located inside the two target line segments, determining that the two target line segments intersect. Among them, the bounding box is a rectangle or axis-aligned rectangle used to enclose one or more geometric objects. The bounding box is used to quickly exclude objects that are impossible to intersect, thereby improving the efficiency of the algorithm. In this method, objects that are impossible to intersect can be quickly excluded through the bounding box. An optional example of a line segment intersection algorithm is as follows. Figure 7 As shown, Figure 7 1 is a pseudo code schematic diagram of an algorithm for calculating the intersection of two line segments according to a method for calculating the intersection of two-dimensional survey lines according to an embodiment of the present invention. Figure 7 In the line segment intersection algorithm shown, all equality judgments are calculated using an error value, which can generally be set to 1e-6. Through this algorithm, four basic spatial position relationships between two line segments can be clearly distinguished and output, and are arranged in order of priority: intersection, overlap (without intersection), parallel, and non-intersection. Those skilled in the art can determine the specific value of the error value according to actual conditions.
[0091] In computer graphics and geometry, the cross product usually refers to the cross product of vectors. For two line segments, their relative positions can be determined by calculating the cross product of the vectors represented by the two line segments. An optional example is: if the cross product result is positive, it means that the first line segment is to the left of the second line segment. If the cross product result is negative, it means that the first line segment is to the right of the second line segment. If the cross product result is zero, it means that the two line segments are parallel or collinear.
[0092] When the cross product result is not zero, it means that the two line segments are not parallel or collinear, that is, the two line segments have an intersection, but it is not certain whether the intersection is inside the current pixel, so it is necessary to use the preset line segment parameter equation to solve the intersection coordinates; determine whether the intersection coordinates are inside the two target line segments; if the intersection coordinates are inside the two target line segments, determine that the two target line segments intersect. This method can quickly calculate the specific location of the intersection based on the line measurement information recorded by the frame buffer object.
[0093] It should be noted that in the process of finding the intersection of line segments, Figure 8 The texture 1, texture 2 and the line information in the rasterization stage FBO are used to calculate the two-dimensional point coordinates corresponding to all line segments in each pixel. When the number of line segments in a pixel of the rasterized FBO is greater than or equal to two, all possible line segment pairs in the pixel are arranged and combined. For each pair of line segments, the intersection calculation is performed and their spatial position relationship is recorded. The spatial position relationship of the line segment pair can be recorded through the RGBA channel of the FBO, as shown in Table 1:
[0094] Table 1, line segment intersection status table
[0095] Spatial position relationship of line segments R G B A intersect lineId1 lineId2 x y overlapping 0 -1 lineId1 lineId2 parallel -1 0 lineId1 lineId2 Disjoint -1 -1 0 0
[0096] In addition, it should be noted that in this embodiment, each pixel of an FBO can only store one intersection point. Therefore, when there are multiple intersection points in a pixel, the number of FBOs needs to be dynamically increased to record other intersection points. At the same time, in order to avoid repeated recording of intersection points, each newly created FBO needs to use the intersection point information in the previous FBO as input data for comparison and judgment.
[0097] In other optional embodiments, after the step of calculating the intersection of the two-dimensional survey lines by using a preset line segment intersection algorithm to obtain the survey line information, it can generally also include: deduplication processing of the intersection of the two-dimensional survey lines by using a preset deduplication algorithm. Since GPGPU is a highly parallel processing unit, when performing large-scale parallel computing, the same intersection may be calculated simultaneously or independently by multiple processing units, resulting in duplicate records. Therefore, it is usually necessary to transfer the intersection calculated in the GPU to the CPU for deduplication processing. In the CPU, the data structure of the intersection can generally be defined as: IntersectedPt{lineId1, lineId2, x, y}, where lineId1 and lineId2 are the indexes of the two intersection lines; (x, y) is the two-dimensional coordinates of the intersection.
[0098] In order to solve the intersection redundancy problem generated during GPU parallel processing, the present invention designs and implements a deduplication algorithm based on hash mapping. The core of the algorithm is to create a highly unique key value, which is generated by the index of two lines. The calculation formula is:
[0099] key=maxLineId*maxIntersectedPtNum+minLineId
[0100] Among them, maxLineId is the maximum value of the two line indexes; minLineId is the minimum value of the two line indexes; maxIntersectedPtNum is a preset constant factor, which is generally set to the upper limit of the expected number of intersections.
[0101] Among them, an optional example of a hash map storage structure in a deduplication algorithm is as follows Fig. 9 As shown, Fig. 9 1 is a schematic diagram of the hash map storage structure in the deduplication algorithm of the method for calculating the intersection of two-dimensional survey lines according to an embodiment of the present invention. For each intersection, its key value is first calculated, and then the hash map is used to store these key values and their corresponding intersection lists. In the hash map, each unique key value is mapped to an intersection list, and all intersections with the same key value are stored in the list. When a new intersection is calculated, the algorithm will first search the hash map for the corresponding intersection list according to its key value. If the key value is not found, an intersection list is created for the key value in the hash map and the current intersection is added to the list. If the corresponding key value is found, the algorithm will further check whether the current intersection is already included in the list. If the intersection is not included, it is added to the list; otherwise, the intersection is ignored to avoid redundancy.
[0102] Figure 3 FIG. 1 is a flow chart of FBO1 rasterization processing in a method for calculating intersection points of two-dimensional survey lines according to an embodiment of the present invention. Figure 3 As shown, the method for calculating the intersection of two-dimensional survey lines at least includes the following steps S301 to S311.
[0103] Step S301, create and initialize FBO1, the total number of lines is lineCount. In some optional embodiments, initialization means initializing the line information of all pixels in the frame buffer to 0, that is, (R, G, B, A) of each pixel is 0.
[0104] Step S302, set i=0.
[0105] Step S303: draw the i-th survey line.
[0106] Step S304, determine i <lineCount?。
[0107] Step S305: If the result of step S304 is yes, the step of parallel rasterizing the survey line information is executed to determine whether R and G of FBO1 are 0.
[0108] Step S306: If the result of step S305 is yes, use the R and G components of FBO1 to record the R and G of the current pixel. If step S306 is completed, it means that the steps of parallel rasterizing the line information in this cycle are completed.
[0109] Step S307, if the judgment in step S305 is no, determine whether the R and G of the current pixel are equal to the R and G in FBO1.
[0110] Step S308: If the result of step S307 is yes, the current pixel is filled with RGBA of FBO1. When step S308 is completed, it means that the step of parallel rasterizing the line information in this cycle is completed.
[0111] Step S309, if the judgment in step S307 is no, use the B and A components of FBO1 to record the R and G of the current pixel. In step S309, if there are more than two lines of information at the current pixel, the corresponding B and A components will be continuously covered by the newly drawn survey lines. Two strategies can be used to improve it: one is to increase the number of FBOs to record more survey line information; the other is to increase the resolution of rasterization to reduce the number of survey lines that need to be recorded in a single pixel. Those skilled in the art can adjust the direct relationship between resolution and the number of FBOs according to actual conditions. When step S309 is executed, it means that the step of parallel rasterization of survey line information in this cycle has been executed.
[0112] Step S310, after the steps in the parallel gridding of the survey line information are processed, i=i+1 is set, and then step S303 is continued.
[0113] Step S311, after the steps in the parallel rasterization of the survey line information are processed, FBO1 is updated. When the updating of FBO1 is completed, step S303 is continued to be executed based on the updated FBO1.
[0114] By this method, after each survey line is drawn, the FBO corresponding to the survey line will be superimposed and updated with the latest FBO1 to reflect the survey line information of the latest FBO1 in real time.
[0115] Figure 3 An alternative example of the process shown is as follows Figure 4 As shown, Figure 4FIG. 1 is a schematic diagram showing the rasterization processing of FBO1 in a method for calculating intersection points of two-dimensional survey lines according to an embodiment of the present invention. Figure 4 As can be seen, initially, the pixel values of FBO1 are all 0. When drawing line 1, the pixels through which line 1 passes will be marked. At this time, the lineId and segId of line 1 will be recorded in the pixel ( Figure 4 Then, FBO1 is updated to the superposition result of FBO1 and FBO_line. When drawing line 2, the pixels passed by line 2 are compared with the superimposed FBO1, and the pixels passed by line 2 are marked with the line information of line 2 ( Figure 4 The pixels marked as 2 in the figure record the measurement line information of line 1 and line 2 for the pixels that both lines pass through ( Figure 4 ); draw the next line in the same way until all lines are drawn. In the GPU, the line drawn later will overwrite the previously filled line information. Therefore, in this drawing process, when there are more than two lines in the grid, the line drawn later may overwrite the previous line information, which needs to be stored through FBO2. When all the lines are drawn, the R, G, B, and A components of the pixels passed by the line are filled with the line information, that is, the line index (lineId) and the line segment index (segId) of the current line.
[0116] When the number of measurement lines that need to be recorded in a single pixel exceeds two, FBO2 will be enabled to expand the storage capacity so that a single pixel can support the recording of up to four measurement line information. Figure 5 FIG. 1 is a flow chart of FBO2 rasterization processing in a method for calculating intersection points of two-dimensional survey lines according to an embodiment of the present invention. Figure 5 As shown, the method for calculating the intersection of two-dimensional survey lines at least includes the following steps S501 to S515.
[0117] Step S501, create and initialize FBO2, the total number of measurement lines is lineCount.
[0118] Step S502, set i=0.
[0119] Step S503: draw the i-th survey line.
[0120] Step S504, determine i <lineCount?。
[0121] Step S505: If the judgment in step S504 is yes, determine whether the R and G of the current pixel of FBO1 are 0.
[0122] Step S506: when the answer in step S505 is yes, skip the step of parallel gridding the survey line information.
[0123] Step S507, if the judgment in step S505 is no, determine whether the R and G of the current pixel are recorded in FBO1.
[0124] Step S508: if the answer in step S507 is yes, skip the step of parallel gridding the survey line information.
[0125] Step S509: If the judgment in step S507 is no, determine whether the R and G of the current pixel of FBO2 are 0.
[0126] Step S510: If the result of step S509 is yes, use the R and G components of FBO2 to record the R and G of the current pixel. If step S510 is completed, it means that the steps of parallel rasterizing the survey line information in this cycle are completed.
[0127] Step S511, if the judgment in step S509 is no, determine whether the R and G of the current pixel are equal to the R and G in FBO2.
[0128] Step S512: if the result of step S511 is yes, fill the current pixel with RGBA of FBO2. If step S512 is completed, it means that the step of parallel rasterizing the line information in this cycle is completed.
[0129] Step S513: If the result of step S511 is negative, use the B and A components of FBO2 to record the R and G of the current pixel. If step S513 is completed, it means that the steps of parallel rasterizing the line information in this cycle are completed.
[0130] Step S514, after the parallel rasterization of the survey line information is completed, i=i+1 is set, and then step S503 is continued.
[0131] Step S515, after the steps in the parallel rasterization of the survey line information are processed, FBO2 is updated. When the updating of FBO2 is completed, step S503 is continued to be executed based on the updated FBO2 and FBO1.
[0132] In step S513, if the number of measurement lines in the current pixel exceeds four, the second measurement line information in FBO2 will continue to be overwritten. Therefore, it is necessary to continue to create new FBOs until all measurement lines are recorded in the corresponding updated frame buffer object (ie, FBO).
[0133] In order to explain this method more clearly, a specific implementation example is provided. Figure 6 As shown, Figure 6FIG. 1 is a flow chart showing a method for calculating the intersection of two-dimensional survey lines using two FBOs for rasterization processing according to an embodiment of the present invention. Figure 6 In the diagram shown, there are actually four measurement lines in the current frame, corresponding to 1, 2, 3, and 4. First, create the frame buffer object FBO1 to be updated and initialize it. Each square corresponds to a pixel. At this time, each pixel inside FBO1 is (0,0,0,0), and the measurement line information of each measurement line is (lineId, segId). Each frame buffer object records at most two measurement line information, that is, (lineId1, segId1, lineId2, segId2) is equivalent to (measurement line 1, measurement line 2). So for the convenience of display, Figure 3 The numbers in each square are expressed in the form of (survey line 1, survey line 2), that is, (1,2) represents (survey line 1, survey line 2), and the corresponding actual content is (lineId1, segId1, lineId2, segId2).
[0134] During the FBO1 rasterization process, due to the limitation of pixel space, the lineId and segId of the second line will be overwritten by the later drawn lines. Figure 6 In the rasterization of FBO1, when drawing line 3, if a pixel has recorded the information of lines 1 and 2, and line 3 happens to pass through this pixel, the previously stored second line information (i.e., line 2 information) will be replaced by the currently drawn line 3, so that the line information in the pixel is updated to the information of lines 1 and 3; similarly, when drawing line 4, if line 4 also passes through the pixel, its second line information will be overwritten again, that is, the pixel will finally be updated to the information of lines 1 and 4. In the rasterization of FBO2, by comparing with the line information recorded in FBO1, the line information that has been overwritten due to space limitations will be re-recorded. At this time, for the pixels that are passed by lines 1, 2, 3, and 4, their line information will be recorded in the corresponding pixels of FBO1 and FBO2.
[0135] In summary, the present invention proposes an efficient two-dimensional survey line intersection algorithm, which maps complex two-dimensional survey line information into a grid system, and uses frame buffer objects to efficiently record the line index and specific line segment index of the survey line in each grid unit, thereby realizing rapid retrieval of line segments and accurate positioning of potential intersections. For each area marked as a potential intersection, a line segment intersection algorithm is used to perform precise calculations to ensure the accuracy of the intersection. Finally, redundant data is eliminated through CPU deduplication processing to ensure the accuracy of the intersection results. This comprehensive method not only greatly reduces invalid calculations, but also significantly improves the efficiency and reliability of two-dimensional survey line intersection calculations. When the present invention intersects the line segments, by predicting the spatial position relationship between the two line segments, only the two line segments that may intersect are intersected, avoiding invalid calculations for line segments that are unlikely to intersect, thereby greatly improving the efficiency of survey line intersection.
[0136] Through actual test verification, when the number of line segments reaches about 80,000, the intersection algorithm of the present invention is about 100 times faster than the traditional segment-by-segment intersection algorithm. This is because the calculation time of the segment-by-segment intersection algorithm increases sharply with the increase of segment data, resulting in low efficiency; while the algorithm of the present invention directly performs parallel calculations in the grid, and the intersection time is basically not affected by the number of measured lines.
[0137] The flow chart provided by the present embodiment is not intended to indicate that the operation of the method will be performed in any particular order, or that all operations of the method are included in all every case. In addition, the method may include additional operations. Within the scope of the technical thinking provided by the present embodiment method, additional changes may be made to the above method.
[0138] It should be understood that in some embodiments, each part can be implemented by hardware, software, firmware or a combination thereof. In the above embodiments, multiple steps or methods can be implemented by software or firmware stored in a memory and executed by a suitable instruction execution system.
[0139] This embodiment also provides a computer program product 10 , a computer readable storage medium 20 , and a computer device 30 . Fig.10 is a schematic diagram of a computer program product 10 according to an embodiment of the present invention, Fig.11 is a schematic diagram of a computer-readable storage medium 20 according to an embodiment of the present invention, Fig.12is a schematic diagram of a computer device 30 according to an embodiment of the present invention. The computer program product 10 includes a computer program 11, which implements the steps of any of the above-mentioned two-dimensional survey line intersection calculation methods when executed by a processor 32. The computer readable storage medium 20 stores the above-mentioned computer program 11, which implements the steps of any of the above-mentioned two-dimensional survey line intersection calculation methods when executed by a processor 32. The computer device 30 may include a memory 31, a processor 32, and a computer program 11 stored in the memory 31 and running on the processor 32.
[0140] The computer program 11 for performing the operation of the present invention may be an assembly instruction, an instruction set architecture (ISA) instruction, a machine instruction, a machine-related instruction, a microcode, a firmware instruction, a state setting data, a configuration data of an integrated circuit, or a source code or an object code written in any combination of one or more programming languages and process programming languages. The computer program 11 may be executed entirely on the user's computer, partially on the user's computer, as an independent software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the latter case, the remote computer may be connected to the user's computer via any type of network (including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., using an Internet service provider via the Internet). In some embodiments, in order to perform various aspects of the present invention, an electronic circuit including, for example, a programmable logic circuit, a field programmable gate array (FPGA) or a programmable logic array (PLA) may execute computer-readable program instructions by utilizing the state information of the computer-readable program instructions to personalize the electronic circuit.
[0141] For the purposes of the description of the present embodiment, the computer program product 10 is a related product that includes the computer program 11. For the purposes of the description of the present embodiment, the computer readable storage medium 20 is a tangible device capable of retaining and storing the computer program 11, which may be any device that can contain, store, communicate, propagate or transmit the program 11 for use with or in conjunction with an instruction execution system, device or apparatus. More specific examples (a non-exhaustive list) of the computer readable storage medium 20 include the following: a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a static random access memory (SRAM), a portable compact disk read-only memory (CD-ROM), a digital versatile disk (DVD), a memory stick, a floppy disk, a mechanical encoding device, and any suitable combination of the foregoing.
[0142] The computer device 30 may be, for example, a server, a desktop computer, a notebook computer, a tablet computer, or a smart phone. In some examples, the computer device 30 may be a cloud computing node. The computer device 30 may be described in the general context of computer system executable instructions (such as program modules) executed by a computer system. Typically, a program module may include routines, programs, target programs, components, logic, data structures, etc. that perform specific tasks or implement specific abstract data types. The computer device 30 may be implemented in a distributed cloud computing environment where remote processing devices linked via a communication network perform tasks. In a distributed cloud computing environment, program modules may be located on a local or remote computing system storage medium including a storage device.
[0143] The computer device 30 may include a processor 32 adapted to execute stored instructions, and a memory 31 providing temporary storage space for the operation of the instructions during operation. The processor 32 may be a single-core processor, a multi-core processor, a computing cluster, or any number of other configurations. The memory 31 may include a random access memory (RAM), a read-only memory, a flash memory, or any other suitable storage system.
[0144] The computer device 30 may also include a network adapter / interface and an input / output (I / O) interface. The I / O interface allows data to be input and output with external devices that may be connected to the computer device. The network adapter / interface may provide communication between the computer device and a network, which is typically shown as a communication network.
[0145] At this point, those skilled in the art should recognize that, although multiple exemplary embodiments of the present invention have been shown and described in detail herein, many other variations or modifications that conform to the principles of the present invention can still be directly determined or derived based on the content disclosed in the present invention without departing from the spirit and scope of the present invention. Therefore, the scope of the present invention should be understood and recognized as covering all these other variations or modifications.
Claims
1. A method for calculating the intersection of two-dimensional survey lines, comprising: Acquire the two-dimensional survey line data, and perform preprocessing to obtain a survey line tuple set; rasterizing the survey line tuple set to obtain survey line information; The survey line information is calculated using a preset line segment intersection algorithm to obtain the intersection point of the two-dimensional survey line.
2. The method for calculating the intersection of two-dimensional survey lines according to claim 1, wherein: The survey line tuple set includes vertex coordinates, survey line indexes and line segment indexes; The step of pre-processing comprises: Determine, according to the two-dimensional survey line data, the two-dimensional coordinates corresponding to each vertex of the two-dimensional survey line as the vertex coordinates; Allocate a survey line index and a line segment index corresponding to the line segment where the vertex is located to the survey line where the vertex is located; The vertex coordinates, the line index, and the line segment index are combined as the line tuple set.
3. The method for calculating the intersection of two-dimensional survey lines according to claim 1, wherein: Before the step of rasterizing the measurement line tuple set, the step further includes: passing the measurement line tuple set to a vertex shader to obtain information to be processed; The step of performing rasterization processing on the set of line tuples includes: the vertex shader transmits the information to be processed to the fragment shader for performing the rasterization processing.
4. The method for calculating the intersection of two-dimensional survey lines according to claim 3, wherein: The step of performing the rasterization process comprises: Create a frame buffer object to be updated, and initialize the line measurement information of all pixels in the frame buffer object to be updated; Traversing all the survey lines one by one, and during the traversal process, drawing one survey line each time as a target survey line; Comparing the target frame buffer object where the target measurement line is located with the frame buffer object to be updated according to the information to be processed, so as to update the frame buffer object to be updated; When the updated frame buffer object is obtained after the to-be-updated frame buffer object is updated, but there are still unrecorded measurement lines in the pixel, a new to-be-updated frame buffer object is added, and the unrecorded measurement lines are recorded until all the measurement lines are recorded in the corresponding updated frame buffer object.
5. The method for calculating the intersection of two-dimensional survey lines according to claim 4, wherein: The information to be processed includes texture coordinates of the survey line and survey line information; The step of comparing the target frame buffer object where the target measurement line is located with the frame buffer object to be updated according to the information to be processed to update the frame buffer object to be updated comprises: Obtaining a first channel value and a second channel value of the frame buffer object to be updated in the current pixel through the texture coordinates, each pixel in the frame buffer object stores four floating-point values, and each of the floating-point values corresponds to a channel value; Determine whether the first channel value and the second channel value are initial values; If it is the initial value, recording the first target channel value and the second target channel value of the target frame buffer object in the current pixel to the first channel value and the second channel value; If it is not the initial value, determining whether the first channel value and the second channel value are the same as the first target channel value and the second target channel value respectively; When the first channel value and the second channel value are different from the first target channel value and the second target channel value, the first target channel value and the second target channel value are used to overwrite the third channel value and the fourth channel value of the frame buffer object to be updated in the current pixel.
6. The method for calculating the intersection of two-dimensional survey lines according to claim 5, wherein: The step of adding a frame buffer object to be updated and recording the unrecorded measurement line comprises: Traversing all the survey lines one by one, and during the traversal process, only drawing one survey line at a time as a target survey line; Acquire the first channel value and the second channel value of the updated frame buffer object and the frame buffer object to be updated in the current pixel through the texture coordinates; Determine whether the first channel value and the second channel value of the updated frame buffer object are the initial values; In a case where the first channel value and the second channel value of the updated frame buffer object are not the initial values, determining whether the first target channel value and the second target channel value of the target frame buffer object where the target measurement line is located in the current pixel are recorded in the updated frame buffer object; If no record exists, the first target channel value and the second target channel value are recorded in the frame buffer object to be updated.
7. The method for calculating the intersection of two-dimensional survey lines according to claim 1, wherein: The step of calculating the survey line information by using a preset line segment intersection algorithm to obtain the intersection point of the two-dimensional survey line comprises: Generate a first texture and a second texture corresponding to the two-dimensional survey line according to the survey line tuple set, wherein the first texture is used to store a survey line index corresponding to the two-dimensional survey line and a starting point index corresponding to the starting point of the two-dimensional survey line, and the second texture is used to store the two-dimensional point coordinates of all the survey lines; Acquire the two-dimensional point coordinates corresponding to all line segments in each pixel according to the first texture, the second texture and the survey line information; When the number of line segments in the pixel exceeds a preset number, all possible line segment pairs in the pixel are obtained by permutation and combination; The positional relationship of the line segment pairs is calculated and recorded by a preset line segment intersection algorithm, thereby obtaining the intersection point of the two-dimensional survey line.
8. The method for calculating the intersection of two-dimensional survey lines according to claim 7, wherein: The step of calculating and recording the positional relationship of the line segment pairs by using a preset line segment intersection algorithm comprises: Determine whether the outer bounding boxes of two target line segments in the line segment pair intersect; When the outer bounding boxes of the two target line segments intersect, calculating the cross product of the two target line segments; When the cross product is not zero, using a preset line segment parameter equation to solve the intersection coordinates; Determine whether the intersection coordinates are located inside the two target line segments; When the intersection point coordinates are located inside the two target line segments, it is determined that the two target line segments intersect.
9. The method for calculating the intersection of two-dimensional survey lines according to claim 1, wherein: After the step of calculating the survey line information by using a preset line segment intersection algorithm to obtain the intersection point of the two-dimensional survey line, the following step further comprises: The intersection points of the two-dimensional survey lines are deduplicated using a preset deduplication algorithm.
10. A computer program product, comprising a computer program, wherein when the computer program is executed by a processor, the steps of the method for calculating intersection points of two-dimensional survey lines according to any one of claims 1 to 8 are implemented.
Citation Information
Cited By
Method, device and equipment for quickly solving intersection points of massive line segments and medium
CN119625221A
