Class Point

java.lang.Object
math.Point

public class Point extends Object
  • Field Details

    • x

      public double x
    • y

      public double y
    • z

      public double z
  • Constructor Details

    • 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 object
      y - 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 object
      y - the y coordinate of the Point object
      z - 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 Details

    • 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 String toString()
      Overrides:
      toString in class Object
    • main

      public static void main(String[] args)