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:
modified: [sstein]: 16.Feb.2009 changed logger-entries to comments
-
-
Field Summary
Fields Modifier and Type Field Description protected double[]coordinatesprotected intdimensionprotected intindexprotected booleanmarkedstatic PirolPointNULLPUNKTprotected booleanscaledprotected ScaleChangerscaler
-
Constructor Summary
Constructors Constructor Description PirolPoint()For classLoadersPirolPoint(double[] coords)PirolPoint(double[] coords, int index)PirolPoint(double[] coords, int index, ScaleChanger scaler)PirolPoint(double[] coords, int index, ScaleChanger scaler, boolean prescaled)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static PirolPointclone(PirolPoint pkt)Method to create a deep copy of the given punkt object, that doesn't share any references with the originalPirolPointclonePunkt()Method to create a deep copy of the calling punkt object, that doesn't share any references with the originalintcompareTo(Object arg0)static PirolPointcreateVector(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".static doubledistanceBetween(PirolPoint p1, PirolPoint p2)calculates the distance of point p1 to the other point p2.doubledistanceTo(PirolPoint p)calculates the distance ofthispoint to the other point.booleanequals(Object obj)doublegetCoordinate(int nr)get thenr-th coordinate.double[]getCoordinates()intgetDimension()intgetIndex()intgetSortFor()doublegetX()get 0-th coordinatedoublegetY()get 1-st coordinatedoublegetZ()get 2-nd coordinatebooleanisMarked()check ifmarkedwas set or notbooleanliegtAuf(PirolPoint p)voidscale()voidsetCoordinate(double newCoord, int nr)set thenr-th coordinate.voidsetCoordinates(double[] coordinates)voidsetIndex(int index)voidsetMarked(boolean marked)set boolean flag of the object, to e.g.voidsetScaler(ScaleChanger scaler)voidsetSortFor(int sortFor)voidsetX(double val)set the 0-th coordinatevoidsetY(double val)set the 1-st coordinatevoidsetZ(double val)set the 2-nd coordinateorg.locationtech.jts.geom.CoordinatetoCoordinate()static org.locationtech.jts.geom.CoordinatetoCoordinate(PirolPoint p)StringtoString()voidunScale()
-
-
-
Field Detail
-
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 Detail
-
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 Detail
-
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 vectorto- 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 ifmarkedwas set or not- Returns:
- true, if
markedis 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)
-
getSortFor
public int getSortFor()
- Specified by:
getSortForin classSortable
-
setSortFor
public void setSortFor(int sortFor)
- Specified by:
setSortForin classSortable
-
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 thenr-th coordinate. This method is used within getX(), getY(), getZ().- Returns:
- the
nr-th coordinate - Throws:
RuntimeException- if the point has less coordinates thannror ifnris less than zero
-
setCoordinate
public void setCoordinate(double newCoord, int nr)set thenr-th coordinate. This method is used within setX(), setY(), setZ().- Parameters:
newCoord- new Coordinatenr- 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 ofthispoint 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 pointp2- the other point- Returns:
- distance between the two points
-
compareTo
public int compareTo(Object arg0)
- Specified by:
compareToin interfaceComparable- Specified by:
compareToin classSortable
-
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
-
-