A method for drawing a petroleum geology map element
By selecting the starting point of the polygon in the petroleum geological map and successively analyzing the boundary relationships to trim invalid areas, the problem of drawing redundancy in the drawing of petroleum geological elements is solved, and the drawing efficiency and accuracy are improved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- CHINA UNIV OF PETROLEUM (EAST CHINA)
- Filing Date
- 2021-02-23
- Publication Date
- 2026-06-02
AI Technical Summary
Existing technologies, when drawing petroleum geological map data, cause drawing redundancy due to polygons exceeding the viewport area, increasing spatiotemporal complexity and reducing drawing efficiency.
By selecting the first point inside the viewport of the petroleum geological map metadata polygon as the starting point, the spatial relationship between each side of the polygon and the boundary of the rectangular viewport is analyzed successively, and invalid areas are clipped to reduce the time and space complexity of drawing.
It achieves efficient cropping of petroleum geological map data, reduces the spatiotemporal complexity of drawing, improves the spatiotemporal efficiency of drawing two-dimensional primitives, and is applicable to the case of intersection of arbitrary concave and convex polygons and rectangles.
Smart Images

Figure CN114972572B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of computer graphics technology, and in particular to a method for drawing petroleum geological primitives. Background Technology
[0002] Polygon clipping algorithms are widely used in computer graphics, geographic information systems, and other fields, and are fundamental to many important problems in computer graphics. Their main purpose is to clip the portion of the polygon (also known as a solid polygon) that lies outside the clipping polygon. In petroleum geological map drawing, the petroleum geological map data needs to be displayed in a rectangular viewport. Sometimes, clipping is required. This necessitates filling and clipping the polygons in the overlapping area between the petroleum geological map data and the rectangular viewport, thereby reducing the time and space complexity of the drawing process and improving drawing efficiency.
[0003] The existing technology has at least the following shortcomings:
[0004] 1. When using computers to draw petroleum geological map data, problems such as drawing redundancy, increased time and space complexity, and reduced drawing efficiency may occur because the polygons of petroleum geological map elements exceed the view window area. Summary of the Invention
[0005] To address the insufficient accuracy issues in existing technologies, this invention provides a method for drawing petroleum geological primitives. It imports petroleum geological primitive data and, by selecting the first point of the primitive polygon within the viewport as the starting point, it iterates and analyzes the spatial relationships between each side of the polygon and the boundary of the rectangular viewport, obtaining the boundary points of the polygon within the rectangular viewport. This allows for the removal of invalid areas and reduces the time and space complexity of drawing. This invention offers high time and space efficiency for drawing two-dimensional primitives when clipping is required when displaying petroleum geological primitives in a rectangular viewport.
[0006] The inventors have provided a method for drawing petroleum geological features, comprising the following steps:
[0007] Preprocessing steps,
[0008] S1000: Input the vertex coordinate dataset A' of the petroleum geological map metadata polygon and the coordinate data of the rectangular window, which are the vertices and sides of the polygon, the vertices and sides of the rectangular window; the petroleum geological map metadata includes the following polygon filling primitives: folds, faults, monoclinics, pinch-outs, and lithological infills.
[0009] S2000: Create a circular linked list A and a set of overlapping vertex regions B for searching;
[0010] S3000: Store each vertex in the polygon vertex coordinate dataset A' into the search circular linked list A in sequence, and determine each side of the polygon as a vector side; according to the position of the starting point and ending point of each vector side of the polygon relative to the rectangular window, determine the intersection point of each vector side and the rectangular window as the exit point or the entry point;
[0011] in,
[0012] When the starting point of a vector edge is inside the rectangular viewport and the ending point is outside the rectangular viewport, the intersection of the vector edge and the rectangular viewport is determined as the out-point, and the rectangular viewport edge where the out-point is located is denoted as OutLine.
[0013] When the starting point of a vector edge is outside the rectangular viewport and the ending point is inside the rectangular viewport, the intersection of the vector edge and the rectangular viewport is determined as the in-point, and the rectangular viewport edge where the in-point is located is denoted as InLine.
[0014] S4000: Based on the relative positions of each vertex of the polygon and the rectangular window, the spatial relationship between the polygon and the rectangular window is obtained;
[0015] S5000: Based on the spatial relationship between the polygon and the rectangular window, determine the overlapping area. If the overlapping area is not empty, or is not the polygon, or is not the rectangular window, perform the following operation:
[0016] S5001:
[0017] The first vertex of the polygon within the rectangular viewport is used as the starting point of the search circular linked list A.
[0018] A0, re-sort and execute the main analysis step;
[0019] or,
[0020] If an edge with two intersection points with the rectangular window is found, the midpoint M0 of the first edge found in sequence and the two intersection points with the rectangular window is inserted after the starting point of the first edge in the search circular linked list A, and used as the new starting point A0 of the search circular linked list A. The list is then reordered and the main analysis step is executed.
[0021] Main analysis step,
[0022] S6000: Add the starting point A0 of the search circular linked list A to the vertex set B of the overlapping region;
[0023] S7000: Set the pointer to point to the starting point A0 in the search circular linked list A;
[0024] S8000: Determines whether the vertices of the polygon currently pointed to by the pointer are within the rectangular viewport:
[0025] If the current polygon vertex is within the rectangular viewport, then add the polygon vertex to the overlapping region vertex set.
[0026] B; If the current polygon vertex is not within the rectangular viewport, then determine the points that need to be added to the overlapping region vertex set B based on the number of intersections between each side of the polygon and the rectangular viewport, and add the points that need to be added to the overlapping region vertex set B.
[0027] To the vertex set B of the overlapping region;
[0028] If the current vertex of the polygon is not the last vertex, let the pointer point to the next vertex of the current vertex and execute step S8000; otherwise, execute step S9000.
[0029] S9000: Output overlapping area, exit program;
[0030] The points to be added to the vertex set B of the overlapping region include at least one of the following: several vertices of the polygon, the intersection of the polygon and the rectangular window, and several vertices of the rectangular window.
[0031] Preferably, in the main analysis step, the points to be added to the vertex set B of the overlapping region and several vertices of the rectangular window to be added are determined based on the number of intersections between each side of the polygon and the rectangular window. Specifically, this includes the following steps:
[0032] S8100: Place the first point A that is not within the rectangular window. i+1 Compared to the previous point A i The intersection point P1 of the formed edge and the rectangular viewport is added to point A in the vertex set B of the overlapping region. i after;
[0033] S8200: Point A in the search circular linked list i+1 Then, select two adjacent points A in sequence. Fd1 and A Fd2 Determine A Fd1 A Fd2 The number of intersections with the rectangular viewport, and the corresponding operation:
[0034] S8210: If line segment A Fd1 A Fd2 If there is no intersection with the rectangular window, return to S8200 and search for a new A. Fd1 and A Fd2 Make a judgment;
[0035] S8220: If line segment A Fd1 A Fd2If the rectangular window has two intersection points, then the midpoint M of these two intersection points is added to the search circular linked list A, and A is set to... Fd2 Let M be a point, then A Fd1 A Fd2 If there is an intersection point P2 with the rectangular window, proceed to step S8300;
[0036] S8230: If line segment A Fd1 A Fd2 If the rectangular window intersects with the rectangular window at point P2, proceed to step S8300.
[0037] S8300: Construct a temporary polygon outPoly located outside the rectangular window. Starting from P1, add the vertices of the polygon between P1 and P2 to outPoly in sequence, and finally add P2.
[0038] S8400: Based on the sequence number of the polygon edge where the out point and in point are located, and the coordinate information of each vertex in outPoly, insert several vertices of the rectangular window at the tail of the vertex set B of the overlapping region, and finally add P2.
[0039] S8500: Determine A Fd2 Is it A0?
[0040] If A Fd2 If A is 0, then insert A at the tail of the vertex set B of the overlapping region. Fd2 Return to step S6000;
[0041] Otherwise, return to step S9000.
[0042] Preferably, in step S8400, according to the index of the polygon edge where the exit point and the entry point are located, several vertices of the rectangular window are inserted at the tail of the vertex set B of the overlapping region, including the following steps:
[0043] S8410: Let intersection point P1 be edge A i A i+1 The intersection point P2 with the outermost edge of the rectangular window is line segment A. Fd1 A Fd2 As can be seen from step S8220, the intersection point with the InLine edge of the rectangular window is P1, which is the exit point and P2, which is the entry point. From point P1, A... i+1 ,…,A Fd1 P2 forms a temporary polygon OutPoly;
[0044] S8420: Determine whether each vertex of the rectangular window is within the temporary polygon OutPoly, and determine the relationship between the edges where the out point P1 and the in point P2 are located;
[0045] S8430: Determine the number of vertices of the rectangular window that need to be added based on the relationship between the edges where the exit point P1 and the entry point P2 are located;
[0046] S8440: Determine the order of adding vertices based on the order of the vertices of the rectangular window along the four sides of the rectangular window from the exit point P1 to the entry point P2.
[0047] S8450: Insert several vertices of the rectangular window at the tail of the overlapping region vertex set B, according to the required number of vertices of the rectangular window and the order in which the vertices are added.
[0048] Preferably, in step S8430, determining the number of vertices of the rectangular window to be added based on the relationship between the edges containing the exit point P1 and the entry point P2 specifically includes:
[0049] If the Outline edge and the Inline edge are opposite edges, then two vertices need to be added;
[0050] If the OutLine edge and the InLine edge are adjacent, then one or three vertices need to be added;
[0051] If the OutLine edge and the InLine edge are the same edge, then zero or four vertices need to be added;
[0052] Preferably, step S8440 specifically involves: starting from the exit point P1, drawing a path along the four sides of the rectangular window to the entry point P2, selecting a path that includes the vertices to be added, and determining the order in which the vertices to be added are added based on the order in which the path passes through the vertices to be added.
[0053] Compared with the prior art, the beneficial effects of the present invention are as follows:
[0054] (1) This invention selects the first internal point of the polygon as the starting point, and successively traverses and analyzes the spatial relationship between each side of the polygon and the boundary of the rectangular window to obtain the boundary point of the polygon within the window, thereby cutting out invalid areas and reducing the time and space complexity of drawing.
[0055] (2) This invention designs a new algorithm for adding vertices of a rectangular window when the outgoing and incoming points and the vertices of the polygons that have been passed are known. It is applicable to the set of polygon vertices stored in a circular linked list; and it is applicable to the case where any concave or convex polygon intersects with a rectangle, and can accurately obtain the set of polygon vertices in the overlapping area.
[0056] (3) The algorithm of this invention for determining whether the vertex of a rectangular window is within a temporary polygon is applicable to determining whether any point is within any polygon. This algorithm optimizes and refines the classic ray-drawing method. When determining whether point P is not within the polygon, it first checks whether it is not within its bounding rectangle, which reduces unnecessary calculations. It uses a finite-length line segment PP' for the ray length and checks whether the line segment PP' is connected to the line segment C formed by the two points taken in sequence. i C i+1 Is there a value other than C? i The method of finding the intersection point simplifies the traditional counting algorithm when a ray passes through the vertex of a polygon, and improves the timeliness of determining whether a point is within any convex or concave polygon. Attached Figure Description
[0057] Figure 1 This is a general flowchart of one embodiment of the present invention;
[0058] Figure 2 This is a flowchart of the preprocessing steps according to an embodiment of the present invention;
[0059] Figure 3 This is a flowchart of the main analysis steps in one embodiment of the present invention;
[0060] Figure 4 This is a flowchart illustrating how to determine whether the vertices of a rectangular viewport are within a temporary polygon, according to an embodiment of the present invention.
[0061] Figure 5a This is a schematic diagram illustrating the case where the inlet and outlet points are on the same side when adding a rectangular vertex algorithm to the tail of the overlapping region vertex set B according to an embodiment of the present invention.
[0062] Figure 5b This is a schematic diagram illustrating the case where the inlet and outlet points are on adjacent sides when adding a rectangular vertex algorithm to the tail of the overlapping region vertex set B according to an embodiment of the present invention.
[0063] Figure 5c This is a schematic diagram illustrating the case where the inlet and outlet points are on opposite sides when adding a rectangular vertex algorithm to the tail of the overlapping region vertex set B according to an embodiment of the present invention.
[0064] Figure 6a This is an embodiment of the present invention for processing the visualization programming test of petroleum geological elements in a monoclinic stratigraphic model;
[0065] Figure 6b This is an embodiment of the present invention for processing petroleum geological primitive visualization programming test of anticline strata model;
[0066] Figure 6c This is an embodiment of the present invention for processing petroleum geological primitives visualization programming test of fault stratigraphic models;
[0067] Figure 7 This is a flowchart of one embodiment of the present invention. Detailed Implementation
[0068] The following is in conjunction with the appendix Figure 1 -5、 Figure 7 as well as Figures 6a-6c The specific embodiments of the present invention will be described in detail below.
[0069] The inventors have provided a method for drawing petroleum geological features, comprising the following steps:
[0070] Preprocessing steps,
[0071] S1000: Input the vertex coordinate dataset A' of the petroleum geological map metadata polygon and the coordinate data of the rectangular window, which are the vertices and sides of the polygon, the vertices and sides of the rectangular window; the petroleum geological map metadata includes the following polygon filling primitives: folds, faults, monoclinics, pinch-outs, and lithological infills.
[0072] S2000: Create a circular linked list A and a set of overlapping vertex regions B for searching;
[0073] S3000: Store each vertex in the polygon vertex coordinate dataset A' into the search circular linked list A in sequence, and determine each side of the polygon as a vector side; according to the position of the starting point and ending point of each vector side of the polygon relative to the rectangular window, determine the intersection point of each vector side and the rectangular window as the exit point or the entry point;
[0074] in,
[0075] When the starting point of a vector edge is inside the rectangular viewport and the ending point is outside the rectangular viewport, the intersection of the vector edge and the rectangular viewport is determined as the out-point, and the rectangular viewport edge where the out-point is located is denoted as OutLine.
[0076] When the starting point of a vector edge is outside the rectangular viewport and the ending point is inside the rectangular viewport, the intersection of the vector edge and the rectangular viewport is determined as the in-point, and the rectangular viewport edge where the in-point is located is denoted as InLine.
[0077] S4000: Based on the relative positions of each vertex of the polygon and the rectangular window, the spatial relationship between the polygon and the rectangular window is obtained;
[0078] S5000: Based on the spatial relationship between the polygon and the rectangular window, determine the overlapping area. If the overlapping area is not empty, or is not the polygon, or is not the rectangular window, perform the following operation:
[0079] S5001:
[0080] The first vertex of the polygon within the rectangular viewport is used as the starting point of the search circular linked list A.
[0081] A0, re-sort and execute the main analysis step;
[0082] or,
[0083] If an edge with two intersection points with the rectangular window is found, the midpoint M0 of the first edge found in sequence and the two intersection points with the rectangular window is inserted after the starting point of the first edge in the search circular linked list A, and used as the new starting point A0 of the search circular linked list A. The list is then reordered and the main analysis step is executed.
[0084] Main analysis step,
[0085] S6000: Add the starting point A0 of the search circular linked list A to the vertex set B of the overlapping region;
[0086] S7000: Set the pointer to point to the starting point A0 in the search circular linked list A;
[0087] S8000: Determines whether the vertices of the polygon currently pointed to by the pointer are within the rectangular viewport:
[0088] If the current polygon vertex is within the rectangular viewport, then add the polygon vertex to the overlapping region vertex set.
[0089] B; If the current polygon vertex is not within the rectangular viewport, then determine the points that need to be added to the overlapping region vertex set B based on the number of intersections between each side of the polygon and the rectangular viewport, and add the points that need to be added to the overlapping region vertex set B.
[0090] To the vertex set B of the overlapping region;
[0091] If the current vertex of the polygon is not the last vertex, let the pointer point to the next vertex of the current vertex and execute step S8000; otherwise, execute step S9000.
[0092] S9000: Output overlapping area, exit program;
[0093] The points to be added to the vertex set B of the overlapping region include at least one of the following: several vertices of the polygon, the intersection of the polygon and the rectangular window, and several vertices of the rectangular window.
[0094] In a preferred embodiment, the main analysis step determines the points to be added to the vertex set B of the overlapping region and several vertices of the rectangular window to be added, based on the number of intersections between each side of the polygon and the rectangular window. Specifically, this includes the following steps:
[0095] S8100: Place the first point A that is not within the rectangular window. i+1 Compared to the previous point A i The intersection point P1 of the formed edge and the rectangular viewport is added to point A in the vertex set B of the overlapping region. i after;
[0096] S8200: Point A in the search circular linked list i+1 Then, select two adjacent points A in sequence. Fd1 and A Fd2 Determine A Fd1 A Fd2 The number of intersections with the rectangular viewport, and the corresponding operation:
[0097] S8210: If line segment A Fd1 A Fd2 If there is no intersection with the rectangular window, return to S8200 and search for a new A. Fd1 and A Fd2 Make a judgment;
[0098] S8220: If line segment A Fd1 A Fd2 If the rectangular window has two intersection points, then the midpoint M of these two intersection points is added to the search circular linked list A, and A is set to... Fd2 Let M be a point, then A Fd1 A Fd2 If there is an intersection point P2 with the rectangular window, proceed to step S8300;
[0099] S8230: If line segment A Fd1 A Fd2 If the rectangular window intersects with the rectangular window at point P2, proceed to step S8300.
[0100] S8300: Construct a temporary polygon outPoly located outside the rectangular window. Starting from P1, add the vertices of the polygon between P1 and P2 to outPoly in sequence, and finally add P2.
[0101] S8400: Based on the sequence number of the polygon edge where the out point and in point are located, and the coordinate information of each vertex in outPoly, insert several vertices of the rectangular window at the tail of the vertex set B of the overlapping region, and finally add P2.
[0102] S8500: Determine A Fd2 Is it A0?
[0103] If A Fd2 If the result is A0, then the traversal is complete and the program ends;
[0104] Otherwise, return to step 7000 and continue traversing the subsequent polygon vertices in the search circular linked list A.
[0105] In a preferred embodiment, in step S8400, according to the index of the polygon edge where the exit point and the entry point are located, several vertices of the rectangular window are inserted at the tail of the vertex set B of the overlapping region, including the following steps:
[0106] S8410: Let intersection point P1 be edge A i A i+1 The intersection point P2 with the outermost edge of the rectangular window is line segment A. Fd1 A Fd2 As can be seen from step S8220, the intersection point with the InLine edge of the rectangular window is P1, which is the exit point and P2, which is the entry point. From point P1, A... i+1 ,…,A Fd1 P2 forms a temporary polygon OutPoly;
[0107] S8420: Determine whether each vertex of the rectangular window is within the temporary polygon OutPoly, and determine the relationship between the edges where the out point P1 and the in point P2 are located;
[0108] S8430: Determine the number of vertices of the rectangular window that need to be added based on the relationship between the edges where the exit point P1 and the entry point P2 are located;
[0109] S8440: Determine the order of adding vertices based on the order of the vertices of the rectangular window along the four sides of the rectangular window from the exit point P1 to the entry point P2.
[0110] S8450: Insert several vertices of the rectangular window at the tail of the overlapping region vertex set B, according to the required number of vertices of the rectangular window and the order in which the vertices are added.
[0111] In a preferred embodiment, step S8420, determining whether any vertex P of the rectangular window is within the temporary polygon OutPoly, includes:
[0112] S8421: Input the coordinates of vertex P and the set of coordinate points C of the vertices of the polygon OutPoly;
[0113] S8422: Based on the maximum and minimum values of the x-coordinates of the point set C, a rectangular region R is obtained;
[0114] S8423: Determine if point P is inside the rectangular region R:
[0115] If not, then point P is outside the stated polygon OutPoly, and the judgment ends;
[0116] If we take another point P' such that PP' is a horizontal line segment, the maximum value of the x-coordinate of point P' and the x-coordinate of point set C is...
[0117] If the difference in values is greater than 1, proceed to step S8424.
[0118] S8424: Starting from the first point in the point set C, take two adjacent points C in a loop. i and C i+1 The number of intersections starts from 0 and continues until the last point in the point set C is reached;
[0119] Determine the line segment C formed by the two points extracted each time. i C i+1 Does line segment PP' have a value other than C? i The intersection of two line segments or two line segments
[0120] Overlapping parts:
[0121] If there is an intersection, increment the intersection count by 1.
[0122] If not, take the next adjacent point;
[0123] When the last set of line segments is obtained, if the number of intersections is odd, then point P is inside the polygon OutPoly; if the number of intersections is even, then point P is outside the polygon OutPoly.
[0124] In a preferred embodiment, step S8430, determining the number of vertices of the rectangular window to be added based on the relationship between the edges containing the exit point P1 and the entry point P2, specifically includes:
[0125] If the Outline edge and the Inline edge are opposite edges, then two vertices need to be added;
[0126] If the OutLine edge and the InLine edge are adjacent, then one or three vertices need to be added;
[0127] If the OutLine edge and the InLine edge are the same edge, then zero or four vertices need to be added;
[0128] In a preferred embodiment, step S8440 specifically involves: starting from the exit point P1, drawing a path along the four sides of the rectangular window to the entry point P2; selecting a path that includes the vertices to be added; and determining the order in which the vertices to be added are added based on the order in which the path passes through the vertices to be added.
[0129] Example 1
[0130] According to a specific embodiment of the present invention, the specific implementation of the pretreatment step in the present invention is described in detail below.
[0131] Define as follows: the vertex set B of the overlapping region, search the circular linked list A, and the rectangular window R.
[0132] The preprocessing steps include:
[0133] Starting from the first element A0 of the search circular linked list A, traverse all points of the linked list, and judge whether Ai (i = 0, 1, 2, N - 1) is inside the rectangle R;
[0134] Define the iterator iter0. If Ai is located inside the rectangular window R, then make iter0 point to the next vertex Ai in the search circular linked list;
[0135] If all points of A are inside R, then B = A, and the algorithm ends;
[0136] If some points of A are inside R and some points are outside R, then make the element currently pointed to by iter0 as the first element A0 of the circular linked list, end the pre-analysis, and enter the edge-by-edge analysis module; if all points are outside R, then enter step 2).
[0137] 2) Starting from the first side A0A1 of the polygon, judge whether AiAj intersects with the four sides of the rectangle. If there are two intersection points, then insert the midpoint M of the two intersection points after Ai, N = N + 1, make Ai+1, that is, point M, as the first element A0 of the circular linked list, end the pre-analysis, and enter the edge-by-edge analysis module; if none of the sides of the polygon have two intersection points with the four sides of the rectangle R, then enter step 3).
[0138] 3) All vertices of the clipped polygon A are outside the rectangle R. The possible situations are that the intersection of A and R is empty or R is inside A. It is necessary to further judge whether the rectangle R is inside the polygon A. Judgment method: Determine whether any vertex of the rectangle is inside A. If it is inside A, then the overlapping region polygon B = R, and the algorithm ends; if not, then B = empty, and the algorithm ends.
[0139] Embodiment 2
[0140] According to a specific implementation scheme of the present invention, the specific implementation of the main analysis step in the present invention will be described in detail below.
[0141] The main analysis steps include:
[0142] 1) Define integer variables i, Fd1, Fd2, let i = 0, the iterator iter1 points to A0, and add A0 to the end of B.
[0143] 2) If i < N - 1, then enter step 3), otherwise enter step 13).
[0144] 3) Set the iterator `iter` to point to `Ai`. Entering this step means that `Ai` is definitely inside the viewport. Define the next point of `Ai` as `Anext`. If `i` is less than `N-1`, `Anext` is `Ai+1`; if `i` equals `N-1`, we have reached the last point, so its next point is the starting point, and `Anext` is `A0`.
[0145] 4) If Anext is inside the window, add Anext to the end of point set B, i = i + 1, and return to step 2); otherwise, proceed to step 5.
[0146] 5) If Ai is inside and Anext is outside, then it must have an intersection point P1 with the rectangular viewport. P1 is located on the Outline side of the viewport. Add P1 to the end of B.
[0147] 6) If i+2 is less than N, then let Fd2 = i+2; otherwise, Fd2 = 0;
[0148] 7) Fd1 is the index of the point preceding AFd2. If Fd2 = 0, then Fd1 = N-1; otherwise, Fd1 = Fd2-1.
[0149] 8) Set iterator iter2 to point to AFd1. If AFd1AFd2 has no intersection with the window, proceed to step 9); if there is one intersection, proceed to step 10); if there are two intersections, proceed to step 11).
[0150] 9) At this point, we need to find an entry point. We need to determine if Fd2 is less than N-1. If it is, then make Fd2 = Fd2 + 1; otherwise, Fd2 = 0. Return to step 7).
[0151] 10) This indicates that AFd2 is inside the rectangular window R. Let P2 be the intersection of AFd1, AFd2, and the window, which is the in-point and located on the InLine edge of the rectangular window R. Then, construct a new polygon OutPoly. The endpoint data structure is an array, with the starting point being the out-point P1. After P1, add Ai+1, Ai+2, ..., AFd1 in sequence, and then add the in-point P2. Based on the point coordinates of the polygon OutPoly and the edge numbers OutLine and InLine where P1 and P2 are located, determine and analyze the vertices of the rectangular window R that need to be added to the tail of polygon B and the order of addition. The addition algorithm is described later. After adding the vertices, insert P2 into the tail of B and proceed to step 12).
[0152] 11) This indicates that AFd is outside the rectangular viewport R. After adding the midpoint M of the two intersections of AFd1, AFd2, and the viewport to AFd1 of the original polygon A, the total number of vertices of polygon A becomes N = N + 1. Return to step 8). (Note: At this point, point AFd2 becomes M.)
[0153] 12) If Fd2 is not 0, it means that not all vertices have been traversed yet. Let i = Fd2, iterator iter1 point to Ai, and add Ai to the end of B, then return to step 2); otherwise, proceed to step 13).
[0154] 13) Output the polygon endpoint set B, then end.
[0155] Example 3
[0156] According to a specific embodiment of the present invention, the specific implementation of the algorithm for determining whether a vertex P of a rectangular window is within a temporary polygon is described in detail below.
[0157] Given a temporary polygon point set C as input, we need to determine whether a vertex P of a rectangular viewport is inside the temporary polygon C. The specific steps include:
[0158] 1) Traverse all points in C and obtain the maximum and minimum values of the horizontal and vertical coordinates, which are xmax, ymax, xmin, and ymin, respectively. Based on these four parameters, form a rectangular region R with the upper left corner coordinates as (xmin, ymin) and the lower right corner coordinates as (xmax, ymax).
[0159] 2) Determine whether P is within the rectangular region R, i.e., whether xmin≤x≤xmax and ymin≤y≤ymax are satisfied simultaneously. If satisfied, proceed to step 3); if not satisfied, output that point P is outside polygon C and end.
[0160] 3) Taking point P as the endpoint, a horizontal ray to the right needs to be drawn. Let the right endpoint be P'(xmax+α,PY), where α is an integer greater than or equal to 1. Since the x-coordinate of P' is greater than the x-coordinates of all points in C, a ray can be simulated. (Note: α≥1 is necessary because point coordinates are integers. After calculating the intersection of line segments, the intersection coordinates need to be rounded to integers. This can result in an error of no more than 0.5 between the actual intersection coordinates and the output intersection coordinates. Therefore, α≥1 is necessary to avoid errors when calculating the intersection of PP' and the sides of polygon C.)
[0161] 4) Let the integer variable j = 0 be used to store the number of intersection points between PP' and the C side of polygon.
[0162] 5) Traverse all edges of C. Each time, calculate the intersection point of PP' with the current edge. If there is an intersection point and the intersection point is not the starting point of the current edge, or if PP' and the current edge are parallel and partially overlap, then j = j + 1. Note: Since when the intersection point of PP' with a certain edge of C is exactly at the endpoint of that edge (let's call it point H), then PP' must have an intersection point with the next or previous edge of that edge, which is also point H, causing the intersection point to be counted repeatedly. To avoid this situation, we require that the intersection point cannot be the starting point of the current edge of C. In addition, we define that if PP' and the current edge have an overlapping area, it is recorded as having one intersection point.
[0163] 6) If the total number of intersection points j is odd, then output P is inside polygon C; otherwise, output P is outside polygon C.
[0164] Example 4
[0165] According to a specific embodiment of the present invention, Figure 5a , Figure 5b and Figure 5c The following explains the algorithm principle for adding vertices to the overlapping region point set B in this invention, using the example in this figure as a case study: (Three specific cases of adding vertices to the algorithm).
[0166] Based on the relative positions of the outgoing and incoming points, there are three cases: the outgoing and incoming points are on the same edge, the outgoing and incoming points are on adjacent edges, and the outgoing and incoming points are on opposite edges.
[0167] 1) If the in-point and out-point are on the same edge, the number of vertices to be added is 0 or 4. Check if any vertex Q of the rectangle is inside the polygon OutPoly. If it is, then 4 vertices need to be added. It's necessary to analyze the order in which the vertices of the rectangle window are added (clockwise or counter-clockwise), and from which vertex to start adding. This can be determined by judging the relative positions of the in-point and out-point. Figure 5a For example, if the outgoing vertex is P1 and the incoming vertex is P2, the order of adding vertices is 1-4-3-2; if the outgoing vertex is P2 and the incoming vertex is P1, the order is 2-3-4-1. The same applies when both the outgoing vertex and the incoming vertex are on other edges. If Q is not within the OutPoly, then the number of rectangular viewport vertices to be added is 0.
[0168] 2) If the in and out points are adjacent, then 1 or 3 vertices need to be added. We need to check if the intersection point M of the two sides of the rectangle containing the in and out points is within the polygon OutPoly. If it is, then the vertices to be added are... If not, then the 3 vertices to be added are the ones other than point M. We need to know the order of addition and the starting point, which we can determine based on the positions of the in and out points. For example... Figure 5bIf the outgoing point is P1 and the incoming point is P2, the addition order is 1-4-3; otherwise, the addition order is 3-4-1. The same applies to outgoing and incoming points on other edges.
[0169] 3) If the in and out points are on opposite sides, then 2 vertices need to be added. The vertices to be added must be known in terms of their numbers and order. There are only two possibilities for the vertices to be added, such as... Figure 5a , Figure 5b and Figure 5c Based on the entry and exit points in this situation, the vertices that need to be added are 2 and 3 or 1 and 4. We can randomly select a point to determine whether it is in polygon C, thus knowing which two vertices need to be added. Figure 5c In this case, we determine that endpoint 1 is inside the polygon, therefore vertices 1 and 4 need to be added. After obtaining the vertices to be added, we determine the addition order based on the relative relationship between the in and out points. For example... Figure 5c If P1 is the outgoing point and P2 is the incoming point, then the addition order is 1-4; otherwise, the addition order is 4-1. The same applies to other cases.
[0170] Example 5
[0171] According to a specific embodiment of the present invention, the following is in conjunction with Figures 6a-6c The method of the present invention will be described in detail below.
[0172] A visualization testing software for processing petroleum geological map elements was developed based on the algorithm of this invention. Figures 6a-6c The figures show examples of the effect of applying the algorithm of this invention to find the overlapping area between the vector graphics of petroleum geological primitives in monoclinic strata, synclines, and faults and a rectangular window. As can be seen from the figures, according to the method of this invention, the intersection point of the vector graphics of petroleum geological primitives outside the rectangular window with the rectangular window is determined, the intersection point is added to the overlapping area point set, and then clipped.
[0173] The above description is merely a preferred embodiment of the present invention and is not intended to limit the invention. Various modifications and variations can be made to the present invention by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention are included within the scope of protection of the present invention.
Claims
1. A method for drawing petroleum geological features, characterized in that, Includes the following steps: Preprocessing steps, S1000: Input the vertex coordinate dataset A' of the petroleum geological map metadata polygon and the coordinate data of the rectangular window, which are the vertices and sides of the polygon, the vertices and sides of the rectangular window; the petroleum geological map metadata includes the following polygon filling primitives: folds, faults, monoclinics, pinch-outs, and lithological infills. S2000: Create a circular linked list A and a set of overlapping vertex regions B for searching; S3000: Store each vertex in the polygon vertex coordinate dataset A' into the search circular linked list A in sequence, and determine each side of the polygon as a vector side; according to the position of the starting point and ending point of each vector side of the polygon relative to the rectangular window, determine the intersection point of each vector side and the rectangular window as the exit point or the entry point; in, When the starting point of a vector edge is inside the rectangular viewport and the ending point is outside the rectangular viewport, the intersection of the vector edge and the rectangular viewport is determined as the out-point, and the rectangular viewport edge where the out-point is located is denoted as OutLine. When the starting point of a vector edge is outside the rectangular viewport and the ending point is inside the rectangular viewport, the intersection of the vector edge and the rectangular viewport is determined as the in-point, and the rectangular viewport edge where the in-point is located is denoted as InLine. S4000: Based on the relative positions of each vertex of the polygon and the rectangular window, the spatial relationship between the polygon and the rectangular window is obtained; S5000: Based on the spatial relationship between the polygon and the rectangular window, determine the overlapping area. If the overlapping area is not empty, or is not the polygon, or is not the rectangular window, perform the following operation: S5001: The first vertex of the polygon within the rectangular window is used as the starting point A0 of the search circular linked list A, and the list is reordered to execute the main analysis step. or, If an edge with two intersection points with the rectangular window is found, the midpoint M0 of the first edge found in sequence and the two intersection points with the rectangular window is inserted after the starting point of the first edge in the search circular linked list A, and used as the new starting point A0 of the search circular linked list A. The list is then reordered and the main analysis step is executed. Main analysis step, S6000: Add the starting point A0 of the search circular linked list A to the vertex set B of the overlapping region; S7000: Set the pointer to point to the starting point A0 in the search circular linked list A; S8000: Determines whether the vertices of the polygon currently pointed to by the pointer are within the rectangular viewport: If the current polygon vertex is within the rectangular window, then the polygon vertex is added to the overlapping region vertex set B; if the current polygon vertex is not within the rectangular window, then the points that need to be added to the overlapping region vertex set B are determined according to the number of intersections between each side of the polygon and the rectangular window, and the points that need to be added to the overlapping region vertex set B are added to the overlapping region vertex set B. If the current vertex of the polygon is not the last vertex, let the pointer point to the next vertex of the current vertex and execute step S8000; otherwise, execute step S9000. S9000: Output overlapping area, exit program; The points to be added to the vertex set B of the overlapping region include at least one of the following: several vertices of the polygon, the intersection of the polygon and the rectangular window, and several vertices of the rectangular window.
2. The method for drawing petroleum geological features according to claim 1, characterized in that, In the main analysis step, based on the number of intersections between each side of the polygon and the rectangular window, the points to be added to the vertex set B of the overlapping region and several vertices of the rectangular window to be added are determined, specifically including the following steps: S8100: Place the first point A that is not within the rectangular window. i+1 Rather than the previous point A i The intersection point P1 of the formed edge and the rectangular viewport is added to point A in the vertex set B of the overlapping region. i after; S8200: Point A in the search circular linked list i+1 Then, select two adjacent points A in sequence. Fd1 and A Fd2 Determine A Fd1 A Fd2 The number of intersections with the rectangular viewport, and the corresponding operation: S8210: If line segment A Fd1 A Fd2 If there is no intersection with the rectangular window, return to S8200 and search for a new A. Fd1 and A Fd2 Make a judgment; S8220: If line segment A Fd1 A Fd2 If the rectangular window has two intersection points, then the midpoint M of these two intersection points is added to the search circular linked list A, and A is set to... Fd2 Let M be a point, then A Fd1 A Fd2 If the rectangular window intersects with the rectangular window at point P2, proceed to step S8300. S8230: If line segment A Fd1 A Fd2 If the rectangular window intersects with the rectangular window at point P2, proceed to step S8300. S8300: Construct a temporary polygon outPoly located outside the rectangular window. Starting from P1, add the vertices of the polygon between P1 and P2 to outPoly in sequence, and finally add P2. S8400: Based on the sequence number of the polygon edge where the out point and in point are located, and the coordinate information of each vertex in outPoly, insert several vertices of the rectangular window at the tail of the vertex set B in the overlapping region, and finally add P2. S8500: Determine A Fd2 Is it A0? If A Fd2 If A is 0, then insert A at the tail of the vertex set B of the overlapping region. Fd2 Return to step S6000; Otherwise, return to step S9000.
3. The method for drawing petroleum geological elements according to claim 2, characterized in that, In step S8400, based on the index of the polygon edges where the exit and entry points are located, several vertices of the rectangular window are inserted at the tail of the vertex set B of the overlapping region, including the following steps: S8410: Let intersection point P1 be edge A i A i+1 The intersection point P2 with the outermost edge of the rectangular window is line segment A. Fd1 A Fd2 As can be seen from step S8220, the intersection point with the InLine edge of the rectangular window is P1, which is the exit point and P2, which is the entry point. From point P1, A... i+1 ,…,A Fd1 P2 forms a temporary polygon OutPoly; S8420: Determine whether each vertex of the rectangular window is within the temporary polygon OutPoly, and determine the relationship between the edges where the out point P1 and the in point P2 are located; S8430: Determine the number of vertices of the rectangular window that need to be added based on the relationship between the edges where the exit point P1 and the entry point P2 are located; S8440: Determine the order of adding vertices based on the order of the vertices of the rectangular window along the four sides of the rectangular window from the exit point P1 to the entry point P2. S8450: Insert several vertices of the rectangular window at the tail of the overlapping region vertex set B, according to the required number of vertices of the rectangular window and the order in which the vertices are added.
4. The method for drawing petroleum geological features according to claim 3, characterized in that, In step S8430, the number of vertices of the rectangular window to be added is determined based on the relationship between the edges containing the exit point P1 and the entry point P2, specifically including: If the Outline edge and the Inline edge are opposite edges, then two vertices need to be added; If the OutLine edge and the InLine edge are adjacent, then one or three vertices need to be added; If the OutLine edge and the InLine edge are the same edge, then zero or four vertices need to be added.
5. The method for drawing petroleum geological elements according to claim 3, characterized in that, In step S8440, specifically: starting from the exit point P1, a path is drawn along the four sides of the rectangular window to the entry point P2; the path that includes the vertices to be added is selected; and the order in which the vertices to be added are determined according to the order in which the path passes through the vertices to be added.