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 7949119
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T01:54:15+00:00 2026-06-04T01:54:15+00:00

My brain just isn’t working today. I need to test whether a point (lat,

  • 0

My brain just isn’t working today. I need to test whether a point (lat, long) lies within a a rectangle on a map. The rectangle is defined by it’s North, East, South, & West borders. The hiccup is that all points or values are in map-coordinate system. To deal with the date-line wrap-around, I assume that longitude is always “between” if we go from left-to-right.

bool PointInRectangle(Point pt, double North, double East, double South, double West)
{
    // ????
}
  • 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-06-04T01:54:16+00:00Added an answer on June 4, 2026 at 1:54 am

    Assuming east and north are positive:

    bool PointInRectangle(Point pt, double North, double East, double South, double West)
    {
        // you may want to check that the point is a valid coordinate
        if (West < East)
        {
            return pt.X < East && pt.X > West && pt.Y < North && pt.Y > South;
        }
    
        // it crosses the date line
        return (pt.X < East || pt.X > West) && pt.Y < North && pt.Y > South;        
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm sure this is simple but my brain just isnt working today! I have
a very simple question I am sure just the brain isn't working this morning.
There is probably a really easy answer to this but my brain just isn't
[UPDATE] What I ask below just isn't possible. In which case, as my brain
This seems like it is completely straightforward, but my brain isn't working very well
OK so my brain is just probably not working tonight. What I'm trying to
My brain isn't working, I'm trying to grab the first three rows on this
Ok. I have looked EVERYWHERE and my little brain just can't understand a better
I have just had a brain block, I have a Deck object and want
Just trying to wrap my brain around open source cloud. 1) Is OpenStack running

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.