Calculating the endpoint of a straight line, given its startpoint, length and angle

Posted on 2006-03-27
Last Modified: 2008-03-03
I'm presently using automation to draw in Microsoft Visio. I have the startpoint (x0, y0), the length, and the angle with the x-axis (in degrees) of a straight line. How do i calculate the endpoint (x1, y1) ?
Question by:UniqSoft
    LVL 26

    Accepted Solution

    x1 = x0  + length*cos(angle)
    y1 = y0  + length*sin(angle)
    LVL 3

    Expert Comment

    Yes.... d-glitch  is absolutely right..
    x1 = x0  + length*cos(angle)
    y1 = y0  + length*sin(angle)

    All point to  d-glitch as replied first
    LVL 6

    Expert Comment

    in case of cos/sin using radians, need to convert angle from degrees to radians :
    angle = angle*PI/180 (PI=4.13152965)

    Author Comment

    Thanks a bunch

    Featured Post

    Top 6 Sources for Identifying Threat Actor TTPs

    Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

    Join & Write a Comment

    Suggested Solutions

    Title # Comments Views Activity
    Chinese DC fan 33 192
    Random Variable 2 35
    Vertical and Horizontal Shift 4 60
    Access question - internal training 9 35
    A Guide to the PMT, FV, IPMT and PPMT Functions In MS Excel we have the PMT, FV, IPMT and PPMT functions, which do a fantastic job for interest rate calculations.  But what if you don't have Excel ? This article is for programmers looking to re…
    This article seeks to propel the full implementation of geothermal power plants in Mexico as a renewable energy source.
    It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
    This video discusses moving either the default database or any database to a new volume.

    734 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now