jwo.landserf.structure
Class Node

java.lang.Object
  extended byjwo.landserf.structure.Node
All Implemented Interfaces:
Serializable

public class Node
extends Object
implements Serializable

Stores a topological node and pointer to an edge for higher dimensional features. Used to create TIN structures. Nodes may be either 2d or 3d.

Version:
2.2, 28th February, 2002.
Author:
Jo Wood
See Also:
Edge, Serialized Form

Field Summary
static int EXTERIOR
          Identifies a node at the outer edge of a network.
static int HULL
          Identifies a node that is part of a convex hull.
static int INNER
          Identifies an inner node.
static int UNDEFINED
          Undefined type.
 
Constructor Summary
Node(float x, float y)
          Creates a 2-d node with given coordinates.
Node(float x, float y, Edge edge)
          Creates a 2-d node with given coordinates associated with given edge.
Node(float x, float y, float z)
          Creates a 3-d node with given coordinates.
Node(float x, float y, float z, Edge edge)
          Creates a 3-d node with given coordinates associated with given edge.
 
Method Summary
 float calcDistance(double px, double py)
          Reports the 2-d Euclidean distance between the given point and this node.
 float calcDistance(float px, float py, float pz)
          Reports the 3-d Euclidean distance between the given point and this node.
 boolean equals2d(Node node)
          Compares the 2d coordinates of a given node with this one.
 boolean equals3d(Node node)
          Compares the 3d coordinates of a given node with this one.
 Edge getEdge()
          Reports an edge that this node is connected to.
 float getVersion()
          Reports the version of the object.
 float getX()
          Reports the x-coordinate of this node.
 float getY()
          Reports the y-coordinate of this node.
 float getZ()
          Reports the z-coordinate of this node.
 void setEdge(Edge edge)
          Sets the edge that this node is connected to.
 void setVersion(float version)
          Sets the version number of this object.
 void setX(float x)
          Sets the x-coordinate associated with this node.
 void setY(float y)
          Sets the y-coordinate associated with this node.
 void setZ(float z)
          Sets the z-coordinate associated with this node.
 String toString()
          Reports the coordinates of this node.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

UNDEFINED

public static final int UNDEFINED
Undefined type.

See Also:
Constant Field Values

INNER

public static final int INNER
Identifies an inner node.

See Also:
Constant Field Values

HULL

public static final int HULL
Identifies a node that is part of a convex hull.

See Also:
Constant Field Values

EXTERIOR

public static final int EXTERIOR
Identifies a node at the outer edge of a network.

See Also:
Constant Field Values
Constructor Detail

Node

public Node(float x,
            float y)
Creates a 2-d node with given coordinates.

Parameters:
x - x coordinate of node.
y - y coordinate of node.

Node

public Node(float x,
            float y,
            float z)
Creates a 3-d node with given coordinates.

Parameters:
x - x coordinate of node.
y - y coordinate of node.
z - z coordinate of node.

Node

public Node(float x,
            float y,
            Edge edge)
Creates a 2-d node with given coordinates associated with given edge.

Parameters:
x - x coordinate of node.
y - y coordinate of node.
edge - Edge that this node is part of.

Node

public Node(float x,
            float y,
            float z,
            Edge edge)
Creates a 3-d node with given coordinates associated with given edge.

Parameters:
x - x coordinate of node.
y - y coordinate of node.
z - z coordinate of node.
edge - Edge that this node is part of.
Method Detail

calcDistance

public float calcDistance(double px,
                          double py)
Reports the 2-d Euclidean distance between the given point and this node.

Parameters:
px - x coordinate of point to measure to.
py - y coordinate of point to measure to.
Returns:
Distance between node and given point.

calcDistance

public float calcDistance(float px,
                          float py,
                          float pz)
Reports the 3-d Euclidean distance between the given point and this node.

Parameters:
px - x coordinate of point to measure to.
py - y coordinate of point to measure to.
pz - z coordinate of point to measure to.
Returns:
Distance between node and given point.

equals2d

public boolean equals2d(Node node)
Compares the 2d coordinates of a given node with this one.

Parameters:
node - Node to compare.
Returns:
True if nodes have the same 2d location.

equals3d

public boolean equals3d(Node node)
Compares the 3d coordinates of a given node with this one.

Parameters:
node - Node to compare.
Returns:
True if nodes have the same 3d location.

toString

public String toString()
Reports the coordinates of this node. Overrides the method in Object.

Returns:
String representation of this node.

getX

public float getX()
Reports the x-coordinate of this node.

Returns:
x-coordinate of this node.

setX

public void setX(float x)
Sets the x-coordinate associated with this node.

Parameters:
x - x-coordinate associated with this node.

getY

public float getY()
Reports the y-coordinate of this node.

Returns:
y-coordinate of this node.

setY

public void setY(float y)
Sets the y-coordinate associated with this node.

Parameters:
y - y-coordinate associated with this node.

getZ

public float getZ()
Reports the z-coordinate of this node.

Returns:
z-coordinate of this node.

setZ

public void setZ(float z)
Sets the z-coordinate associated with this node.

Parameters:
z - z-coordinate associated with this node.

getEdge

public Edge getEdge()
Reports an edge that this node is connected to.

Returns:
An edge that this node is connected to.

setEdge

public void setEdge(Edge edge)
Sets the edge that this node is connected to.

Parameters:
edge - Edge to associate with this node.

getVersion

public float getVersion()
Reports the version of the object. This can be useful when serialising future (changed) versions of this class.

Returns:
Version number of this object.

setVersion

public void setVersion(float version)
Sets the version number of this object.

Parameters:
version - Version number of this object.


Copyright Jo Wood, 1996-2005, last modified, 11th March, 2005