Saturday, June 15, 2019

Ellipse Drawing algorithm

Ellipse Drawing algorithm

In the case of ellipse however symmetry is four rather than 8 way there are two methods of mathematically define ellipse.
1.       Polynomial Method: - with the use of second order polynomial we can define an ellipse as
        (x-h)^2/a^2 + (y-k)^2/b^2 = 1
Where (h,k) is the center of ellipse a is the length of major axis. b is the length of miner axis (x,y) are the coordinates.
        When the polynomial method is used define an ellipse. The value of x is incremented from h to a for each step of x each value of y is found by evaluating the expirations
This method is very efficient because the square of a and (x-h) must be found then floating point division of (x-h)^2 by a^2 and floating point multiplication of the square root of
        1-((x-h)^2/a^2) by b must be perform.

2.       Trigonometric Method: - The following equation define an ellipse trigonometrically
        x= acosθ+h &
        y= bsinθ+k
where x,y are the current coordinates a & b is the length of major and minor axis respectively and θ is the current angle.
The value of θ is varied from 0 to π/2.
The remaining points are found by symmetric.

Also read this Midpoint ellipse theorem

No comments:

Post a Comment