ScratchData LogoScratchData
Back to gtoal's profile

Equally spaced fenceposts in perspective

GTgtoal•Created April 28, 2017
Equally spaced fenceposts in perspective
14
8
253 views
View on Scratch

Instructions

I needed a sketch in order to work out some maths. Given each vertical line is indexed by 0, 10, 20, 30, 40... from left to right in world coordinates, what is the formula that determines the distance in pixels from the left edge to that line? Parameters are: width of screen in pixels. Screen X coord of first fencepost. X distance between first and second fenceposts in pixels. height and width of each rectangle in world coordinates. (10x10) Screen X,Y coordinate of horizon. Top and bottom Y coordinates of first fencepost in pixels.

Description

The code is awful, it's just a sketch to help me think about how to implement the general solution. NEXT: https://scratch.mit.edu/projects/158370759/ Eventually for use in a maze or Doom type 3D environment. Is it easier to determine two vanishing points and work with those rather than the usual world coordinate to screen coordinate projective mapping?

Project Details

Project ID157841571
CreatedApril 28, 2017
Last ModifiedAugust 19, 2021
SharedApril 28, 2017
Visibilityvisible
CommentsAllowed