Package math
Class Point
- java.lang.Object
-
- math.Point
-
public class Point extends java.lang.Object- Author:
- GBEMIRO
-
-
Constructor Summary
Constructors Constructor Description Point()ICreates a Point object at the origin of 3D space.Point(double x)Initializes a 1D Point objectPoint(double x, double y)Initializes a 2D Point objectPoint(double x, double y, double z)Initializes a 2D Point objectPoint(Point point)Creates a new Point object similar to this one but not referring to the same object
-
Method Summary
Modifier and Type Method Description doublecalcDistanceTo(Point pt)doublefindXYGrad(Point pt)doublefindXZGrad(Point pt)doublefindYZGrad(Point pt)SimplePointgetUtilPoint()Converts objects of this class to the normal Point object.static SimplePointgetUtilPoint(Point point)Converts objects of this class to the normal Point object.doublegetX()doublegetY()doublegetZ()booleanisCollinearWith(Point p1, Point p2)booleanliesBetween(Point p1, Point p2)static voidmain(java.lang.String[] args)static PointmidPoint(Point p1, Point p2)voidsetX(double x)voidsetY(double y)voidsetZ(double z)java.lang.StringtoString()
-
-
-
Constructor Detail
-
Point
public Point()
ICreates a Point object at the origin of 3D space.
-
Point
public Point(double x)
Initializes a 1D Point object- Parameters:
x- the x coordinate of the Point object
-
Point
public Point(double x, double y)Initializes a 2D Point object- Parameters:
x- the x coordinate of the Point objecty- the y coordinate of the Point object
-
Point
public Point(double x, double y, double z)Initializes a 2D Point object- Parameters:
x- the x coordinate of the Point objecty- the y coordinate of the Point objectz- the z coordinate of the Point object
-
Point
public Point(Point point)
Creates a new Point object similar to this one but not referring to the same object- Parameters:
point- The point to mutate
-
-
Method Detail
-
setX
public void setX(double x)
- Parameters:
x- sets x the x coordinate of the Point object
-
getX
public double getX()
- Returns:
- x the x coordinate of the Point object
-
setY
public void setY(double y)
- Parameters:
y- x the y coordinate of the Point object
-
getY
public double getY()
- Returns:
- x the y coordinate of the Point object
-
setZ
public void setZ(double z)
- Parameters:
z- sets the z coordinate of the Point object
-
getZ
public double getZ()
- Returns:
- the z coordinate of the Point object
-
calcDistanceTo
public double calcDistanceTo(Point pt)
- Parameters:
pt- the Point object whose distance to this Point object is required- Returns:
- the distance between this Point object and Point pt
-
findXYGrad
public double findXYGrad(Point pt)
- Parameters:
pt- the point between which an imaginary line runs- Returns:
- the gradient of the projection of the line joining these points on the XY plane
-
findXZGrad
public double findXZGrad(Point pt)
- Parameters:
pt- the point between which an imaginary line runs- Returns:
- the gradient of the projection of the line joining these points on the XZ plane
-
findYZGrad
public double findYZGrad(Point pt)
- Parameters:
pt- the point between which an imaginary line runs- Returns:
- the gradient of the projection of the line joining these points on the YZ plane
-
getUtilPoint
public SimplePoint getUtilPoint()
Converts objects of this class to the normal Point object.- Returns:
- a java.awt.Point object from this Point object
-
getUtilPoint
public static SimplePoint getUtilPoint(Point point)
Converts objects of this class to the normal Point object.- Parameters:
point-- Returns:
- a java.awt.Point object from an object of this class.
-
midPoint
public static Point midPoint(Point p1, Point p2)
- Parameters:
p1- The first Point object.p2- The second Point object.- Returns:
- The Point object that contains the coordinates of the midpoint of the line joining p1 and p2
-
isCollinearWith
public boolean isCollinearWith(Point p1, Point p2)
- Parameters:
p1-p2-- Returns:
- true if the 2 points and this one lie on the same straight line.
-
liesBetween
public boolean liesBetween(Point p1, Point p2)
- Parameters:
p1-p2-- Returns:
- true if this Point object lies on the same straight line with p1 and p2 and it lies in between them.
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
main
public static void main(java.lang.String[] args)
-
-