org.jdelaunay.delaunay.geometries
Class DPoint

java.lang.Object
  extended by org.jdelaunay.delaunay.geometries.Element
      extended by org.jdelaunay.delaunay.geometries.DPoint
All Implemented Interfaces:
Comparable<DPoint>

public class DPoint
extends Element
implements Comparable<DPoint>

The smallest geometric element of a mesh.

Author:
Adelin Piau, Jean-Yves Martin, Erwan Bocher

Field Summary
 
Fields inherited from class org.jdelaunay.delaunay.geometries.Element
WEIGHTED_PROPERTIES
 
Constructor Summary
DPoint()
          Build a point at the origin
DPoint(com.vividsolutions.jts.geom.Coordinate coord)
          Build a point as a copy of jts Coordinates
DPoint(double x, double y, double z)
          Build a point at coordinates x, y, z with no type
DPoint(DPoint pt)
          Build a point as a copy of another point
 
Method Summary
protected  boolean closedTo(DPoint aPoint, double tolerence)
          Check if the point is closed to the current point, ie if the distance between this and aPoint is inferior to tolerence.
 int compareTo(DPoint p)
          Compare this and p in two dimensions.
 int compareTo2D(DPoint p)
          Compare this and p in two dimensions.
 boolean contains(com.vividsolutions.jts.geom.Coordinate c)
          Check if the coordinate is inside the element
 boolean contains(DPoint aPoint)
          Check if aPoint can be considered as equal to this.
 void displayObject(Graphics g, int decalageX, int decalageY, double minX, double minY, double scaleX, double scaleY)
          Display the point in a JPanel Must be used only when using package drawing
 boolean equals(Object p)
          We override the equals method, as two points can be said equal when their coordinate are exactly the same
 boolean equals2D(DPoint y)
          Check if this==y, considering only the first two coordinates.
 BoundaryBox getBoundingBox()
          Computed bounding box
 com.vividsolutions.jts.geom.Coordinate getCoordinate()
          return jts Coordinate
 double getX()
          Get X coordinate
 double getY()
          Get Y coordinate
 double getZ()
          Get Z coordinate
 int hashCode()
          Generate an hashcode based on the coordinates of the point.
protected  void setColor(Graphics g)
          Set the point color for the JFrame panel
 void setX(double x)
          Set X coordinate
 void setY(double y)
          Set Y coordinate
 void setZ(double z)
          Set Z coordinate
protected  double squareDistance(double x, double y)
          plane square distance to another point
protected  double squareDistance(double x, double y, double z)
          square distance to another point
 double squareDistance(DPoint aPoint)
          square distance to another point
protected  double squareDistance2D(double x, double y)
          plane square distance to another point
protected  double squareDistance2D(DPoint aPoint)
          plane square distance to another point
 String toString()
          Gives a string representation of this object.
 
Methods inherited from class org.jdelaunay.delaunay.geometries.Element
addProperty, getExternalGID, getGID, getHeight, getMaxWeight, getProperty, hasProperty, removeProperties, setExternalGID, setGID, setHeight, setProperty
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DPoint

public DPoint()
       throws DelaunayError
Build a point at the origin

Throws:
DelaunayError - If x, y or z is not set.

DPoint

public DPoint(double x,
              double y,
              double z)
       throws DelaunayError
Build a point at coordinates x, y, z with no type

Parameters:
x -
y -
z -
Throws:
DelaunayError - If x, y or z is not set.

DPoint

public DPoint(DPoint pt)
       throws DelaunayError
Build a point as a copy of another point

Throws:
DelaunayError - DelaunayError

DPoint

public DPoint(com.vividsolutions.jts.geom.Coordinate coord)
       throws DelaunayError
Build a point as a copy of jts Coordinates

Throws:
DelaunayError - If x, y or z is not set.
Method Detail

getX

public final double getX()
Get X coordinate

Returns:
x

getY

public final double getY()
Get Y coordinate

Returns:
y

getZ

public final double getZ()
Get Z coordinate

Returns:
z

setX

public final void setX(double x)
Set X coordinate

Parameters:
x -

setY

public final void setY(double y)
Set Y coordinate

Parameters:
y -

setZ

public final void setZ(double z)
Set Z coordinate

Parameters:
z -

getCoordinate

public final com.vividsolutions.jts.geom.Coordinate getCoordinate()
return jts Coordinate

Returns:
A representation of this DPoint as a JTS Coordinate.

getBoundingBox

public final BoundaryBox getBoundingBox()
Description copied from class: Element
Computed bounding box

Specified by:
getBoundingBox in class Element
Returns:
The boundary box of this element.

contains

public final boolean contains(DPoint aPoint)
Check if aPoint can be considered as equal to this.

Specified by:
contains in class Element
Parameters:
aPoint -
Returns:
true if this and aPoint are equal.

contains

public final boolean contains(com.vividsolutions.jts.geom.Coordinate c)
Description copied from class: Element
Check if the coordinate is inside the element

Specified by:
contains in class Element
Returns:
bool

squareDistance2D

protected final double squareDistance2D(DPoint aPoint)
plane square distance to another point

Parameters:
aPoint -
Returns:
distance

squareDistance2D

protected final double squareDistance2D(double x,
                                        double y)
plane square distance to another point

Parameters:
x -
y -
Returns:
distance

squareDistance

public final double squareDistance(DPoint aPoint)
square distance to another point

Parameters:
aPoint -
Returns:
distance

squareDistance

protected final double squareDistance(double x,
                                      double y)
plane square distance to another point

Parameters:
x -
y -
Returns:
distance

squareDistance

protected final double squareDistance(double x,
                                      double y,
                                      double z)
square distance to another point

Parameters:
x -
y -
z -
Returns:
distance

closedTo

protected final boolean closedTo(DPoint aPoint,
                                 double tolerence)
Check if the point is closed to the current point, ie if the distance between this and aPoint is inferior to tolerence.

Parameters:
aPoint -
tolerence -
Returns:
closedTo

toString

public final String toString()
Gives a string representation of this object.

Overrides:
toString in class Object
Returns:
DPoint GID [x y z]

equals

public final boolean equals(Object p)
We override the equals method, as two points can be said equal when their coordinate are exactly the same

Overrides:
equals in class Object
Parameters:
p -
Returns:
true if this and p are equal, in three dimensions.

hashCode

public final int hashCode()
Generate an hashcode based on the coordinates of the point.

Overrides:
hashCode in class Object
Returns:
a hash

equals2D

public final boolean equals2D(DPoint y)
Check if this==y, considering only the first two coordinates.

Parameters:
y -
Returns:
true if this and y are equal in 2D.

compareTo2D

public final int compareTo2D(DPoint p)
Compare this and p in two dimensions.

Parameters:
p -
Returns:
-1 : if this.x < p.x || (this.x == p.x && this.y < p.y)
0 : if this.x == p.x && this.y == p.y
1 otherwise.

compareTo

public final int compareTo(DPoint p)
Compare this and p in two dimensions.

Specified by:
compareTo in interface Comparable<DPoint>
Parameters:
p -
Returns:
-1 : if this.x < p.x || (this.x == p.x && this.y < p.y)
0 : if this.x == p.x && this.y == p.y
1 otherwise.

setColor

protected final void setColor(Graphics g)
Set the point color for the JFrame panel

Parameters:
g -

displayObject

public final void displayObject(Graphics g,
                                int decalageX,
                                int decalageY,
                                double minX,
                                double minY,
                                double scaleX,
                                double scaleY)
Display the point in a JPanel Must be used only when using package drawing

Parameters:
g -
decalageX -
decalageY -


Copyright © 2014 IRSTV CNRS-FR-2488. All Rights Reserved.