Question

(Geometry: non-cross polygon) Write a program that enables the user to add/ remove points by clicking the left/right mouse button, and displays a noncrossed polygon that links all the points, as shown in Figure 22.11 a. A polygon is crossed if two or more sides intersect, as shown in Figure 22.11b. Use the following algorithm to construct a polygon from a set of points.FIGURE CANT COPY Figure 22.11 (a) Programming Exercise22.15 displays a non-crossed polygon for a set of points. (b) Two or more sides intersect in a crossed polygon. Step 1: Given a set of points $S$, select the rightmost lowest point $p_0$ in the set $S$. Step 2: Sort the points in $S$ angularly along the $x$-axis with $p_0$ as the center. If there is a tie and two points have the same angle, the one that is closer to $p_0$ is considered greater. The points in $S$ are now sorted as $p_0, p_1, p_2, \ldots$, $p_{n-1}$. Step 3: The sorted points form a non-cross polygon.

   (Geometry: non-cross polygon) Write a program that enables the user to add/ remove points by clicking the left/right mouse button, and displays a noncrossed polygon that links all the points, as shown in Figure 22.11 a. A polygon is crossed if two or more sides intersect, as shown in Figure 22.11b. Use the following algorithm to construct a polygon from a set of points.FIGURE CANT COPY
Figure 22.11 (a) Programming Exercise22.15 displays a non-crossed polygon for a set of points. (b) Two or more sides intersect in a crossed polygon.
Step 1: Given a set of points $S$, select the rightmost lowest point $p_0$ in the set $S$.
Step 2: Sort the points in $S$ angularly along the $x$-axis with $p_0$ as the center. If there is a tie and two points have the same angle, the one that is closer to $p_0$ is considered greater. The points in $S$ are now sorted as $p_0, p_1, p_2, \ldots$, $p_{n-1}$.
Step 3: The sorted points form a non-cross polygon.
Show more…
Introduction to Java Programming. Comprehensive Version
Introduction to Java Programming. Comprehensive Version
Y. Daniel Liang 10th Edition
Chapter 22, Problem 15 ↓

Instant Answer

verified

Step 1

Step 1: Initialize a set of points $S$ to store the points clicked by the user.  Show more…

Show all steps

lock
AceChat toggle button
Close icon
Ace pointing down

Please give Ace some feedback

Your feedback will help us improve your experience

Thumb up icon Thumb down icon
Thanks for your feedback!
Profile picture
(Geometry: non-cross polygon) Write a program that enables the user to add/ remove points by clicking the left/right mouse button, and displays a noncrossed polygon that links all the points, as shown in Figure 22.11 a. A polygon is crossed if two or more sides intersect, as shown in Figure 22.11b. Use the following algorithm to construct a polygon from a set of points.FIGURE CANT COPY Figure 22.11 (a) Programming Exercise22.15 displays a non-crossed polygon for a set of points. (b) Two or more sides intersect in a crossed polygon. Step 1: Given a set of points $S$, select the rightmost lowest point $p_0$ in the set $S$. Step 2: Sort the points in $S$ angularly along the $x$-axis with $p_0$ as the center. If there is a tie and two points have the same angle, the one that is closer to $p_0$ is considered greater. The points in $S$ are now sorted as $p_0, p_1, p_2, \ldots$, $p_{n-1}$. Step 3: The sorted points form a non-cross polygon.
Close icon
Play audio
Feedback
Powered by NumerAI
Need help? Use Ace
Ace is your personal tutor. It breaks down any question with clear steps so you can learn.
Start Using Ace
Ace is your personal tutor for learning
Step-by-step explanations
Instant summaries
Summarize YouTube videos
Understand textbook images or PDFs
Study tools like quizzes and flashcards
Listen to your notes as a podcast
Continue solving this problem
Create a free account to:
  • View full step-by-step solution
  • Ask follow-up questions with Ace AI
  • Save progress and study later
Continue Free
Join the community

18,000,000+

Students on Numerade


Trusted by students at 8,000+ universities

Numerade

Get step-by-step video solution
from top educators

Continue with Clever
or



By creating an account, you agree to the Terms of Service and Privacy Policy
Already have an account? Log In

A free answer
just for you

Watch the video solution with this free unlock.

Numerade

Log in to watch this video
...and 100,000,000 more!


EMAIL

PASSWORD

OR
Continue with Clever