Interpolation technology Bezier interpolation (1)--Bezier Curve

Source: Internet
Author: User

I_dovelemon

Source: CSDN

Date: 2015/7/11

Subject: Interpolate,bezier Curve


Introductionin the game development, such as animation system, path calculation and so on, will encounter the value of interpolation problems. From today onwards, we will continue to introduce to you what is interpolation technology? And what interpolation techniques are often used in the development of computer video games. The interpolation technique (Interpolate technology) is a technical solution for smoothing transitions between two values in a mathematically calculated way. Such techniques can be used in game content such as animation systems. Take the animation system for example, today's animation system is mostly popular one based on key-frame animation. In some animation software, such as Flash, the artist makes a key frame of the animation and then exports the animation to a file. This file only holds the key moving parts of each animation. Then, when we use it in the game, we need to add a program to complement the frame state data between each of the two keyframes. This technique, which constructs the median value by two values, is called the interpolation technique. This article will show you one of the frequently used interpolation techniques of mathematical techniques. Its practical application will be presented to you in the following chapters.

Bézier CurveBézier Curve, which is a Bezier curve. It is a generic term for some curve geometries. In this article, will show you three kinds of Bézier Curve, respectively, linear Bézier Curve, quadratic Bézier Curve, Cubic Bézier curv. These three Bezier curve are commonly used curves, and are one-time curves, two curves, and three curves respectively. Other higher-dimensional curves will no longer be described. For a detailed explanation of the Bezier Curve, you can look at this wiki:bezier Curve.
Linear Bezier Curvea Bezier Curve, known as the linear Bézier Curve, actually refers to a straight line and does not have any curvature. Therefore, using a Bezier curve interpolation technique, also known as the value linear interpolating (linear interpolation). Linear interpolation technology is widely used, in addition to the use of animation systems, in the 3D graphics in the rasterization phase is also used for vertex data and texture data interpolation calculation. The formula for linear interpolation is given below:B (t) = P0 + (p1-p0) * t [0<=t <= 1] (1)the T in the above formula represents a moment between P0 and P1, and B (t) is the state of the curve at this time. Because it's a straight line, it's easy to understand.

quadratic Bezier CurveThe formula for two curves is deduced on the basis of a single curve, and the mathematical deduction can be found in the wiki above, where the formula is given directly:B (t) = (1-T) ^2 * p0 + 2 * (1-t) * t * p1 + t^2 * P2 (2)

Cubic Bezier Curvethe formula for the three-time curve is as follows:B (t) = (1-T) ^3 * p0 + 3 * (1-t) ^2 * t * p1 + 3 * (1-t) * t^2 * p2 + t^3 * P3 (3)

drawing Bézier CurveThe following code shows how to draw the linear bezier,quadratic Bézier and cubic Bézier. The code uses JavaScript to write:
<span style= "Font-family:microsoft Yahei;" >


Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

Interpolation technology Bezier interpolation (1)--Bezier Curve

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.