Results 1 to 6 of 6
Like Tree1Thanks
  • 1 Post By SlipEternal

Thread: Calculate third point from 2 points and an angle

  1. #1
    Newbie
    Joined
    Feb 2018
    From
    Bahia
    Posts
    2

    Calculate third point from 2 points and an angle

    I'm having a hard time putting together a formula. I have 2 points (x0, y0) and (x1, y1) and an angle (k).
    Using this information I need to calculate a third point that is k degrees from the previous 2 points.
    Calculate third point from 2 points and an angle-problema_code.png
    Is it possible to do that? Thank you for your attention.
    Follow Math Help Forum on Facebook and Google+

  2. #2
    MHF Contributor

    Joined
    Apr 2005
    Posts
    19,924
    Thanks
    3098

    Re: Calculate third point from 2 points and an angle

    Every point on the line through $(x_0, y_0)$ and your "C" satisfy that condition. Don't you have more information, like the distance from C to either of the given points?
    Follow Math Help Forum on Facebook and Google+

  3. #3
    MHF Contributor
    Joined
    Nov 2010
    Posts
    3,631
    Thanks
    1457

    Re: Calculate third point from 2 points and an angle

    I would use linear algebra for this. Turn the two points you have into a vector:

    $(x_1-x_0)\hat{i}+(y_1-y_0)\hat{j} = \begin{pmatrix}x_1-x_0 \\ y_1-y_0\end{pmatrix}$

    Next, multiply by the rotational matrix:

    $\begin{pmatrix}\cos k & -\sin k \\ \sin k & \cos k\end{pmatrix}$

    So, you have:

    $\begin{align*}c & = \begin{pmatrix}x_0 \\ y_0\end{pmatrix} + \begin{pmatrix}\cos k & -\sin k \\ \sin k & \cos k\end{pmatrix}\begin{pmatrix}x_1 - x_0 \\ y_1-y_0\end{pmatrix} \\ & = \begin{pmatrix}x_0 + (x_1-x_0)\cos k-(y_1-y_0) \sin k \\ y_0 + (x_1-x_0) \sin k + (y_1-y_0)\cos k\end{pmatrix}\end{align*}$
    Thanks from HallsofIvy
    Follow Math Help Forum on Facebook and Google+

  4. #4
    MHF Contributor

    Joined
    Apr 2005
    Posts
    19,924
    Thanks
    3098

    Re: Calculate third point from 2 points and an angle

    That assumes that the distance from $(x_0, y_0)$ to C is the same as the distance from $(x_0, y_0)$ to $(x_1, y_1)$ which was probably what was intended but was not actually said in the first post.
    Last edited by HallsofIvy; Feb 28th 2018 at 07:02 AM.
    Follow Math Help Forum on Facebook and Google+

  5. #5
    MHF Contributor
    Joined
    Nov 2010
    Posts
    3,631
    Thanks
    1457

    Re: Calculate third point from 2 points and an angle

    Quote Originally Posted by HallsofIvy View Post
    That assumes that the distance from $(x_0, y_0)$ to C is the same as the distance from $(x_0, y_0)$ to $(x_1, y_1)$ which was probably what was intended but was not actually said in the first post.
    Very true. You can multiply the rotation matrix by a sizing scalar to obtain any point along the new vector.
    Follow Math Help Forum on Facebook and Google+

  6. #6
    Newbie
    Joined
    Feb 2018
    From
    Bahia
    Posts
    2

    Re: Calculate third point from 2 points and an angle

    Thanks, it is exactly what I needed. I was searchind and saw this method:
    Cx=cos(θ)⋅(X1−X0)−sin(θ)⋅(Y1−Y0)+X0
    Cy=sin(θ)⋅(X1−X0)+cos(θ)⋅(Y1−Y0)+Y1

    The distance between P0 and P1 is the same of P0 and C.
    Thanks one more time.
    Follow Math Help Forum on Facebook and Google+

Similar Math Help Forum Discussions

  1. Replies: 3
    Last Post: Oct 10th 2014, 06:07 PM
  2. Replies: 5
    Last Post: Sep 29th 2014, 05:56 PM
  3. Replies: 8
    Last Post: Sep 28th 2014, 04:48 PM
  4. Replies: 7
    Last Post: Aug 30th 2011, 06:15 PM
  5. Replies: 2
    Last Post: Sep 4th 2009, 10:19 PM

/mathhelpforum @mathhelpforum