Package math

Class Point

java.lang.Object
math.Point

public class Point
extends java.lang.Object
Author:
GBEMIRO
  • Field Summary

    Fields 
    Modifier and Type Field Description
    double x  
    double y  
    double z  
  • Constructor Summary

    Constructors 
    Constructor Description
    Point()
    ICreates a Point object at the origin of 3D space.
    Point​(double x)
    Initializes a 1D Point object
    Point​(double x, double y)
    Initializes a 2D Point object
    Point​(double x, double y, double z)
    Initializes a 2D Point object
    Point​(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
    double calcDistanceTo​(Point pt)  
    double findXYGrad​(Point pt)  
    double findXZGrad​(Point pt)  
    double findYZGrad​(Point pt)  
    SimplePoint getUtilPoint()
    Converts objects of this class to the normal Point object.
    static SimplePoint getUtilPoint​(Point point)
    Converts objects of this class to the normal Point object.
    double getX()  
    double getY()  
    double getZ()  
    boolean isCollinearWith​(Point p1, Point p2)  
    boolean liesBetween​(Point p1, Point p2)  
    static void main​(java.lang.String[] args)  
    static Point midPoint​(Point p1, Point p2)  
    void setX​(double x)  
    void setY​(double y)  
    void setZ​(double z)  
    java.lang.String toString()  

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • 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 java.lang.String toString()
      Overrides:
      toString in class java.lang.Object
    • main

      public static void main​(java.lang.String[] args)