Question: Line A line in 3 - dimensional space. The Line class should have multiple constructors: You can define a line by two points where the
Line
A line in dimensional space. The Line class should have multiple constructors:
You can define a line by two points where the points may be either type PointD or type Point. You can assume the two points are different. Optional challenge: Create a checked exception that you
throw if the two points are not different.
You can define a line by a point and a vector where the point may be either type Point D or Point. The line will run through the point and be parallel to the vector.
In addition, the Line class should have the following methods:
toString
Overrides the toString method of object. Returns a String representation of the Line. The String should contain the three parametric equations for the line.
equals
Overrides the equals method of object. Return true if the input value is a Line or a LineD that represents the same line.
getVector
Takes no input and returns a vector that is parallel to this line.
isParallel
A static method that takes two inputs and returns a boolean. The input values may be type LineD or type Line. Returns true if the two input lines are parallel.
intersection
A static method that takes two lines as input and returns a point. If both inputs are type LineD the the ouput should be type PointD If either input is type Line then the output should be type Point.
The method should return the point where the two input lines intersect, if there is an intersection. If the two lines do not intersect, the method should return null.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
