Class jlib_Point

java.lang.Object
com.jackmeng.stl.jlib.jlib_Point

public class jlib_Point
extends java.lang.Object
  • Field Summary

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

    Constructors
    Constructor Description
    jlib_Point​(double x, double y)  
    jlib_Point​(int x, int y)
    Overloaded constructor if the user has chosen to specify values that are whole numbers in the range of Integer.MIN_VALUE to Integer.MAX_VALUE.
    jlib_Point​(jlib_Point point)
    Overloaded constructor if the user has chosen to specify an object of Standard Point.
  • Method Summary

    Modifier and Type Method Description
    double distance​(double x2, double y2)
    This method performs a distance calculation between two points of type double This method uses the distance formula of: d = sqrt((x2 - x1)^2 + (y2 - y1)^2) distance(3.7d, 9.8d);
    double getX()
    References the current instance's coordinate value of X
    double getY()
    References the current instance's coordinate value of Y
    void setX​(double x)
    Enables the user to specify a new coordinate for the X-value of this point
    void setY​(double y)
    Enables the user to specify a new coordinate for the Y-value of this point
    double slope​(double x2, double y2)
    This method performs a simple slope calculation between two points of type double If give points are in a vertical line (where x = 0), this method will attemp to return undefined However, a forced infinity check returns NaN if the given is a vertical line slope(4.3d, 5.0d);
    double slope​(jlib_Point point)
    This method performs a simple slope calculation between two points of type double slope(new Point(4, 3));

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • x

      private double x
    • y

      private double y
  • Constructor Details

    • jlib_Point

      public jlib_Point​(double x, double y)
      Parameters:
      x - X coordinate of a point
      y - Y coordiante of a point Constructor creates a new Point instance with user specified coordinates (x,y) in type double
    • jlib_Point

      public jlib_Point​(int x, int y)
      Overloaded constructor if the user has chosen to specify values that are whole numbers in the range of Integer.MIN_VALUE to Integer.MAX_VALUE. There is no casting needed in that integer can be easily converted to a double
      Parameters:
      x - X coordinate of a point (integer)
      y - Y coordinate of a point (integer)
      See Also:
      Double
    • jlib_Point

      public jlib_Point​(jlib_Point point)
      Overloaded constructor if the user has chosen to specify an object of Standard Point. This constructor will try to parse the data from the standard point class into a Point format this class can utilize. However, the user should note that using the standard point class incontrast with jlibxx's Point class can lead to problems such as ...
      Parameters:
      point -
      See Also:
      Point
  • Method Details

    • setX

      public void setX​(double x)
      Enables the user to specify a new coordinate for the X-value of this point
      Parameters:
      x - The new x value to be set and overwritten
    • setY

      public void setY​(double y)
      Enables the user to specify a new coordinate for the Y-value of this point
      Parameters:
      y - The new y value to be set and overwritten
    • getX

      public double getX()
      References the current instance's coordinate value of X
      Returns:
      the x value in a double type
    • getY

      public double getY()
      References the current instance's coordinate value of Y
      Returns:
      the y value in a double type
    • slope

      public double slope​(double x2, double y2)
      This method performs a simple slope calculation between two points of type double If give points are in a vertical line (where x = 0), this method will attemp to return undefined However, a forced infinity check returns NaN if the given is a vertical line slope(4.3d, 5.0d);
      Parameters:
      x2 - The second X-value to be compared with
      y2 - The second Y-value to be compared with
      Returns:
      The slope between the two points
    • slope

      public double slope​(jlib_Point point)
      This method performs a simple slope calculation between two points of type double slope(new Point(4, 3));
      Parameters:
      point - A point type that will be parsed
      Returns:
      The slope between the two points
    • distance

      public double distance​(double x2, double y2)
      This method performs a distance calculation between two points of type double This method uses the distance formula of: d = sqrt((x2 - x1)^2 + (y2 - y1)^2) distance(3.7d, 9.8d);
      Parameters:
      x2 -
      y2 -
      Returns: