title: How to create the vision of a 2D camera looking at a 2D world
body: <p>In a 3D world, a camera looking out will create a 2D representation of what it sees, AKA a picture. Looking at a 3D cube would produce this 2D image:</p>
  
  <p><a href="https://i.stack.imgur.com/Y8BaG.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Y8BaG.png" alt="Cube image"></a></p>
  
  <p>However, inside a 2D world, a camera looking out will create a 1D line of pixels that will represent what it sees. </p>
  
  <p>The camera in this scene:</p>
  
  <p><a href="https://i.stack.imgur.com/NT04Q.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/NT04Q.png" alt="Camera in Scene"></a></p>
  
  <p>Would produce this 1D "image":
  <a href="https://i.stack.imgur.com/G9fHM.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/G9fHM.png" alt="1D picture"></a></p>
  
  <p>Think of the camera looking out. It would be unable to see all of the pink shape,  because most of it is obstructed be the red shape. It would only see the part that is unobstructed. Also, objects further away appear smaller.</p>
  
  <p><strong>How can I create the view of a 2D camera looking out at a 2D world, creating a 1D image?</strong></p>
  
  <p>I am looking for a method, preferably in Python, to accomplish this. I am trying to do this for some 2D creatures I am simulating. I want their input to be 1D array that represents their view of the world.</p>