This is part of the Public Health (Control of Disease) Act 1984, sections 33 and 34: Public Conveyances. An interesting discussion regarding this law (and a few others) can be found here.
198-14. Disrobing in public. No person shall disrobe under the boardwalk, on the beach or in any vehicle or truck while such vehicle is parked upon any public street or way or other public place in plain view of the public.