Class Point2D

java.lang.Object
com.treemap.swing.fastvoronoi.polygon.Point2D

public class Point2D extends Object
Two-dimensional point, which also has functions as a two-dimensional vectors
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    double
     
    double
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
    Point2D(double x, double y)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    final double
    angle(Point2D vector2d)
    Computes the angle between the given vector and the position vector of the current point
    double
    distance(double px, double py)
    Computes the euclidean distance bewteen (px,py) to the current point
    static double
    distance(double x1, double y1, double x2, double y2)
    Computes the euclidean distance between (x1,y1) and (x2,y2)
    double
     
    final double
    dot(Point2D vector2d)
    Computes the dot-product of the given vector with position vector of the current point
    double
     
    double
     
    final double
     
    final double
     
    final void
     
    final void
    normalize(Point2D vector2d)
    Scales the coordinates with 1/(length of given vector)
    final void
    scale(double d)
     
    void
    setLocation(double x, double y)
     
     

    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
  • Constructor Details

    • Point2D

      public Point2D()
    • Point2D

      public Point2D(double x, double y)
  • Method Details

    • distance

      public static double distance(double x1, double y1, double x2, double y2)
      Computes the euclidean distance between (x1,y1) and (x2,y2)
      Parameters:
      x1 -
      y1 -
      x2 -
      y2 -
      Returns:
      euclidean distance between (x1,y1) and (x2,y2)
    • distance

      public double distance(double px, double py)
      Computes the euclidean distance bewteen (px,py) to the current point
      Parameters:
      px -
      py -
      Returns:
    • distance

      public double distance(Point2D point)
    • getX

      public double getX()
    • getY

      public double getY()
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • scale

      public final void scale(double d)
    • dot

      public final double dot(Point2D vector2d)
      Computes the dot-product of the given vector with position vector of the current point
      Parameters:
      vector2d -
      Returns:
    • length

      public final double length()
    • lengthSquared

      public final double lengthSquared()
    • normalize

      public final void normalize(Point2D vector2d)
      Scales the coordinates with 1/(length of given vector)
      Parameters:
      vector2d -
    • normalize

      public final void normalize()
    • angle

      public final double angle(Point2D vector2d)
      Computes the angle between the given vector and the position vector of the current point
      Parameters:
      vector2d -
      Returns:
    • setLocation

      public void setLocation(double x, double y)