Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7617967
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T03:16:41+00:00 2026-05-31T03:16:41+00:00

I have been scratching my head on this for quite a while now. Guess

  • 0

I have been scratching my head on this for quite a while now. Guess I should have paid more attention in the trigonometry math classes when I was younger but here we go:

I have an angle and a point. I then want to put a second point in the direction of the angle, 200 units away from the first point. I use Atan2 to get the angle, then cos and sin to get the third point. But… I think something goes wrong when calculating the Sin for p3.Y.

EDIT: To clarify, I removed p2 and used the angle directly:

        PointF p1 = new PointF(20, 20);
        double angle = 1.3034851559678624f;

        //Create a new PointF in the same direction, 200 pixels away from p1
        //{ X = 199,9482, Y = 4,549629 }
        PointF p3 = new PointF
        {
            X = (float)(Math.Cos(Math.PI * angle / 180.0) * 200),
            Y = (float)(Math.Sin(Math.PI * angle / 180.0) * 200)
        };

        //This is where I would expect 1.3034851559678624 as the first angle 
        //but I get -4.9073849244837184
        double angle2 = Math.Atan2(p3.Y - p1.Y, p3.X - p1.X) * 180 / Math.PI;

Here is a visual representation of the values above. The green line is the first angle.

Visual overview

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T03:16:42+00:00Added an answer on May 31, 2026 at 3:16 am

    The problem with your current code is that you don’t calculate p3 relative to p1. You need to add p1.X and p1.Y to the coordinates of p3:

    PointF p3 = new PointF
    {
        X = p1.X + (float)(Math.Cos(Math.PI * angle / 180.0) * 200),
        Y = p1.Y + (float)(Math.Sin(Math.PI * angle / 180.0) * 200)
    };
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been scratching my head on this for a while now but still
I have been scratching my head for a while on this one. I dont
This one is quite tricky i've been scratching my head all day. I have
I've been scratching my head on this one for a while now and am
I have been scratching my head on this one for a while, so I
Been scratching my head on this for a while.... I have a PDO object
I've been scratching my head over this for an hour... I have a list
I have been scratching my head all morning behind this but still haven't been
I've been scratching my head for hours trying to figure this out. I have
I have been scratching my head since long now but not getting around to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.