Circle and ellipse

18
October 6, 2013 1 [email protected]

Transcript of Circle and ellipse

Page 1: Circle and ellipse

October 6, 2013 1

[email protected]

Page 2: Circle and ellipse

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

Page 3: Circle and ellipse

October 6, 2013 3

A Simple Circle Drawing Algorithm

Page 4: Circle and ellipse

October 6, 2013 4

Page 5: Circle and ellipse

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

Page 6: Circle and ellipse

October 6, 2013 6

Parametric Polar Representation

Page 7: Circle and ellipse

October 6, 2013 7

Page 8: Circle and ellipse

October 6, 2013 8

Bresenham’s algorithm for circles

Page 9: Circle and ellipse

October 6, 2013 9

Bresenham’s incremental circle algorithm

Page 10: Circle and ellipse

October 6, 2013 10

Four way symmetry

Page 11: Circle and ellipse

October 6, 2013 11

Eight-Way Symmetry

Page 12: Circle and ellipse

October 6, 2013 12

Mid-Point Circle Algorithm

Page 13: Circle and ellipse

October 6, 2013 13

Page 14: Circle and ellipse

October 6, 2013 14

Page 15: Circle and ellipse

October 6, 2013 15

RULE

If S >0 choose pixel B

Else choose A

Page 16: Circle and ellipse

October 6, 2013 16

Ellipses

Page 17: Circle and ellipse

October 6, 2013 17

Page 18: Circle and ellipse

October 6, 2013 18