Class PirolPoint

java.lang.Object
org.openjump.core.apitools.comparisonandsorting.Sortable
org.openjump.core.graph.pirolProject.PirolPoint
All Implemented Interfaces:
Comparable
Direct Known Subclasses:
CorrelationDataPair

public class PirolPoint extends Sortable
Base class for objects that describe an n-dimensional point. There are derived classes e.g. to suit the requirements of a triangulation or an interpolation. Offers methods e.g. to determine distances between different punkt objects or to mark and unmark punkt objects. punkt objects implement Sortable and have a choseable natural order (implement Comparable), so they can be sorted with the tools from the Java Collection Framework.
Version:
$Rev: 2509 $
Author:
Ole Rahn

FH Osnabrück - University of Applied Sciences Osnabrück,
Project: PIROL (2005),
Subproject: Daten- und Wissensmanagement
See Also:
  • Field Details

    • coordinates

      protected double[] coordinates
    • dimension

      protected int dimension
    • index

      protected int index
    • NULLPUNKT

      public static final PirolPoint NULLPUNKT
    • scaler

      protected ScaleChanger scaler
    • scaled

      protected boolean scaled
    • marked

      protected boolean marked
  • Constructor Details

    • PirolPoint

      public PirolPoint()
      For classLoaders
    • PirolPoint

      public PirolPoint(double[] coords)
    • PirolPoint

      public PirolPoint(double[] coords, int index)
    • PirolPoint

      public PirolPoint(double[] coords, int index, ScaleChanger scaler, boolean prescaled)
    • PirolPoint

      public PirolPoint(double[] coords, int index, ScaleChanger scaler)
  • Method Details

    • createVector

      public static PirolPoint createVector(PirolPoint from, PirolPoint to)
      creates a punkt object that represents a vector (x,y(,z)) that shows the direction that leads from point "from" to point "to".
      Parameters:
      from - source points of the vector
      to - destination point of the vector
      Returns:
      a vector from from to to ;-)
    • clone

      public static PirolPoint clone(PirolPoint pkt)
      Method to create a deep copy of the given punkt object, that doesn't share any references with the original
      Parameters:
      pkt - the punkt object to clone
      Returns:
      copy of the given punkt object
      Since:
      1.15
    • clonePunkt

      public PirolPoint clonePunkt()
      Method to create a deep copy of the calling punkt object, that doesn't share any references with the original
      Returns:
      copy of the punkt object
      Since:
      1.15
    • isMarked

      public boolean isMarked()
      check if marked was set or not
      Returns:
      true, if marked is true
    • setMarked

      public void setMarked(boolean marked)
      set boolean flag of the object, to e.g. mark if this point was already passed or whatever.
      Parameters:
      marked - boolean value to set the internal flag to
    • liegtAuf

      public boolean liegtAuf(PirolPoint p)
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • getSortFor

      public int getSortFor()
      Specified by:
      getSortFor in class Sortable
    • setSortFor

      public void setSortFor(int sortFor)
      Specified by:
      setSortFor in class Sortable
    • setScaler

      public void setScaler(ScaleChanger scaler)
    • scale

      public void scale() throws RuntimeException
      Throws:
      RuntimeException
    • unScale

      public void unScale() throws RuntimeException
      Throws:
      RuntimeException
    • getCoordinates

      public double[] getCoordinates()
    • setCoordinates

      public void setCoordinates(double[] coordinates)
    • getIndex

      public int getIndex()
    • setIndex

      public void setIndex(int index)
    • getDimension

      public int getDimension()
    • getCoordinate

      public double getCoordinate(int nr)
      get the nr-th coordinate. This method is used within getX(), getY(), getZ().
      Returns:
      the nr-th coordinate
      Throws:
      RuntimeException - if the point has less coordinates than nr or if nr is less than zero
    • setCoordinate

      public void setCoordinate(double newCoord, int nr)
      set the nr-th coordinate. This method is used within setX(), setY(), setZ().
      Parameters:
      newCoord - new Coordinate
      nr - number of coordinate to set
    • getX

      public double getX()
      get 0-th coordinate
      Returns:
      0-th coordinate
    • getY

      public double getY()
      get 1-st coordinate
      Returns:
      1-st coordinate
    • getZ

      public double getZ()
      get 2-nd coordinate
      Returns:
      2-nd coordinate
    • setX

      public void setX(double val)
      set the 0-th coordinate
      Parameters:
      val - 0-th coordinate
    • setY

      public void setY(double val)
      set the 1-st coordinate
      Parameters:
      val - 1-st coordinate
    • setZ

      public void setZ(double val)
      set the 2-nd coordinate
      Parameters:
      val - 2-nd coordinate
    • distanceTo

      public double distanceTo(PirolPoint p)
      calculates the distance of this point to the other point. The distance will be calculated in as many dimensions as both points have. If the two points have a different amount of coordinates, this will happen: int checkDim = Math.min(this.dimension, p.getDimension());
      Parameters:
      p - the other point
      Returns:
      distance between the two points
    • distanceBetween

      public static double distanceBetween(PirolPoint p1, PirolPoint p2)
      calculates the distance of point p1 to the other point p2. The distance will be calculated in as many dimensions as both points have. If the two points have a different amount of coordinates, this will happen: int checkDim = Math.min(this.dimension, p.getDimension());
      Parameters:
      p1 - one point
      p2 - the other point
      Returns:
      distance between the two points
    • toString

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

      public int compareTo(Object arg0)
      Specified by:
      compareTo in interface Comparable
      Specified by:
      compareTo in class Sortable
    • toCoordinate

      public org.locationtech.jts.geom.Coordinate toCoordinate() throws RuntimeException
      Throws:
      RuntimeException
    • toCoordinate

      public static org.locationtech.jts.geom.Coordinate toCoordinate(PirolPoint p) throws RuntimeException
      Throws:
      RuntimeException