Results 1 to 3 of 3

Thread: Perpendicular Line

  1. #1

    Thread Starter
    Frenzied Member usamaalam's Avatar
    Join Date
    Nov 2002
    Location
    Karachi
    Posts
    1,308

    Perpendicular Line

    Hello,

    I have drawn a line on the VB Form as follows:

    VB Code:
    1. Line (OriginX, OriginY)-(OriginX + WeightX, OriginY - WeightY)

    Where OriginX and OriginY are both zero and WeightX and WeightY are any two values. Now I want to draw a line which is perpendicular to this line on the origin point. For clear viewing, I have shifted the axis to some other point.

    So, my question is how can I find two points to construct a line which is perpendicular to another line whose one point is origin and other point is also known.

    Any help will be appreciated.

    Thanks.

  2. #2
    Fanatic Member sql_lall's Avatar
    Join Date
    Jul 2002
    Location
    Up Above (i.e. AUS)
    Posts
    571

    Talking hmmm

    two lines are perpendicular if they are negative inverses.

    so...after checking for horizontal/vertical lines {You can't invert zero, or infinity, in VB }, do some algebra:

    Slope = (-WeightY)/WeightX
    NewSlope = -1 / Slope (BTW, this is just WeightX/WeightY)

    now draw a line (OriginX, OriginY) - (OriginX + ScaleFactor, OriginY + ScaleFactor * NewSlope)

    where Scale Factor depends on how big you want the line, and in which direction.
    sql_lall

  3. #3
    Fanatic Member alkatran's Avatar
    Join Date
    Apr 2002
    Location
    Canada
    Posts
    860
    No reason to be complexe at all, SQL.

    (originx,originy) to (originx + weight y, originy - weight x)

    Don't pay attention to this signature, it's contradictory.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width