A constant step sampling method for drawing a profile based on CAD contour lines
Patent Information
- Application Number
- CN202210847670.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-07-19
- Publication Date
- 2026-09-29
- Estimated Expiration
- 2042-07-19
AI Technical Summary
但此方法受等高线密度影响,且当直线方向与等高线平行时,精度难以保证
[0026]本发明通过设置步长来确定采样点,而不是通过多段线与等高线交点确定采样点,不受等高线密度或多段线方向是否平行于等高线等因素影响,最终获取的剖面图准确度提高;且可通过步长值大小,来调整剖面图精度。
Smart Images

Figure CN115330962B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to a method for drawing profile maps based on CAD contour lines using a fixed-step sampling method, belonging to the field of surveying and design technology. Background Technology
[0002] In the surveying and design industry, contour maps are a primary output provided by surveying professionals to other disciplines as design input, using contour lines to represent ground undulations and elevations. Subsequent designs such as site design, road design, and power transmission line design all rely on contour maps.
[0003] A topographic profile is a vertical cross-section along a specific line on the Earth's surface, showing the undulations of the terrain along that line. In engineering projects such as highways, railways, and power transmission lines, it serves as the basis for scheme design and earthwork calculations. A common method for drawing profiles is to find the intersection points of the straight line and contour lines, and then draw the profile based on the mileage and elevation of those intersection points. However, this method is affected by the density of contour lines, and its accuracy is difficult to guarantee when the straight line is parallel to the contour lines. Summary of the Invention
[0004] The technical problem to be solved by the present invention is to provide a method for drawing cross-sectional views based on CAD contour lines using a fixed step-size sampling method, which is not affected by the contour line density and provides accurate data support for subsequent applications in the design profession.
[0005] To solve the above-mentioned technical problems, the technical solution adopted by the present invention is as follows:
[0006] A method for drawing profile views based on CAD contour lines using a fixed-step sampling method includes the following steps:
[0007] S1. Determine a polyline L;
[0008] S2. Sample the multi-segment line L at a certain step size to form a set of sampling points;
[0009] S3. Based on the CAD contour lines, calculate the ground elevation of each sampling point in sequence;
[0010] S4. Draw a profile based on the mileage and elevation of the sampling points.
[0011] A further improvement to the technical solution of the present invention is that the sampling point acquisition step in step S2 is as follows:
[0012] S2.1 Determine the sampling step size s;
[0013] S2.2. Using the GetPointAtDist method of CAD polyline, take a point every step s from the start point to the end point of polyline L to form a set of sampling points (including the start point and end point of L).
[0014] A further improvement to the technical solution of the present invention is that the step of calculating the elevation of the sampling points sequentially based on the CAD contour lines in step S3 is as follows:
[0015] S3.1 Determine the sampling point P and radius R of the elevation to be determined. The initial value of R is twice the average spacing of the contour lines.
[0016] S3.2. With P as the center and R as the radius, form a circular region, traverse the contour lines in the CAD, and obtain the set of contour points located inside the circle.
[0017] S3.3. Using the Delauney algorithm, a local terrain triangulation network is constructed using a set of contour points;
[0018] S3.4. Traverse all triangles in the triangulation network and find the triangle containing point P. This step requires determining whether point P is inside a triangle using the equal area method. Let triangle T have vertices P1, P2, and P3. Connect point P to vertices P1, P2, and P3 of triangle T to form new triangles T1, T2, and T3. If the area of T is equal to the sum of the areas of T1, T2, and T3, then P is inside triangle T. If the area of T is less than the sum of the areas of T1, T2, and T3, then P is outside triangle T.
[0019] S3.5 If a triangle containing point P exists in a triangulation network, then establish the equation of the spatial plane containing the triangle based on its vertices and elevations. The spatial plane equation can be calculated using the point normal form and vectors. , Cross product yields the plane normal vector n=(A,B,C). Then, using the point normal form equation... Substitute the coordinates of point P1 to determine the plane equation. ;
[0020] S3.6 Substitute the coordinates x and y of point P into the spatial plane equation to obtain the elevation z value of point P;
[0021] S3.7 If step S3.4 fails to find a triangle enclosing P, then double the radius R, i.e. Return to step S3.2.
[0022] A further improvement of the technical solution of the present invention is that, in order to improve the retrieval efficiency in step S3.2, a square circumscribed in the circle is first constructed. The set of contour lines intersecting with the circular area is quickly obtained through the SelectCrossingWindow method of CAD, thus narrowing the retrieval range. Then, the contour points in the set of contour lines are traversed to determine whether they are located within the circular area, and the set of contour points located within the circle is obtained.
[0023] A further improvement of the technical solution of the present invention is that: in step S3.3, since the z-value of the contour line is not zero, when constructing the triangulation, the z-value of the contour line point is set to 0 so that it is located in the XOY plane.
[0024] A further improvement to the technical solution of this invention is that: in step S3.4, the area of the triangle is calculated using Heron's formula. Let the side lengths of triangle T be a, b, and c, then the area S of the triangle can be obtained using the following formula: Where p is half the perimeter, that is, half of the circumference: .
[0025] The technological advancements achieved by this invention due to the adoption of the above technical solutions are as follows:
[0026] This invention determines sampling points by setting a step size, rather than by the intersection of polylines and contour lines. This method is not affected by factors such as contour line density or whether the polyline direction is parallel to the contour lines, thus improving the accuracy of the obtained profile. Furthermore, the accuracy of the profile can be adjusted by changing the step size. Attached Figure Description
[0027] Figure 1 This is a flowchart of the present invention;
[0028] Figure 2 This is a flowchart of the elevation calculation process of this invention;
[0029] Figure 3 This invention relates to a new triangle diagram formed by point P located inside the triangle.
[0030] Figure 4 This invention relates to a new triangle diagram formed when point P is located outside the triangle. Detailed Implementation
[0031] The present invention will be further described in detail below with reference to embodiments:
[0032] A fixed-step sampling method for drawing profile views based on CAD contour lines, such as... Figure 1 As shown, it includes the following steps:
[0033] S1. Determine a polyline L;
[0034] S2. Sample the multi-segment line L at a certain step size to form a set of sampling points;
[0035] The steps for obtaining sampling points in step S2 are as follows:
[0036] S2.1 Determine the sampling step size s;
[0037] S2.2 Using the GetPointAtDist method of CAD polyline, take a point every step s from the start point to the end point of polyline L to form a set of sampling points (including the start point and end point of L).
[0038] S3. Based on the CAD contour lines, calculate the ground elevation of each sampling point in sequence;
[0039] As attached Figure 2 As shown, the steps in step S3 to calculate the elevation of the sampling points based on the CAD contour lines are as follows:
[0040] S3.1 Determine the sampling point P and radius R of the elevation to be determined. The initial value of R can be twice the average spacing of the contour lines.
[0041] S3.2. With P as the center and R as the radius, form a circular region. Traverse the contour lines in the CAD to obtain the set of contour points located within the circle. In particular, to improve retrieval efficiency, a circumscribed square of the circle can be constructed first. Using the CAD's SelectCrossingWindow method, the set of contour lines that may intersect with the circular region can be quickly obtained to narrow down the retrieval range. Then, the contour points within the set of contour lines can be traversed to determine whether they are located within the circular region.
[0042] S3.3. Using the Delauney algorithm, a local terrain triangulation network is constructed using the set of contour points. In particular, since the z-value of contour lines is not zero, the z-value of contour points should be set to 0 when constructing the triangulation network so that they are located in the XOY plane.
[0043] S3.4. Traverse all triangles in the triangulation network and find the triangle containing point P. Specifically, this step requires determining whether point P is inside a triangle, using the equal area method. Let triangle T be the triangle with vertices P1, P2, and P3. Connect point P to vertices P1, P2, and P3 of triangle T to form new triangles T1, T2, and T3, respectively, as shown in the attached diagram. Figure 3 and attached Figure 4 If the area of triangle T is equal to the sum of the areas of triangles T1, T2, and T3, then triangle P is located inside triangle T; if the area of triangle T is less than the sum of the areas of triangles T1, T2, and T3, then triangle P is located outside triangle T.
[0044] Specifically, Heron's formula is used to calculate the area of a triangle. Let the side lengths of triangle T be a, b, and c. The area S of the triangle can be obtained using the following formula: Where p is half the perimeter (half of the circumference):
[0045] S3.5 If a triangle containing point P exists in a triangulation network, then establish the equation of the spatial plane containing the triangle based on its vertices and elevations. The spatial plane equation can be calculated using the point normal form and vectors. , Cross product yields the plane normal vector n=(A,B,C). Then, using the point normal form equation... Substitute the coordinates of point P1 to determine the plane equation. ;
[0046] S3.6 Substitute the coordinates x and y of point P into the spatial plane equation to obtain the elevation z value of point P.
[0047] S3.7 If step S3.4 fails to find a triangle enclosing P, then double the radius R, i.e. Return to step S3.2.
[0048] S4. Draw a profile based on the mileage and elevation of the sampling points.
Claims
1. A method for drawing cross-sectional views based on CAD contour lines using a fixed-step sampling method, characterized in that: Includes the following steps: S1. Determine a polyline L; S2. Sample the multi-segment line L at a certain step size to form a set of sampling points; S3. Based on the CAD contour lines, calculate the ground elevation of the sampling points sequentially, following these steps: S3.1 Determine the sampling point P and radius R of the elevation to be determined. The initial value of R is twice the average spacing of the contour lines. S3.
2. With P as the center and R as the radius, form a circular region, traverse the contour lines in the CAD, and obtain the set of contour points located inside the circle. S3.
3. Using the Delauney algorithm, a local terrain triangulation network is constructed using a set of contour points; S3.
4. Traverse all triangles in the triangulation network and find the triangle containing point P. This step requires determining whether point P is inside a triangle using the equal area method. Let triangle T have vertices P1, P2, and P3. Connect point P to vertices P1, P2, and P3 of triangle T to form new triangles T1, T2, and T3. If the area of T is equal to the sum of the areas of T1, T2, and T3, then P is inside triangle T. If the area of T is less than the sum of the areas of T1, T2, and T3, then P is outside triangle T. S3.5 If a triangle containing point P exists in the triangulation network, then establish the equation of the spatial plane containing the triangle based on its vertices and elevations; the spatial plane equation is calculated using the point normal form and vectors. , Cross product yields the plane normal vector n=(A,B,C). Then, using the point normal form equation... Substitute the coordinates of point P1 to determine the plane equation. ; S3.6 Substitute the coordinates x and y of point P into the spatial plane equation to obtain the elevation z value of point P; S3.7 If step S3.4 fails to find a triangle enclosing P, then double the radius R, i.e. ; Return to step S3.2; S4. Draw a profile based on the mileage and elevation of the sampling points.
2. The method for drawing cross-sectional views based on CAD contour lines using a fixed-step sampling method according to claim 1, characterized in that: The sampling point acquisition steps in step S2 are as follows: S2.1 Determine the sampling step size s; S2.2 Using the GetPointAtDist method of CAD polyline, take a point every step s from the start point to the end point of polyline L to form a sampling point set, which includes the start point and end point of L.
3. The method for drawing cross-sectional views based on CAD contour lines using a fixed-step sampling method according to claim 2, characterized in that: In step S3.2, to improve retrieval efficiency, a circumscribed square of the circle is first constructed. The SelectCrossingWindow method of CAD is used to quickly obtain the set of contour lines that intersect with the circular area, thus narrowing the retrieval range. Then, the contour points in the set of contour lines are traversed to determine whether they are located within the circular area, and the set of contour points located within the circle is obtained.
4. The method for drawing cross-sectional views based on CAD contour lines using a fixed-step sampling method according to claim 3, characterized in that: In step S3.3, since the z-value of the contour line is not zero, when constructing the triangulation, the z-value of the contour line point is set to 0 so that it is located in the XOY plane.
5. The method for drawing cross-sectional views based on CAD contour lines using a fixed-step sampling method according to claim 4, characterized in that: In step S3.4, the area of the triangle is calculated using Heron's formula. Let the side lengths of triangle T be a, b, and c. The area S of the triangle is obtained using the following formula: Where p is half the perimeter, that is, half of the circumference: 。
Citation Information
Patent Citations
A method for rapidly drawing a section map based on a CAD topographic map
CN109035364A