Results 1 to 4 of 4

Math Help - need help "stretching" a line and ending on a specific angle against axis

  1. #1
    Newbie
    Joined
    Jan 2013
    From
    Norway
    Posts
    2

    need help "stretching" a line and ending on a specific angle against axis

    Here's a problem I assumed would be easy, but it has melted my brain for a long time and I am not really sure anymore. So I am using cos and sin to draw round curves in a program (it's okay that it's slow). You specify an x length, y length, and angle1 and angle2 with the axises you want the curve to enter and exit (Some angles won't work obviously). So if you say x = 1, y = 1, angle1 = 45, angle2 = 45, the function just draw a straigth line, however with angle1 = 0 and angle2 = 90, it draw a quarter of a circle. The quarter circle works fine if x = 1 and y = 2 as well, but with different values x and y, I simply stretch everything, so the straigth line of with angles 45 have now instead angle atan(0.5) and atan(2). So my idea was to simply find the angles that turns into the correct angles after the stretching. But I've been trying for a few hours, and every time I thought I got closer to the answer it turns out I just got confused.

    Detail: the function draws a perfect circle using cos(t), sin(t), where t lies in the interval of the angles, before stretching the curve into the right size.
    Follow Math Help Forum on Facebook and Google+

  2. #2
    MHF Contributor ebaines's Avatar
    Joined
    Jun 2008
    From
    Illinois
    Posts
    1,049
    Thanks
    288

    Re: need help "stretching" a line and ending on a specific angle against axis

    I'm a bit confused about what you're trying to accomplish. It seems you are trying to define the arc of a circle that passes through the origin and the point (x,y), with slope defined at the orign and at (x,y) - is that right? if so, you've over-specified the problem. A different way to approach this is to specify the point (x,y) and angle1 and let the program determine angle2. Here's how: first find the center of the circle, which is the intersection of (a) a line from the origin perpendicular to angle1 and (b) a line perpendicular to the midpoint of the chord bwteen the origin and (x,y). Calculate the radius R of this circle. The angle subtended by the arc is then 2 x asin(halfchord-length/R). And angle2 will be angle1 + the angle of the arc.

    need help "stretching" a line and ending on a specific angle against axis-arc.jpg
    Follow Math Help Forum on Facebook and Google+

  3. #3
    Newbie
    Joined
    Jan 2013
    From
    Norway
    Posts
    2

    Re: need help "stretching" a line and ending on a specific angle against axis

    Yes it's a little over specified, I was hoping to make it more clear what I want to do but maybe it just made it harder... I will try to make a simpler example.

    You have a line from origo to some point x,y. The line will make the angle atan(y/x) with the x-axis. So if you alter the x or y value, the angle will change. Now such an alteration is going to take place, say the y value gets quadrupled (dy = 4), and x doubled (dx = 2). Now all that matters for the angle is the ratio between these, d = dy/dx = 2. Your desired angle has a certain ratio of x/y, so you need to find another angle t, which produces the points cos(t) and sin(t), that will produce your desired angle after going through the alteration. (The alteration that happens depends on angle t)
    Follow Math Help Forum on Facebook and Google+

  4. #4
    MHF Contributor ebaines's Avatar
    Joined
    Jun 2008
    From
    Illinois
    Posts
    1,049
    Thanks
    288

    Re: need help "stretching" a line and ending on a specific angle against axis

    I still don't follow. It sounds like you have an original point (x,y), and the angle of the line connecting (x,y) to the origin is Atan(y/x). Now you are going to multiply x by some factor and y by some other factor. You used the terms "dx" and "dy" but I think it is clearer to say that the original x is multipled by a factor A and the original y by a factor B, so the new point is (Ax, By) and the angle from the origin to the new point is t=Atan(By/Ax). At this point I don't understand what the problem is.
    Follow Math Help Forum on Facebook and Google+

Similar Math Help Forum Discussions

  1. Replies: 2
    Last Post: April 24th 2011, 07:01 AM
  2. Replies: 1
    Last Post: October 25th 2010, 04:45 AM
  3. Replies: 1
    Last Post: September 5th 2009, 05:46 PM
  4. "Stretching" an ellipse
    Posted in the Pre-Calculus Forum
    Replies: 8
    Last Post: September 5th 2009, 08:28 AM
  5. Replies: 1
    Last Post: December 12th 2008, 04:34 AM

Search Tags


/mathhelpforum @mathhelpforum