|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjwo.landserf.structure.DelaunayTriang
public class DelaunayTriang
Creates and stores a Delaunay triangulation. Useful for representing TINs and calculating the Voronoi diagram. Adapted from Zhao and Saalfeld, 1996.
Triangle
,
Serialized FormField Summary | |
---|---|
static int |
OUTSIDE
Indicates that a location is outside the convex hull. |
Fields inherited from interface jwo.landserf.structure.SpatialModel |
---|
ADJACENT, AREA, CONTOUR, ENCLOSES, INTERSECTION, LINE, MATCHES, MSN, NO_VALUE, OUT_OF_BOUNDS, OVERLAPS, POINT, RASTER_2D, RASTER_3D, SEPARATE, TIN, UNDEFINED, UNION, UNKNOWN, UNKNOWN_MODEL, VECTOR_2D, VECTOR_3D, VOLUME, WITHIN |
Constructor Summary | |
---|---|
DelaunayTriang(DelaunayTriang triang)
Creates a new triangulation based on the contents of the the given Delaunay triangulation. |
|
DelaunayTriang(int size)
Initialises a triangulation with a given initial size. |
Method Summary | |
---|---|
int |
compare(SpatialModel other)
Makes a spatial comparison between this object and another. |
void |
deletePoint(float px,
float py)
Deletes the point nearest to the given coordinates and recalculates the trianglulation. |
void |
expandHull(Node nd)
Adds a given node to the convex hull of the triangulation. |
void |
expandTriang(Edge e,
Node nd,
int type)
Expands the triangle. |
Triangle |
findTriangle(Edge edge)
Finds the triangle that contains the given edge. |
Triangle |
findTriangle(float px,
float py)
Finds the triangle that surrounds the given point. |
Node |
findTriangleNode(Edge edge)
Finds the node that makes the triangle with the given edge. |
Triangle[] |
findTriangles(Edge edge)
Finds the triangles that contain the given edge. |
float |
getAttribute(Footprint fp)
Reports the attribute of at the given location. |
Footprint |
getBounds()
Returns the 2d bounding rectangle of this triangulation. |
float[] |
getEdgesX()
Returns the x coordinates of the edges of the triangulation. |
float[] |
getEdgesY()
Returns the y coordinates of the edges of the triangulation. |
float[] |
getEdgesZ()
Returns the z coordinates of the edges of the triangulation. |
Header |
getHeader()
Reports the header information associated with this triangulation. |
void |
getImage(int[] img,
int imgWidth)
Can be used to get an image representation of this triangulation but does nothing in this case. |
float |
getInterpolatedHeight(float px,
float py,
boolean useQuad)
Interpolates the z value at a given location based on the either plane or quadratic surface passing though the triangle surrounding this point. |
float[] |
getMER()
Returns the minimum enclosing rectangle of the last triangles to be affected by the insertion or removal of a new point. |
float[] |
getNodesX()
Returns the x coordinates of the nodes of the triangulation. |
float[] |
getNodesY()
Returns the y coordinates of the nodes of the triangulation. |
float[] |
getNodesZ()
Returns the z coordinates of the nodes of the triangulation. |
int |
getNumTriangles()
Reports the number of triangles stored in the triangulation. |
float[] |
getTrianglesX()
Returns the x coordinates of the triangles that make up the Delaunay triangulation. |
float[] |
getTrianglesY()
Returns the y coordinates of the triangles that make up the Delaunay triangulation. |
float[] |
getTrianglesZ()
Returns the z coordinates of the triangles that make up the Delaunay triangulation. |
int |
getType()
Reports the type of spatial object which is always SpatialModel.TIN. |
float |
getVersion()
Reports the version of the object. |
void |
insertPoint(float px,
float py)
Inserts a new 2d point into the network and recalculates the triangulation. |
void |
insertPoint(float px,
float py,
float pz)
Inserts a new 3d point into the network and recalculates the triangulation. |
boolean |
isNearNode(float x,
float y,
float distance)
Looks for a node within a given distance of the give point. |
Node |
nearestNode(float x,
float y)
Finds the node nearest to the given coordinates. |
void |
recalculateParams()
Recalculates the triangle parameters. |
void |
resetTriangulation()
Resets triangluation by removing all triangles from the network. |
int |
searchEdge(Edge e,
Node nd)
Find the active edge associated with given node. |
void |
setBounds(Footprint footprint)
Sets the bounding rectangle of this triangulation. |
void |
setVersion(float version)
Sets the version number of this object. |
SpatialModel |
subset(Footprint clipRect)
Creates a subset of this TIN by clipping to the given rectangle. |
void |
swapTest(Edge e11)
Swaps candidate edges and retriangulates if necessary. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int OUTSIDE
Constructor Detail |
---|
public DelaunayTriang(int size)
size
- Initial number of triangles in network.public DelaunayTriang(DelaunayTriang triang)
triang
- Triangulation to copy.Method Detail |
---|
public int compare(SpatialModel other)
compare
in interface SpatialModel
other
- Spatial model with which to make a comparison.
public void setBounds(Footprint footprint)
setBounds
in interface SpatialModel
footprint
- Spatial footprint to assign to this triangulation.public Footprint getBounds()
getBounds
in interface SpatialModel
public float getAttribute(Footprint fp)
getAttribute
in interface SpatialModel
fp
- Location to query.
public Header getHeader()
getHeader
in interface SpatialModel
public void getImage(int[] img, int imgWidth)
getImage
in interface SpatialModel
img
- Image array to store colours.imgWidth
- Image width.public int getType()
getType
in interface SpatialModel
public SpatialModel subset(Footprint clipRect)
subset
in interface SpatialModel
clipRect
- Clipping rectangle.
public void resetTriangulation()
public void insertPoint(float px, float py)
px
- x-coordinate of the new point.py
- y-coordinate of the new point.public void insertPoint(float px, float py, float pz)
px
- x-coordinate of the new point.py
- y-coordinate of the new point.pz
- z-coordinate of the new point.public void deletePoint(float px, float py)
px
- x-coordinate of the point to delete.py
- y-coordinate of the point to delete.public void expandTriang(Edge e, Node nd, int type)
e
- Edge of triangle to expand.nd
- Node to add to the triangle.type
- Type of edge (internal or convex hull).public void expandHull(Node nd)
nd
- Node to add to the hull.public int searchEdge(Edge e, Node nd)
e
- Initial edge to search from.nd
- Node to compare.
Edge
,
Node
public void swapTest(Edge e11)
e11
- Candidate edge to consider.public Node nearestNode(float x, float y)
x
- x-coordinate of point.y
- y-coordinate of point.
public boolean isNearNode(float x, float y, float distance)
x
- x-coordinate of point.y
- y-coordinate of point.distance
- 'Snapping distance' to compare.
public Triangle findTriangle(float px, float py)
px
- x coordinate of point to query.py
- y coordinate of point to query.
public Triangle findTriangle(Edge edge)
edge
- edge to search from. Returns null if less than three nodes present.
public Triangle[] findTriangles(Edge edge)
edge
- edge to search from.
public Node findTriangleNode(Edge edge)
edge
- edge to examine.
public float getInterpolatedHeight(float px, float py, boolean useQuad)
px
- x coordinate of the location to interpolate.py
- y coordinate of the location to interpolate.useQuad
- Quadratic interpolation used if true, otherwise planar.
public void recalculateParams()
public float[] getMER()
public float[] getNodesX()
public float[] getNodesY()
public float[] getNodesZ()
public float[] getEdgesX()
public float[] getEdgesY()
public float[] getEdgesZ()
public int getNumTriangles()
public float[] getTrianglesX()
public float[] getTrianglesY()
public float[] getTrianglesZ()
public float getVersion()
public void setVersion(float version)
version
- Version number of this object.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |