Algorithm Description:
For parabolic, the most special case is analyzed, that is, the symmetry axis is the y axis, and it passes through the origin point of coordinates. :
As long as such a parabolic line is generated, the general parabola can be translated and rotated by this special case. Because the parabolic in this special case is symmetrical on both sides of the y-axis, it is only necessary to solve the parabolic formation in the first quadrant to obtain a complete image.
So how to get the parabolic in this special case
By the assumption that a point in the first quadrant of the parabola to move from the origin, and over that point A as a parabola tangent, then according to the slope of the tangent line k=1 can be divided into two parts of the quadrant, part of Point a left, the tangent slope is all less than 1, the other part is point A to the right, the tangent slope is all greater
Based on the idea of the previous midpoint generation algorithm, in the left half, each generation can increment the x coordinate by 1, and determine if the Y coordinate increases according to the decision parameters.
Area 1
In the right half, each build increments the Y coordinate by 1 and determines whether the X coordinate increases based on the decision parameters.
Zone 2
The next step is the derivation of the decision parameters:
The parabolic equation is, then the curve equation has two forms:
Zone 1:
At that time: the coordinates of the next point should be selected at this time:
At that time: the coordinates of the next point should be selected at this time:
Zone 2:
At that time: the coordinates of the next point should be selected at this time:
At that time: the coordinates of the next point should be selected at this time:
Detailed code: Computer Graphics-code_1
Build Result:
Computer graphics-midpoint generation algorithm for parabolic line