Computer Graphics (ii) OUTPUT elements _6_opengl curve function _5_ Other curves

Source: Internet
Author: User

Other curves

Many of the curve functions are useful in object modeling, animation trajectory description, data and function visualization, and other graphical applications. Common curves include conic, triangular and exponential functions, probability distributions, general-purpose polynomial, and spline functions . The display of these curves can be generated using the circle and ellipse functions similar to those discussed earlier . The position along the curve trajectory can be obtained directly from the expression y =f (x) or the parametric equation. In addition, you can use the incremental midpoint algorithm to draw a curve described with an implicit function f (x, Y) = 0 .

A simple way to display a specified curve function is to use a straight segment to approximate the curve . At this point, you can use a parameter expression for the end position of the equidistant segment along the curve trajectory. You can also select an independent variable by the slope of the curve , and generate an offset position from an explicit expression. If y = f (x) The absolute value of the slope is less than 1, select X as the argument and calculate the Y value for the equal X increment; When the absolute value of the slope is greater than 1 o'clock, use the inverse function x = f-1 (y) and calculate the X value in the same Y step.

Using line or curve approximation , you can diagram a dataset of discrete coordinate points , and we can use line segments to link discrete points together, or use linear regression (least squares) to fit a dataset through a single line . The nonlinear least squares method is used to display data groups with certain fitted functions (usually polynomial).

Like circles and ellipses, many functions have symmetry , which reduces the computational amount of the coordinate position on the curve trajectory. For example, a normal distribution function about a central position (mean) is symmetric, and all points along a loop in a sinusoidal curve can be generated from points within a 90° interval .

Conic

In general, we can use two equations to describe conic sections (conic section):

where the values of the parameters A, B, C, D, E, and F determine the type of curve to be displayed. Given this set of coefficients, you can determine the specific conic you want to generate by evaluating the B2 = -4ac:

For example, when a = B = 1, c=0, D = -2xc, E=-2yc, and f=x2c+y2c-r2, the circle equation (3.26) is obtained . the equation (3.52) can also describe degenerate conic sections: points and lines.

in some applications, arcs and elliptical arcs can be conveniently represented by starting and ending angles, as shown in 3.29. These arcs are also defined using their endpoint coordinate positions. In both cases, we can use the modified midpoint method to generate arcs, or to display a set of approximation straight segments.

ellipses, hyperbola, and parabola have unique uses in some animation applications. These curves describe the orbits and other motions of objects subjected to Earth's gravity, electromagnetic fields, and atomic forces. For example: The plane trajectory of the solar system is an ellipse, and an object that enters a uniform sphere's gravitational field moves along the parabolic trajectory. For the gravitational field with negative y-direction, figure 3.30 shows the trajectory of the parabolic line in the standard position . The parabolic trajectory equation for the display object can be written as:


constants A and B are determined by the initial velocity v0 of the object and the acceleration g induced by the uniform gravitational force. We can also use the time parameter T, measured in seconds , to describe the parabolic trajectory based on the parametric equation of the initial launch point:

where vx0 and vy0 are the initial velocity components, the value of G is about 980 cm/s2 on the Earth's surface. The position of the object along the parabolic trajectory can be calculated according to the selected time step.

The hyperbolic motion (see Figure 3.31) takes place in relation to the collision of charged particles and some gravitational problems . For example, the movement of a comet or meteorite around the sun is along a hyperbolic trajectory and escapes into outer space and never returns. The specific branch that describes the motion of the object (the left or right curve in Figure 3.31) depends on the force involved in the problem. We can write the standard equation for the hyperbolic (center-to-origin) in Figure 3.31 as

for the left branch, X =<-rx; for the right branch, X>=rx. Since this equation differs from the standard elliptic equation (3.39) only in the notation of the x2 and y2 items, only minor changes to the ellipse algorithm can produce points on the hyperbolic trajectory.

Parabolic and hyperbolic curves have a pair of shafts. For example, the parabola described by equation (3.55) is symmetric about the following axes:

the method in the midpoint ellipse algorithm can be directly used in the following two regions to obtain parabolic and hyperbolic trajectory on the axis of the symmetry side of the points:

(1) The absolute value of the curve slope is less than 1;

(2) The absolute value of the slope of the curve is greater than 1. To do this, first select the appropriate form of the equation (3.52) and then use the selected function to create an expression of the decision parameters in two regions.

Polynomial and spline curves

The n-th polygon function of x can be defined as

where n is a nonnegative integer, AK is constant and an! = 0, when n = 2 o'clock gets two curves, n = 3 o'clock is three polynomial, n = 4 The time is four curves, and so on; when n = 1 o'clock gets a straight line. Polynomial is used in many graphic applications, including object shape design, animation trajectory determination, and graphical data trending in discrete data point sets.

in the design of an object shape or motion trajectory, it is common to define a approximate curve profile by specifying a small number of points and then use polynomial to fit the selected point. One way to fit a curve is to construct a three-time polynomial curve segment between each pair of specified points, and each curved segment can be described by Parameter form:

where the parameter u changes between 0 and 1.0. The coefficient value of u in the parametric equation is determined by the boundary condition of the curve segment. One of the boundary conditions is that two adjacent curved segments have a common endpoint, and the other condition is to match the slope of the two curves on the boundary to obtain a continuous smoothing curve (see figure 3.32). The continuous curve formed by using a polynomial curve segment is called a spline (spline curve), referred to as a spline . There are many other ways to create splines, and in the 8th chapter we will look at a variety of spline generation methods.

Computer Graphics (ii) OUTPUT elements _6_opengl curve function _5_ Other curves

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.