Stumped by a problem that would have been easy for me in high school.

Yep. My skills are far deteriorated, so much so that the problem I'm about to describe I'd have cringed at needed help with way back when. Anyways.....

Suppose I have a rectangle, $w wide and $h tall. Consider the diagonals going from top-left to bottom-right and from bottom-left to top-right. I will be cycling through each pixel, and I want to figure out for each one what is the distance from that pixel to the nearer diagonal.

I've tried to work it out on paper but ended up getting frustrated twice.

Re: Stumped by a problem that would have been easy for me in high school.

Re: Stumped by a problem that would have been easy for me in high school.

Hello, KeeganT!

Suppose I have a rectangle, $w$ wide and $h$ tall.
Consider the diagonals going from top-left to bottom-right and from bottom-left to top-right.
I will be cycling through each pixel, and I want to figure out for each one
what is the distance from that pixel to the nearer diagonal.