Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

Geometry/Trig question

  • 13-10-2012 4:34pm
    #1
    Registered Users, Registered Users 2 Posts: 519 ✭✭✭


    Hey guys, I'm banging my head against this one, it seems straight forward but I can't figure it out.

    I have two points (1,1) (4,4) and I draw a line between them. I need to move this line over by x distance while keeping the same slope and get the two points at the new location.
    My first thought was to get the slope of the original line and then negate and inverse it to get a perpendicular line which I could then use to ( and this is where I'm lost) "slide" up and down the original with x distance to determine points.

    Essentially what I'm trying to do is, given the two points, work out another two points x distance away with the same length and slope which would make a rectangle when joined up. I'm dabbling in computer graphics which uses triangles and my idea is to make up the rectangle and then slice it in to two triangles.

    Anyone have any pointers? Thanks


Comments

  • Registered Users, Registered Users 2 Posts: 338 ✭✭ray giraffe


    If you start with vectors [latex]\overrightarrow{a} [/latex]and [latex]\overrightarrow{b}[/latex], what you need are

    [latex]\displaystyle \overrightarrow{a} + x \left(\frac{\overrightarrow{ab}}{|\overrightarrow{ab} |} \right)^\perp [/latex]

    and

    [latex]\displaystyle \overrightarrow{b} + x \left(\frac{\overrightarrow{ab}}{|\overrightarrow{ab} |} \right)^\perp [/latex]

    This might be useful:
    http://devmag.org.za/2009/08/12/vector-fundamentals/


  • Registered Users, Registered Users 2 Posts: 5,141 ✭✭✭Yakuza


    Vectors aren't my strong point (or, more accurately, one of the several things that aren't my strong point!), so I'll approach this from a line geometry point of view.

    As best as I can make out, there is an infinite family of points that will satisfy your requirement to make a rectangle, here's what I'd do to find one of the set of points that make a rectangle from there. (Bear in mind it's late and I've been out on the beer!)

    You have two points, (1,1) and (4,4). Conveniently enough, these fall on the line y = x and the slope between them is 1, so the slope of the lines that make a rectangle with these points is -1 as they will be perpendicular.

    So, what are the equations of the lines perpendicular to the line y=x that run through the points (1,1) and (4,4)?

    They are : y = -x +2 (Line1)and y=-x+8(Line2) (I'm assuming you know about the slope/intercept form of how to define a line - y=mx+c where m is the slope and c the point where the line hits the y-axis).

    What we need to do is then find any point on one of these lines (say Line1 for argument's sake), and find the equation of a line through that point with the same slope as your original line. (Line3)

    Then we need to find the co-ordinates of the point where Line2 and Line3 intersect, and that will give you both points for your rectangle.

    Picking a point on Line1 - I'm going to be lazy here and pick where the line intersects the x-axis (so y=0). From the line equation y=-x+2 this means the point (2,0)

    Now, what is the equation of a line going through (2,0) and with slope 1 (the slope of your original line)?
    from y=mx+c, then this implies it's y=x-2 (Line3)

    So, where do Line2 and Line3 meet? What is the intersection of y=-x+8 and y=x-2?

    x-2 = -x+8 => 2x = 10 => x = 5, y=3.

    So, one set of points to form your rectangle are (1,1),(4,4), (2,0) and (5,3).

    By extension, you can pick any point on Line1, find the equation for a line going through this point parallel to your original line(with slope = 1), and find where it intersects with Line2 to get your other point.

    With that, I'm off to bed, good night!


Advertisement