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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T15:15:17+00:00 2026-05-26T15:15:17+00:00

I have a convex polygon expressed by points. Points are expressed by array of

  • 0

I have a convex polygon expressed by points. Points are expressed by array of x-coordinates and array of y-coordinates.

For example:

X = {6, 1, 5, 0, 3}
Y = {4, 0, 0, 4, 6}

How can I sort this points by clockwise? Number of points is not always the same, but polygon is still convex.


Is there a solution without using atan2 or other function from math.h?

  • 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-26T15:15:17+00:00Added an answer on May 26, 2026 at 3:15 pm

    I think you can get away by converting them to polar coordinates. C has atan2 so you could get away with:

    atan2(y[0], x[0]);
    

    After you obtain the respective angles you can use them to sort the points.

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

Sidebar

Related Questions

I have a convex polygon ABCDE... (it can have any number of points). I
I have a convex polygon P1 of N points. This polygon could be any
I have a 4 side convex Polygon defined by 4 points in 2D, and
How can I render n-sided polygon in three.js . It does not have geometry
I have a set of points that outlines my polygon. The polygon can have
I have two geo-spatial simple convex polygon areas, in latitudes and longitudes (decimal degrees)
I have a convex polygon (typically just a rotated square), and I know all
I have a large array of lat/lng points. Could be up to 20k points.
I have a simple polygon (convex or concave, but no holes) that I need
Given a path expressed as an array of 2d points: Point[] path = new

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.