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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T16:11:41+00:00 2026-05-28T16:11:41+00:00

I have a solution that uses spatial data to represent a cluster of points

  • 0

I have a solution that uses spatial data to represent a cluster of points on a map. I have the need to used the coordinates that represent the extents of a cluster to find the minimum bounding rectangle that can contain said cluster of points.

Does any simple algorithm exist to be able to calculate this or is there any built in functionality in C# to achieve this. I am aware of the NetTopologySuite but am not sure how/if I could use this to achieve the same goal. I have a list of coordinates so I would need to pass this list of strings into it and get the MBR out.

  • 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-28T16:11:43+00:00Added an answer on May 28, 2026 at 4:11 pm

    The easiest solution, and I assume the one you’re most likely to be looking for, is to calculate the axis-aligned bounding box, which is simply a case of finding the min/max x & y values, then constructing a box from those.

    I’ll give you pseudo-code for that, given that you haven’t posted the types that your geometry is expressed in…

    type point { float x; float y; }
    type box { point topleft; point topright; point bottomleft; point bottomright; }
    
    function bounding_box(points)
    {
      xmin = min(points.x)
      xmax = max(points.x)
      ymin = min(points.y)
      ymax = max(points.y)
    
      return new box{
        topleft = { x = xmin, y = ymax },
        topright = { x = xmax, y = ymax },
        bottomleft = { x = xmin, y = ymin },
        bottomright = { x = xmax, y = ymin }
      };
    }
    

    So given these:

    point[] points = [[x = -2, y = 0], [x = 1, y = 2], [x = 1, y = 1], [x = -1, y = -2]];
    box bounds = bounding_box(points);
    

    All of the following will be true:

    bounds.topleft == [x = -2, y = 2];
    bounds.topright == [x = 1, y = 2];
    bounds.bottomleft == [x = -2, y = -2];
    bounds.bottomright == [x = -1, y = -2];
    

    Of course, if the coordinate system has the lowest coordinates at the top (e.g. like a typical display) – then you have to invert the calculation; or calculate the result in object-space first and then translate to logical space afterwards.

    Notice I’ve gone for a type for the box that expresses all four corners, in case you decide in the future to update to an arbitrarily aligned box in the future (although by the same token you could just use a point + 2 vectors for that).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So I have an existing ASP.NET solution that uses LINQ-to-SQL to insert data into
I have a client that uses a point-of-sale solution involving an Access database for
Hi I have a Visual Studio solution and an ASP.NET MVC project that uses
I have a solution that is missing a lot of code coverage. I need
We have a SharePoint Solution that uses the Microsoft Ajaxtoolkit. I am doing some
I have to write a solution that uses different databases with different structure from
I have a solution that uses EF Code First. I recently upgraded all my
My problem is that I have a asp.net solution that uses a seperate project
I have an ASP.NET page A that uses a data layer assembly DAL .
I have a solution that uses webforms for front end & mvc for admin

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.