Results 1 to 9 of 9

Math Help - Goniometry problem

  1. #1
    Newbie
    Joined
    Jul 2010
    Posts
    3

    Goniometry problem

    Hi,

    I'm stuck with the following problem.

    I have a 2D grid of size 600x600.
    If I draw a line from a specific point (say 250,400) in a specific direction (say 100 degrees), I want to calculate on which point this line will cross the border of the grid.

    I've been struggling with tangens and more of this stuff, but I can't seem to find the right formula... Hopefully someone can help me :-)

    (if it's not possible with one formula, that's no problem, multiple formulas are okay too)

    Thanks in advance!
    Follow Math Help Forum on Facebook and Google+

  2. #2
    MHF Contributor
    Joined
    Dec 2007
    From
    Ottawa, Canada
    Posts
    3,069
    Thanks
    65
    What's Goniometry ?

    Start with graph paper, and a manageable 10 by 10 grid.
    Place a corner of grid at origin, 2 sides of grid being x-axis and y-axis.
    Take point (2,3); that point is 8 from right side of grid, 7 from top side: see that?

    Walk (or draw line) from (2,3) going north-east at 40 degrees:
    can you "see" a right triangle with angles 90-50-40?
    Carry on...
    Follow Math Help Forum on Facebook and Google+

  3. #3
    Newbie
    Joined
    Jul 2010
    Posts
    3
    Yes I know how to calculate it from one point.
    Thing is, I need to be able to calculate it from every single point and every direction.

    Problem is: it can cross the border at the top, right, bottom and left side. That's where I get stuck.


    (in Dutch "goniometrie" is calculation of triangles, sinus, cosinus, etc. I thought in English it would be "goniometry" but apparantly not ;-)
    Follow Math Help Forum on Facebook and Google+

  4. #4
    MHF Contributor
    Joined
    Dec 2007
    From
    Ottawa, Canada
    Posts
    3,069
    Thanks
    65
    In English, it's got just as silly a name: trigonometry!

    So what you have is, if put simply:
    1: a square : A(0,k), B(k,k), C(k,0) and D(0,0)
    2: a point : P(x,y) INSIDE ABCD, so k > x > 0 and k > y > 0
    3: a straight line from P to another point Q(a,b) on AB or BC or CD or DA
    4: Q's coordinates are (depending on GIVEN angle):
    if on AB: (a,k) ; if on BC: (k,b) ; if on CD: (a,0) ; if on DA: (0,b)

    On the GIVEN angle:
    1: trivial case: if 0, then Q(k,y); if 90, then Q(x,k); if 180, then Q(0,y); if 270, then Q(x,0)
    2: similarly, if P(k/2,k/2), angles 45, 135, 225 and 315 will hit corners of square ABCD

    Let us know IF that's what you mean; I think it is...
    Last edited by Wilmer; July 6th 2010 at 08:40 AM.
    Follow Math Help Forum on Facebook and Google+

  5. #5
    Newbie
    Joined
    Jul 2010
    Posts
    3
    I'm not sure that's exactly what I mean.

    What I have is:
    1: a square : A(0,0), B(600,0), C(600,600), D(0,600)
    2: a point : P(x,y) inside ABCD, so 600 > x > 0 and 600 > y > 0
    3: an angle

    I want to calculate point Q, which is on AB, BC, CD or DA or one of the corners.

    What you say about these angles 45, 135, 225 and 315, they will only hit the corners if P = 300,300. But on other points they won't.
    Follow Math Help Forum on Facebook and Google+

  6. #6
    MHF Contributor undefined's Avatar
    Joined
    Mar 2010
    From
    Chicago
    Posts
    2,340
    Awards
    1
    Quote Originally Posted by mrfreeze View Post
    I'm not sure that's exactly what I mean.

    What I have is:
    1: a square : A(0,0), B(600,0), C(600,600), D(0,600)
    2: a point : P(x,y) inside ABCD, so 600 > x > 0 and 600 > y > 0
    3: an angle

    I want to calculate point Q, which is on AB, BC, CD or DA or one of the corners.

    What you say about these angles 45, 135, 225 and 315, they will only hit the corners if P = 300,300. But on other points they won't.
    So I assume the angle is \displaystyle0 \le \theta < 2\pi such that 0 means due east, \displaystyle\frac{\pi}{2} means due north, etc.

    For any point P(x,y), you can calculate the angle to get to each of the four corners using arctangent. Then you will be able to tell from your angle where Q is: on one of the four corners, or on exactly one of the four sides of the square (you will know which corner or side). If Q is on exactly one of the four sides, use the point-slope equation for the line PQ (use tangent to get the slope) and either set y=600, y=0, x=0, or x=600. If the angle is \displaystyle\frac{\pi}{2} or \displaystyle\frac{3\pi}{2}, you can't use point-slope because slope is not defined, but it will be trivial.

    EDIT: I see the original post mentions degrees rather than radians. It is simple enough to convert between them.
    Last edited by undefined; July 7th 2010 at 08:51 AM.
    Follow Math Help Forum on Facebook and Google+

  7. #7
    MHF Contributor
    Joined
    Dec 2007
    From
    Ottawa, Canada
    Posts
    3,069
    Thanks
    65
    Quote Originally Posted by mrfreeze View Post
    What I have is:
    1: a square : A(0,0), B(600,0), C(600,600), D(0,600)
    2: a point : P(x,y) inside ABCD, so 600 > x > 0 and 600 > y > 0
    3: an angle
    I want to calculate point Q, which is on AB, BC, CD or DA or one of the corners.
    What you say about these angles 45, 135, 225 and 315, they will only hit the corners if P = 300,300. But on other points they won't.
    You're correct; I forgot to specify point P has to have coordinates (k/2, k/2); correction EDITED.

    So what I've done is simply replace your 600 with k: to make it general.
    You have: a square : A(0,0), B(600,0), C(600,600), D(0,600)
    I made it : a square : A(0,0), B(k,0), C(k,k), D(0,k) ; I had D at (0,0) but that's unimportant.


    Are you in agreement with my previous post now?
    Follow Math Help Forum on Facebook and Google+

  8. #8
    Super Member
    Joined
    Nov 2007
    From
    Trumbull Ct
    Posts
    888
    Thanks
    25
    Hi mrfreeze,

    This statement is clear. you must define the angles. Are these the angles created by rotating a clock hand counter clockwise. I assume they are. You can define the slope and the line by drawing the appropriate slope diagram and using tangent property



    bjh
    Follow Math Help Forum on Facebook and Google+

  9. #9
    MHF Contributor
    Joined
    Dec 2007
    From
    Ottawa, Canada
    Posts
    3,069
    Thanks
    65
    Quote Originally Posted by mrfreeze View Post
    If I draw a line from a specific point (say 250,400) in a specific direction (say 100 degrees).......
    As bjhopper told you, "100 degrees" would mean 80 degrees heading North West; got that?

    Similarly, "220 degrees" would mean 40 degrees heading South West.
    "280 degrees" = 80 heading South East.
    Follow Math Help Forum on Facebook and Google+

Search Tags


/mathhelpforum @mathhelpforum