How to automatically draw contour lines (contour lines) based on discrete points: Triangle Method Introduction, contour lines

Source: Internet
Author: User

How to automatically draw contour lines (contour lines) based on discrete points: Triangle Method Introduction, contour lines

The automatic contour drawing method can be divided into two categories: Interpolation and curve fitting. in general, the effect of curve fitting is not as good as that of the classic and widely used interpolation algorithms, and the effect is also inferior. this section focuses on interpolation algorithms.

In the interpolation algorithm, discrete points are classified into objective points and triangular networks based on different methods. the difference between the two lies in that the calculation of the triangular network is mainly in the process of generating the triangular network, eliminating the process of interpolation to the grid point. the objective analysis process is to analyze discrete points into the grid points and insert them into the fine grid. Then, most of them use the tracing method to generate contour lines, and also use curve fitting here.

1. Triangle Algorithm

A. First, generate a AdaBoost triangle. In my post, you can refer to the inner source program of "UI, UI, and UI.

B. Then, we need to interpolation the equivalent points on the side of the triangle. To determine whether the edge of a triangle has an equivalent point, you need to judge and process it. Note: If a raw data point and contour value are the same, change the value to a trace. If the values of Three triangle vertices are the same, the edges have no equivalent points. If the Z values (Za and Zb) of the points (A and B) at either side of A triangle meet the conditions (Zd-Za) * (Zd-Zb) <0, zd represents the value of the contour, And the edge must have an equivalent point. Its plane position is Xd = Xa + (Xb-Xa) * (Zd-Za)/(Zd-Za ), yd = Ya + (Yb-Ya) * (Zd-Za)/(Zb-Za ). Each triangle cannot have an equivalent point of the same value on the three sides, and the other side must have an equivalent point of the same value.

C. Tracking of equivalent points.

In order to track and arrange the inserted isote points in sequence and draw the isote line, we must also find the plane location relationship between the isote points calculated in the overlapped ring-shaped network. Since each ring net is composed of multiple triangles, we will analyze the situation of equi-points in a single triangle. Because it is unnecessary to consider that the contour line passes through the endpoint, if there is an equivalent point on the side of a triangle, there may only be an equivalent point on one or two sides, but not both sides. That is to say, as long as one side of a triangle has an equivalent point, one side of the other two sides must have an equivalent point.
According to the above conventions, we will study several possible situations when the contour line passes through two or more adjacent edges in any ring network:
① The contour does not pass through the border edge of the ring-shaped network. In this ring network, all sides of the path must have equivalent points. If the ring network is composed of Non-boundary points, the interpolation equivalent points can be sequentially connected to a closed curve (Figure 5 (a). If the ring network is formed by a boundary point, then these equivalent points are connected into an open curve (Figure 5 (B )).
② The contour line passes through the border edge of the ring-shaped network, and the number of times cannot exceed two. This is the most common case, as shown in 5 (c) and 5 (d. The equivalent points of Interpolation on the edge of the adjacent diameter are arranged sequentially. The points must be at least two. The starting point is the entry point of the Ring Network and the ending point is the outlet point of the Ring Network.
③ The contour line passes through the border edge of the ring-shaped network four times. The equivalent points of interpolation in the ring network are arranged in two parts in sequence. Each part includes an entry point and an exit point. The position of the network should be the saddle of the terrain.

As discrete points are networked along the same direction (counterclockwise), the equivalent points interpolated on the adjacent edge of the ring network are arranged in a sequence that rotates around the center point counterclockwise. From the graph analysis, we also noticed that if the equivalent point is not on the boundary, then the entry point of a ring network must be the entry point of another ring network; the outlet point of a ring network must also be the outlet point of another ring network. The two endpoints of the diameter edge of the interpolation entry point (or exit point) are the centers connecting the two ring networks. With this principle, we can successfully design the contour tracing Scheme. When tracing the contour, we only need to perform one-way comparison of the equivalent points interpolated in each ring network, that is, compare the entry point and the exit point. After the network connection is over, any discrete point that fails to form a closed ring-shaped network is the border point of the drawing area, and the equivalent point that is interpolated on the edge connecting the two border points is the line head of the open curve. After finding the line header, based on the above principle, we can track all the equivalent points of each open curve in sequence. For a closed curve, the starting point in the interpolation equivalent point in any ring network can be used as the line header. Follow the above method until it returns to the point. After contour tracing is completed, smooth curve output can be performed. Currently, splines are commonly used. There are many examples in this regard, so we will not detail them in detail.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.