Circle and ellipse

Post on 21-May-2015

637 views 1 download

Tags:

Transcript of Circle and ellipse

October 6, 2013 1

comp_dep_educ@yahoo.com

October 6, 2013 2

A Simple Circle Drawing Algorithm

Parametric Polar Representation

Bresenham’s algorithm for circles

Bresenham’s incremental circle algorithm

Four way symmetry

Eight-Way Symmetry

Mid-Point Circle Algorithm

Ellipses

October 6, 2013 3

A Simple Circle Drawing Algorithm

October 6, 2013 4

October 6, 2013 5

However, unsurprisingly this is not a brilliant solution!

Firstly, the resulting circle has large gaps where the slope

approaches the vertical

Secondly, the calculations are not very efficient

The square (multiply) operations

The square root operation – try really hard to avoid these!

We need a more efficient, more accurate solution

October 6, 2013 6

Parametric Polar Representation

October 6, 2013 7

October 6, 2013 8

Bresenham’s algorithm for circles

October 6, 2013 9

Bresenham’s incremental circle algorithm

October 6, 2013 10

Four way symmetry

October 6, 2013 11

Eight-Way Symmetry

October 6, 2013 12

Mid-Point Circle Algorithm

October 6, 2013 13

October 6, 2013 14

October 6, 2013 15

RULE

If S >0 choose pixel B

Else choose A

October 6, 2013 16

Ellipses

October 6, 2013 17

October 6, 2013 18