Tracing centre-lines of digital patterns using maximal-square and maximal-circle algorithms