  We study the effects of extended and localized potentials and a magnetic
field on the Dirac electrons residing at the surface of a three-dimensional
topological insulator. We use a lattice model to numerically study the various
states; we show how the potentials can be chosen in a way which effectively
avoids the problem of fermion doubling on a lattice. We show that extended
potentials of different shapes can give rise to states which propagate freely
along the potential but decay exponentially away from it. For an infinitely
long potential barrier, the dispersion and spin structure of these states are
unusual and these can be varied continuously by changing the barrier strength.
In the presence of a magnetic field applied perpendicular to the surface, these
states become separated from the gapless surface states by a gap, thereby
giving rise to a quasi-one-dimensional system. Similarly, a magnetic field
along with a localized potential can give rise to exponentially localized
states which are separated from the surface states by a gap and thereby form a
zero-dimensional system. Finally, we show that a long barrier and an impurity
potential can produce bound states which are localized at the impurity, and an
"L"-shaped potential can have both bound states at the corner of the "L" and
extended states which travel along the arms of the potential.
