debrief / ppt_renderer

Development project to produce body of scripts for manipulating PPT slide
Eclipse Public License 2.0
2 stars 0 forks source link

Handle re-projecting coordinates into rectangle #9

Closed IanMayo closed 6 years ago

IanMayo commented 6 years ago

Our rectangle looks like this: screen shot 2018-06-14 at 16 10 39

So, we have the offset (location) of the top-left corner, plus it's height and width.

We'll have to use these values to shift our coordinates to the right place inside the rectangle.

I think it will be something like this:

function intoRectangle(width, height, x, y, rectX, rectY, rectWid, rectHeight)
{
  newX = rectX +  x * (rectWid / width) 
  newY = rectY + y * (rectHeight / height)
}

Here is a spreadsheet that validates the above algorithm.

IanMayo commented 6 years ago

@purvil12c - to do the re-projection properly our code needs to know the dimensions of the source screen.

The attached GPX file includes a height/width, right at the end.

long_tracks.txt

I'd be grateful if you could switch to using this file.

IanMayo commented 6 years ago

So. To put our track line into the rectangle, we need to do this: