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
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 Summary
FieldsModifier and TypeFieldDescriptionprotected double[]protected intprotected intprotected booleanstatic final PirolPointprotected booleanprotected ScaleChanger -
Constructor Summary
ConstructorsConstructorDescriptionFor 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
Modifier and TypeMethodDescriptionstatic PirolPointclone(PirolPoint pkt) Method to create a deep copy of the given punkt object, that doesn't share any references with the originalMethod to create a deep copy of the calling punkt object, that doesn't share any references with the originalintstatic 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.doublecalculates the distance ofthispoint to the other point.booleandoublegetCoordinate(int nr) get thenr-th coordinate.double[]intintgetIndex()intdoublegetX()get 0-th coordinatedoublegetY()get 1-st coordinatedoublegetZ()get 2-nd coordinatebooleanisMarked()check ifmarkedwas set or notbooleanvoidscale()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. mark if this point was already passed or whatever.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.Coordinatestatic org.locationtech.jts.geom.CoordinatetoString()voidunScale()
-
Field Details
-
coordinates
protected double[] coordinates -
dimension
protected int dimension -
index
protected int index -
NULLPUNKT
-
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
-
PirolPoint
-
-
Method Details
-
createVector
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
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
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
-
equals
-
getSortFor
public int getSortFor()- Specified by:
getSortForin classSortable
-
setSortFor
public void setSortFor(int sortFor) - Specified by:
setSortForin classSortable
-
setScaler
-
scale
- Throws:
RuntimeException
-
unScale
- 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
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
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
-
toString
-
compareTo
- Specified by:
compareToin interfaceComparable- Specified by:
compareToin classSortable
-
toCoordinate
- Throws:
RuntimeException
-
toCoordinate
public static org.locationtech.jts.geom.Coordinate toCoordinate(PirolPoint p) throws RuntimeException - Throws:
RuntimeException
-