1st photo: with the use of nul barrier and the scenery fences. The animals appear to not be able to pass the rock, so you can place the fences outside the habitat without having the risk of animals getting out of bounds.
2nd photo: Just by placing them in a building grid and adding walls around.
(These photo's are not mine, just helping a bit)