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

  • Home
  • SEARCH
  • 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 977929
In Process

The Archive Base Latest Questions

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

I have a three lat-lon coordinates that make up two line segment A to

  • 0

I have a three lat-lon coordinates that make up two line segment A to B to C. I also found a function that can return north-bearing of a line segment A-B or B-C in -180 to 180 manner. However, I’m having trouble to determine when a car reaches from A to B, should it turn right or left to continue to C.

  • 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-16T03:58:56+00:00Added an answer on May 16, 2026 at 3:58 am

    EDIT: Previous answer was wrong. now this is the correct

    public Direction GetDirection(Point a, Point b, Point c)
    {
        double theta1 = GetAngle(a, b); 
        double theta2 = GetAngle(b, c);
        double delta = NormalizeAngle(theta2 - theta1);
    
        if ( delta == 0 )
            return Direction.Straight;
        else if ( delta == Math.PI )
            return Direction.Backwards;
        else if ( delta < Math.PI )
            return Direction.Left;
        else return Direction.Right;
    }
    
    private Double GetAngle(Point p1, Point p2)
    {
        Double angleFromXAxis = Math.Atan ((p2.Y - p1.Y ) / (p2.X - p1.X ) ); // where y = m * x + K
        return  p2.X - p1.X < 0 ? m + Math.PI : m ); // The will go to the correct Quadrant
    }
    
    private Double NormalizeAngle(Double angle)
    {
        return angle < 0 ? angle + 2 * Math.PI : angle; //This will make sure angle is [0..2PI]
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Assume that I have one big table with three columns: user_name, user_property, value_of_property. Lat's
I have a question that's so simple I cannot believe I can't answer it
I have the following three models (Rails 2.3.8) class Outbreak < ActiveRecord::Base has_many :incidents,
Quick background of what I have going on. UIMapView loads and shows a single
I want to pull data from three tables, but if the data doesn't exist
I have a GPolyline , which pops up an info window when it is
I have the following table in PostgreSQL 8.4.5: snake=> create table gps ( id
I was hoping someone out there could provide me with an equation to calculate
I created a network graph from data on flows between US states. For each
Looking for a way to get a list of telephone area codes for a

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.