Concept explainers
(Geomentry: point position)
/** Return true if point (x2, y2) is on the left side of the * directed line from (x0, y0) to (x1, y1) */
public static boolean leftOfTheline (double x0, double y0 , double x1 , double y1 , double x2 , double y2)
/** Return true if point (x2, y2) is on the same * line from (x0, y0) to (x1, y1) */
public static boolean onTheSameline{double x0 , double y0, double x1 , double y1 , double x2, double y2)
/** Return true if poi nt (x2, y2) is on the • line segment from (x0, y0) to (x1, y1) */
public static boolean onThelineSegment(double x0, double y0, double x1, double y1, double x2 , double y2)
Write a program that prompts the user to enter the three points for p0, p1, and p2 and displays whether p2 is on the left side of the line from p0 to p1, right side, the same Line, or on the Line segment. Here are some sample runs:
Want to see the full answer?
Check out a sample textbook solutionChapter 6 Solutions
Introduction to Java Programming and Data Structures, Comprehensive Version (11th Edition)
- C++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage Learning