Was apartheid modeled after segregation in the US?

If not, what was it modeled after? Or was segregation modeled after apartheid?

Thanks in advance.

Here’s a pretty good summary of the history of apartheid.

I’d be surprised to learn that the two systems had any connection. The main difference as I see it is that apartheid divided people into three (later four) categories where segregation only saw two. A fine point, but still.