Demo of base spline and base Spline in GDI +

Source: Internet
Author: User
Document directory
  • Physical and mathematical Splines

[MSDN] Base Spline in GDI +

A base spline is a series of individual curves that are connected to form a large curve. A Spline is specified by an array of points and a tension parameter. The base spline smoothly passes through each point in the array; there is no sharp angle or sudden change in the steep degree of the curve. The following illustration shows the base splines of a group of points and each point passing through this group of points.

Physical and mathematical Splines

A physical spline is a piece of wood or other elastic material. Before the appearance of a mathematical spline, the designer draws a curve using a physical spline. The designer places the spline on a piece of paper and anchors it to a group of given points. Then, the designer can use a pen to draw a curve along the spline. A group of given points can generate various curves, depending on the attributes of the physical spline. For example, a spline that is not easy to bend is different from a curve produced by a very elastic spline.

The mathematical spline formula is based on the attributes of an Elastic Rod. Therefore, the curves produced by mathematical splines are the same as those generated by physical splines. Just as physical splines of Different Tension generate different curves through a set of given points, mathematical splines with different tension parameter values generate different curves at a group of given points. The following illustration shows the four base splines passing through the same group of points. Each spline shows tension. 0 tension is equivalent to infinite physical tension, to force the curve to take the shortest path (straight line) between the point and the point ). 1 corresponds to no physical tension, so that the spline adopts the minimum and full bending path. A curve with a tension value greater than 1 is like a compressed spring, which is squashed using a long path.

The four Splines in the preceding illustration share the same tangent at the starting point. This tangent is a line drawn from the starting point to the next point along the curve. Similarly, the tangent shared at the end point is a line drawn from the end point to the point above the curve.

To draw a base spline, you need an instance of the Graphics class, a Pen, and an array of Point objects.GraphicsClass instance provides the DrawCurve Method for drawing splines, whilePenStores attributes of splines (such as linewidth and color ).PointThe point where the object array stores the curve. The following code example demonstrates how to drawMyPointArrayThe base spline of the vertex in. The third parameter is tension.

[Demo]

Recently, we have a project that displays congestion conditions of traffic lines based on the real-time data collected by traffic sensors. We need to use straight lines, text, and curves. We have done this demo to understand the curves;

I hope you can explain it to me.TensionNo explanation found

Curve source code

Technorati label: Base spline, curve, tension

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.