Results 1 to 5 of 5
Like Tree2Thanks
  • 1 Post By Prove It
  • 1 Post By Soroban

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

  1. #1
    Newbie
    Joined
    Jun 2014
    From
    Gilbert, AZ
    Posts
    2

    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.

    Can anyone help?

    THX
    KeeganT
    Follow Math Help Forum on Facebook and Google+

  2. #2
    MHF Contributor
    Prove It's Avatar
    Joined
    Aug 2008
    Posts
    11,513
    Thanks
    1404

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

    I've noticed you have marked this as solved. Would you like to post your solution? Someone who has a similar problem might find it useful...
    Thanks from topsquark
    Follow Math Help Forum on Facebook and Google+

  3. #3
    Newbie
    Joined
    Jun 2014
    From
    Gilbert, AZ
    Posts
    2

    Oops, didn't mean to mark it Solved.

    Yeah, I'm still looking for a solution.

    KeeganT
    Follow Math Help Forum on Facebook and Google+

  4. #4
    Forum Admin topsquark's Avatar
    Joined
    Jan 2006
    From
    Wellsville, NY
    Posts
    9,901
    Thanks
    329
    Awards
    1

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

    FYI: I have removed the "Solved" tag.

    -Dan
    Follow Math Help Forum on Facebook and Google+

  5. #5
    Super Member

    Joined
    May 2006
    From
    Lexington, MA (USA)
    Posts
    11,713
    Thanks
    632

    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.

    I placed the rectangle on a coordinate system.
    Code:
       (-w/2,h/2)       |        (w/2,h/2)
          B * - - - - - + - - - - - * A
            |   .       |       .   |
            |       .   |   .       |
        - - + - - - - - + - - - - - + - -
            |       .   |   .       |
            |   .       |       .   |
          C * - - - - - + - - - - - * D
       (-w/2,-h/2)      |       (w/2,-h/2)
                        |
    Diagonal $AC$ has the equation: $\; y = \tfrac{h}{w}x \quad\Rightarrow\quad hx - wy \:=\:0$

    Diagonal $BD$ has the equation: $\;y = \text{-}\tfrac{h}{w}x \quad\Rightarrow\quad hx + wy \:=\:0$

    If the point $P(x_1,y_1)$ is in Quadrant 1 or 3, it is closer to $AC.$
    The distance is: $\;d \:=\:\dfrac{|hx_1 - wy_1|}{\sqrt{h^2+w^2}} $

    If the point $P(x_1,y_1)$ is in Quadrant 2 or 4, it is closer to $BD.$
    The distance is: $\:d \:=\:\dfrac{|hx_1+wy_1|}{\sqrt{h^2+w^2}}$

    I hope this helps.
    Thanks from topsquark
    Follow Math Help Forum on Facebook and Google+

Similar Math Help Forum Discussions

  1. High School Maths problem Sum
    Posted in the Math Challenge Problems Forum
    Replies: 2
    Last Post: July 13th 2012, 07:48 AM
  2. high school algebra problem
    Posted in the Algebra Forum
    Replies: 3
    Last Post: March 14th 2010, 05:53 PM
  3. Replies: 2
    Last Post: October 13th 2009, 12:46 PM
  4. High school Combination problem help?
    Posted in the Statistics Forum
    Replies: 2
    Last Post: March 11th 2009, 09:37 PM
  5. Replies: 1
    Last Post: December 8th 2008, 06:25 PM

Search Tags


/mathhelpforum @mathhelpforum