net.von_gagern.martin.confoo.mesh.flat
Class Mesh2D

java.lang.Object
  extended by net.von_gagern.martin.confoo.mesh.flat.Mesh2D
All Implemented Interfaces:
Iterable<Triangle2D>, CombinatoricMesh<Vertex2D>, LocatedMesh<Vertex2D>, MetricMesh<Vertex2D>

public class Mesh2D
extends Object
implements LocatedMesh<Vertex2D>, Iterable<Triangle2D>

A 2D triangle mesh.

Vertices of this mesh are identified by their coordinates, not object identity.

Since:
1.0
Author:
Martin von Gagern

Constructor Summary
Mesh2D(Collection<? extends CorneredTriangle<? extends Point2D>> mesh)
          Construct 2D mesh from collection of triangles.
Mesh2D(LocatedMesh<V> mesh)
          Construct 2D mesh from a located mesh.
 
Method Summary
 double edgeLength(Vertex2D v1, Vertex2D v2)
          Determine edge length.
 Shape getBoundary()
          Retrieve boundary shape.
 Set<Edge2D> getBoundaryEdges()
          Retrieve collection of all boundary edges.
 Set<Edge2D> getEdges()
          Retrieve collection of all edges.
 Set<Edge2D> getInteriorEdges()
          Retrieve collection of all interior edges.
 List<Triangle2D> getTriangles()
          Retrieve collection of triangles.
 double getX(Vertex2D v)
          Get x coordinate of vertex.
 double getY(Vertex2D v)
          Get y coordinate of vertex.
 double getZ(Vertex2D v)
          Get z coordinate of vertex.
 Iterator<Triangle2D> iterator()
          Return iterator over all triangles.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Mesh2D

public Mesh2D(LocatedMesh<V> mesh)
Construct 2D mesh from a located mesh. The z coordinates of the input mesh will be simply ignored. After construction the two meshes will be independent.

Parameters:
mesh - the mesh to be copied

Mesh2D

public Mesh2D(Collection<? extends CorneredTriangle<? extends Point2D>> mesh)
Construct 2D mesh from collection of triangles. After construction the mesh will be independent.

Parameters:
mesh - the triangles making up the mesh
Method Detail

iterator

public Iterator<Triangle2D> iterator()
Return iterator over all triangles.

Specified by:
iterator in interface Iterable<Triangle2D>
Specified by:
iterator in interface CombinatoricMesh<Vertex2D>
Returns:
an iterator over the triangles of the mesh
See Also:
Iterable.iterator(), MeshIterator

edgeLength

public double edgeLength(Vertex2D v1,
                         Vertex2D v2)
Determine edge length.

Specified by:
edgeLength in interface MetricMesh<Vertex2D>
Parameters:
v1 - one vertex
v2 - a second vertex
Returns:
the distance between the vertices

getX

public double getX(Vertex2D v)
Get x coordinate of vertex.

Specified by:
getX in interface LocatedMesh<Vertex2D>
Parameters:
v - a vertex
Returns:
the x coordinate of v

getY

public double getY(Vertex2D v)
Get y coordinate of vertex.

Specified by:
getY in interface LocatedMesh<Vertex2D>
Parameters:
v - a vertex
Returns:
the y coordinate of v

getZ

public double getZ(Vertex2D v)
Get z coordinate of vertex. As this is a 2D mesh, this method will always return zero.

Specified by:
getZ in interface LocatedMesh<Vertex2D>
Parameters:
v - a vertex
Returns:
zero

getTriangles

public List<Triangle2D> getTriangles()
Retrieve collection of triangles.

Returns:
the list of all triangles

getEdges

public Set<Edge2D> getEdges()
Retrieve collection of all edges.

Returns:
the set of all edges

getInteriorEdges

public Set<Edge2D> getInteriorEdges()
Retrieve collection of all interior edges. Interior edges are edges incident to more than one triangle.

Returns:
the set of all interior edges

getBoundaryEdges

public Set<Edge2D> getBoundaryEdges()
Retrieve collection of all boundary edges. Boundary edges are edges incident to only one triangle.

Returns:
the set of all boundary edges

getBoundary

public Shape getBoundary()
Retrieve boundary shape. This is the shape consisting of all polygones made up by boundary edges.

Returns:
the boundary shape


Copyright © 2008 Martin von Gagern. All Rights Reserved.