Spooky Sale: 10% off Premium yearly · $118.80 for the first year · until Nov 6Get it

Deep-ML
Learn
Problems1,200+ hands-on ML problemsLearning PathA guided route through the fundamentalsLabsInteractive labs on real techniquesProjectsBuild a GPT, an RL agent, CUDA kernelsCollectionsCurated problem sets and videosMathPen-and-paper math for MLIntuitionInvent the idea behind the formula yourselfPlaylistsYour own problem lists, shareableStudy AssistantAn AI teacher that knows your progress
Interview Prep
Compete
ContestsFresh problem sets, ranked liveLeaderboardWhere you stand, globallyBuddiesSolve with a friend: streaks, a weekly board, chat
Discuss
Deep-Path
Premium
      Intuition
      85 of 114

      Far looks smaller

      A camera sees the world through a pinhole. Think of its photo as a window f pixels in front of the pinhole: a point lands on the photo where the straight line from it to the pinhole crosses that window. Write project(side, ahead, f): a point side metres right of the camera’s middle line and ahead metres in front of it lands how many pixels right of the photo’s middle? Left is negative.

      A camera at the end of an avenue of trees, all the same size. The obvious idea, every tree on one side landing on one spot, sees only the near tree. Each tree lands where its line to the pinhole crosses the photo. The goal is a photo like the one it ends on. Your project says where on the photo a point lands.

      A camera at the end of an avenue, seen from above. Every tree is the same size.from above4 m8 m16 mcamerathe photo
      Your functionproject(side, ahead, f)
      sidehow far right of the camera's middle line the point is, in metres (left is negative)e.g. 2
      aheadhow far in front of the camera the point is, in metrese.g. 4
      fhow far the photo is from the pinhole (the focal length), in pixelse.g. 400
      returnswhere the point lands on the photo: pixels right of the photo's middle (left is negative)
      solution.pyLoading Python
      Sign in for an AI hint
      ← Output sizeHow far is it? →