How find End point of line with help of length & Angle
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 9 of 9

Thread: How find End point of line with help of length & Angle

  1. #1
    Join Date
    Sep 2008
    Posts
    69

    How find End point of line with help of length & Angle

    Dear All,

    I know the start point_x ,start point_y , length , angle from this how can i get the end point of the line.

    Is there any way to find end point of the line? If yes means please guide me!......

    With Regards,
    Boopathiraja.N.

    Thanks in advance to all!.

  2. #2
    Join Date
    Mar 2008
    Location
    IRAN
    Posts
    811

    Re: How find End point of line with help of length & Angle

    it is very easy:

    tan(theta) = (y2-y1) / (x2-x1)

    and

    L = sqrt((y2-y1)^2 - (x2-x1)^2)

    solve these two equations in respect to y2 and x2 and find them.

    inorder to code the solution for n-equation with n-variables i suggest that you use Cramer's rule

    see here:

    http://en.wikipedia.org/wiki/Cramer's_rule
    Please rate my post if it was helpful for you.
    C#, C++, PHP, ASP.NET
    SQL Server, MySQL
    DirectX
    MATH
    Touraj Ebrahimi
    [toraj_e] [at] [yahoo] [dot] [com]

  3. #3
    Join Date
    Sep 2008
    Posts
    69

    Re: How find End point of line with help of length & Angle

    Dear toraj,

    i am not familiar on mathmatics so please can you give any solved equation. I am not familiar on the maths, thats why i am asking once again help.

    I hope once again you will guide me!...

    With regards,
    Boopathiraja.N

  4. #4
    Join Date
    Mar 2008
    Location
    IRAN
    Posts
    811

    Re: How find End point of line with help of length & Angle

    would you please wait till tomorrow.
    i will write the code for you tomorrow.

    if i had scanner here then i would scratch the steps for you with figures to help you to understand it.

    but if i write the code for you; you may not understand it.

    would you please tell me how much do you know math(algebra and geometric and trigonometry) then i will the explain obscure parts for you. if you don't understand it at all.....i should paint figures (maybe in paint brush) to demstrate it to you.

    so please wait till tomorrow and till then see here:

    http://images.google.com/images?sour...N&hl=en&tab=wi

    and

    http://en.wikipedia.org/wiki/Trigonometry

    and

    http://images.google.com/images?um=1...eta%29%3Dy%2Fx
    Please rate my post if it was helpful for you.
    C#, C++, PHP, ASP.NET
    SQL Server, MySQL
    DirectX
    MATH
    Touraj Ebrahimi
    [toraj_e] [at] [yahoo] [dot] [com]

  5. #5
    Join Date
    Sep 2008
    Posts
    69

    Re: How find End point of line with help of length & Angle

    Dear toraj,

    I like your attitude & your spirit and also really say lot of thanks for ur help. but i am waiting for your valuable information. once again thanks mr.toraj for your effort.

    With regards,
    Boopathiraja.N.

  6. #6
    Join Date
    Mar 2008
    Location
    IRAN
    Posts
    811

    Re: How find End point of line with help of length & Angle

    hi my friend,

    i contemplated more and found a simpler approach that don't need to solve 2-equations/ 2-variables.

    it is like this:

    assume that:
    L = Length of line
    (x1, y1) = start point
    (x2, y2) = end point
    theta = angle

    then:

    sin(theta) = (y2 - y1) / L
    so: y2 = [L * sin(theta)] + y1

    and

    cos(theta) = (x2 - x1) / L
    so: x2 = [L * cos(theta)] + x1

    so it is very easy to code this one.
    Please rate my post if it was helpful for you.
    C#, C++, PHP, ASP.NET
    SQL Server, MySQL
    DirectX
    MATH
    Touraj Ebrahimi
    [toraj_e] [at] [yahoo] [dot] [com]

  7. #7
    Join Date
    Sep 2008
    Posts
    69

    Re: How find End point of line with help of length & Angle

    Dear Mr.Toraj,

    Mine sincere thanks for ur effort mr.toraj. it is working as too fine.

    [Personal Info About you]

    i don't know now you are in which position, but one day definetly you will achieve your goal fro this no doubt because you are having the good attitude. god will always help to you, i really pray the god to shine your future as bright.

    if i say anything as wrong really sorry.

    Finally this equation working as too fine.

    With Regards,
    Boopathiraja.

    [All prizes to God]

  8. #8
    Join Date
    Mar 2008
    Location
    IRAN
    Posts
    811

    Re: How find End point of line with help of length & Angle

    you are good man.
    it is my pleasure to help you.

    thanks.
    Please rate my post if it was helpful for you.
    C#, C++, PHP, ASP.NET
    SQL Server, MySQL
    DirectX
    MATH
    Touraj Ebrahimi
    [toraj_e] [at] [yahoo] [dot] [com]

  9. #9
    Join Date
    Oct 2011
    Posts
    1

    Re: How find End point of line with help of length & Angle

    Quote Originally Posted by toraj58 View Post
    you are good man.
    it is my pleasure to help you.

    thanks.

    Mr. Toraj and Mr. Boopathiraja,

    Both of yours conversation was very good. Actually i was a techniq to find the same thing which you both discussed and now i am noting the formula given by Toraj.

    Toraj: I am also thanking you for the formula which you posted in this forum. You are really expert in Maths having very Good Attitude and postive approach as Boopathiraja wrote about you.

    Boopathiraja: By your posting only i got to know this techniq from this forum. So Thank You. And I can really find you are Thankfull man. After getting the techniq from Mr. Toraj you didnt finish up in one word of thanks but you wrote your real Wishes and Bless for him. Very Nice !!

    And Finally i thank you both for your time and efforts.

    Wish you both Good Time ahead !!

    Radhakrishnan.

Posting Permissions

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


Azure Activities Information Page

Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center