For negative potential the diode becomes reverse biased whereas for positive potential diode is forward biased.
For Vi<0
the diode is reverse biased and hence offer infinite resistance, so circuit would be like as shown in Fig. (2) and V0=0.
For Vi>0, the diode is forward biased and circuit would be as shown in Fig. (3) and V0=Vi