public class Line
extends java.lang.Object
Constructor and Description |
---|
Line(ThreeDimensionalVector startCoord,
ThreeDimensionalVector endCoord)
Three dimensional constructor for a line
|
Line(TwoDimensionalVector startCoord,
TwoDimensionalVector endCoord)
Two dimensional constructor for a line
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object other) |
TwoDimensionalVector |
find2DPoint(double x)
Plugs in the given x coordinate to the line to calculate a 2D point from its equation
|
ThreeDimensionalVector |
find3DPoint(double x)
Plugs in the given x coordinate to the line to calculate a 3D point from its equation
|
TwoDimensionalVector |
get2DEnd()
Gets the 2D ending point for the line
|
double |
get2DSlope()
Gets the 2D slope for the line
|
TwoDimensionalVector |
get2DStart()
Gets the 2D starting point for the line
|
ThreeDimensionalVector |
get3DEnd()
Gets the 3D ending point for the line
|
ThreeDimensionalVector |
get3DStart()
Gets the 3D starting point for the line
|
java.util.List<TwoDimensionalVector> |
getAll2DPoints()
Returns all points with whole number x values on the line
|
java.util.List<ThreeDimensionalVector> |
getAll3DPoints()
Returns all points with whole number x values on the line
|
double |
getEndX()
Gets the ending x coordinate of the line
|
double |
getEndY()
Gets the ending y coordinate of the line
|
double |
getEndZ()
Gets the ending z coordinate of the line
|
double |
getLength()
Gets the length of the line
|
double |
getStartX()
Gets the starting x coordinate of the line
|
double |
getStartY()
Gets the starting y coordinate of the line
|
double |
getStartZ()
Gets the starting z coordinate of the line
|
boolean |
isPointValid(ThreeDimensionalVector coord)
Checks if the point is valid on a 3D plane
|
boolean |
isPointValid(TwoDimensionalVector coord)
Checks if the point is valid on a 2D plane
|
Line |
rotate2D(double angle)
Rotates the line about the origin
|
Line |
rotate2D(TwoDimensionalVector point,
double angle)
Rotates the line around a point
|
Line |
rotate3DX(double angle)
Rotates the line across the x-axis about the origin
|
Line |
rotate3DX(ThreeDimensionalVector point,
double angle)
Rotates the line across the x-axis around a point
|
Line |
rotate3DY(double angle)
Rotates the line across the y-axis about the origin
|
Line |
rotate3DY(ThreeDimensionalVector point,
double angle)
Rotates the line across the y-axis around a point
|
Line |
rotate3DZ(double angle)
Rotates the line across the z-axis about the origin
|
Line |
rotate3DZ(ThreeDimensionalVector point,
double angle)
Rotates the line across the z-axis around a point
|
Line |
setEnd(ThreeDimensionalVector coord)
Creates a new line as a copy of this line but with the set end coord
|
Line |
setEnd(TwoDimensionalVector coord)
Creates a new line as a copy of this line but with the set end coord
|
Line |
setStart(ThreeDimensionalVector coord)
Creates a new line as a copy of this line but with the set start coord
|
Line |
setStart(TwoDimensionalVector coord)
Creates a new line as a copy of this line but with the set start coord
|
java.lang.String |
toString() |
public Line(TwoDimensionalVector startCoord, TwoDimensionalVector endCoord)
startCoord
- Start coord of the lineendCoord
- End coord of the linepublic Line(ThreeDimensionalVector startCoord, ThreeDimensionalVector endCoord)
startCoord
- Start coord of the lineendCoord
- End coord of the linepublic double getStartX()
public double getStartY()
public double getStartZ()
public double getEndX()
public double getEndY()
public double getEndZ()
public TwoDimensionalVector get2DStart()
public TwoDimensionalVector get2DEnd()
public ThreeDimensionalVector get3DStart()
public ThreeDimensionalVector get3DEnd()
public double get2DSlope()
public TwoDimensionalVector find2DPoint(double x)
x
- The x coordinatepublic boolean isPointValid(TwoDimensionalVector coord)
coord
- The coord to checkpublic java.util.List<TwoDimensionalVector> getAll2DPoints()
public ThreeDimensionalVector find3DPoint(double x)
x
- The x coordinatepublic boolean isPointValid(ThreeDimensionalVector coord)
coord
- The coord to checkpublic java.util.List<ThreeDimensionalVector> getAll3DPoints()
public double getLength()
public Line setStart(TwoDimensionalVector coord)
coord
- The new start coordpublic Line setStart(ThreeDimensionalVector coord)
coord
- The new start coordpublic Line setEnd(TwoDimensionalVector coord)
coord
- The new end coordpublic Line setEnd(ThreeDimensionalVector coord)
coord
- The new end coordpublic Line rotate2D(TwoDimensionalVector point, double angle)
point
- The point to rotate aroundangle
- The angle to rotate bypublic Line rotate2D(double angle)
angle
- The angle to rotate bypublic Line rotate3DX(ThreeDimensionalVector point, double angle)
point
- The point to rotate aroundangle
- The angle to rotate bypublic Line rotate3DX(double angle)
angle
- The angle to rotate bypublic Line rotate3DY(ThreeDimensionalVector point, double angle)
point
- The point to rotate aroundangle
- The angle to rotate bypublic Line rotate3DY(double angle)
angle
- The angle to rotate bypublic Line rotate3DZ(ThreeDimensionalVector point, double angle)
point
- The point to rotate aroundangle
- The angle to rotate bypublic Line rotate3DZ(double angle)
angle
- The angle to rotate bypublic boolean equals(java.lang.Object other)
equals
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object