Kane Williamson equalled the New Zealand record for Test centuries on day three of the third Test against South Africa.