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

The Archive Base Latest Questions

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

I am toying around with a shape problem and I am looking for a

  • 0

I am toying around with a shape problem and I am looking for a more clever solution than what I have been able to come up with.

Here is the problem:

I have a set of points that form an enclosed shape on a Cartesian grid, say A(-1,0),B(1,0), and C(0,4) which forms an acute triangle.

I have reworded this in a slightly less confusing way. Take the shape above and imagine that you can freely rotate it. I am looking to discover the rotation where we only take into account the x-axis and the distance between the western most and eastern most point is at its smallest.

When taking into account the shape above that distance would be the distance between A and B. While for more interesting shapes there may be shorter distances between points, I believe there is no way to rotate the shape above such that the western and eastern most points is less that the distance between A and B.

My only solution thus far has been to plot the points, rotate 1 degree, store the maximum distance keyed by the rotation. Rinse repeat and take the smallest one. This seems a bit kludgy and I know there has to be a more mathematically sound way to approach this.

Any ideas?

  • 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-31T08:41:19+00:00Added an answer on May 31, 2026 at 8:41 am

    Do the principal component analysis and align the principle component to the y axis. This will optimize the “mean” square distance from every point to the y axis (i.e. width on x axis). Perhaps this is also optimal or close to the optimal by your criteria.

    See: http://en.wikipedia.org/wiki/Principal_component_analysis

    Alternative Solution (Optimal solution):

    First calculate the convex hull of the points. Note that the two points with maximum x width are always going to in the convex hull.

    Now, for every line segment in the convex hull find the vertex that is farthest and note down the distance. Find the (line segment, farthest vertex) pair with minimum distance. Optimal rotation is the one that aligns that line segment in vertical direction.

    Complexity: O(nlogn) for the convex hull part and O(m^2) for the second part where m is the number of points on the convex hull.

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

Sidebar

Related Questions

I have a scenario that I haven't been able to solve: I'm toying around
I've been toying around with switching from ms-access files to SQLite files for my
Recently I have been looking at jquery/javascript solutions to emulating the placeholder attribute, but
I'm stumped on a problem that others on SO and around the web have
I'm toying around with GWT (dunno if this matters) and Hibernate. I've created a
I'm currently toying around with the Clarity .NET Facebook API but am finding certain
I'm toying around with fluent interfaces in the style of Martin Fowlers text, and
So, I'm toying around with Stackless Python and a question popped up in my
I am relatively new to matchers. I am toying around with hamcrest in combination
I'm looking around trying to see if anybody has asked this before. I don't

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.