geometry
Class ImplicitGeometry

java.lang.Object
  extended bygeometry.ImplicitGeometry
All Implemented Interfaces:
Geometry

public class ImplicitGeometry
extends java.lang.Object
implements Geometry

A default affine geometry for cells, which are not points. If a GeoComplex doesn't contain any information about the geometry of a d-dimensional cell, it is assumed that the cell is a part of a d-dimensional affine space bounded by the cells in the boundary of the cell. The affine space is implicitly defined by the location and geometry of the boundary-cells. This works only if the boundary-cells are all contained in a unique d-dimensional affine space.

Author:
karsten

Field Summary
protected  GeoCell cell
           
protected  GeoComplex complex
           
protected  AffineSpace space
           
 
Constructor Summary
ImplicitGeometry(GeoComplex complex, GeoCell cell)
          Constructs the implicit geometry for a given cell of a GeoComplex.
 
Method Summary
 void addIntersection(HyperPlane plane, EditableGeoComplex target)
           
 AffineSpace affineClosure()
          Computes the smallest affine space, which contains this geometry
 boolean canBeContainedIn(Geometry other)
          Tests, if this geometry knows how to test if is contained in another geometry.
 boolean canContain(Geometry other)
          Tests, if this geometry knows how to test if it contains another geometry.
 boolean canIntersect(Geometry other)
          Tests, if this geometry knows how to intersect itself with another geometry.
 boolean contains(Geometry other)
          Tests, if this geometry contains another geometry.
 int dim()
          Returns the dimension of this geometry.
private  AffineSpace generatedSpace(GeoComplex complex, GeoCell cell)
          Computes the smallest affine space containing the boundary of a given cell
 Vector getNormal(Point p)
          Returns a normal vector onto a hypersurface in a given point (only possible if dim()+1 == outerDim())
 Point getOrigin()
          The origin of the local coordinate system.
 Geometry getRandomRay(Point origin)
          Construct a random one-dimensional submanifold, containing a given point.
 Geometry intersection(Geometry other)
          Intersects this geometry with another.
 boolean isContainedIn(Geometry other)
          Tests, if this geometry is contained in another geometry.
 Point localization(Point p)
          Converts a point (which is contained in the geometry) to coordinates local to the geometry.
private  java.awt.Shape makePolygon(java.util.Collection corners)
          Constructs a polygon from a collection of Point2D objects.
 int outerDim()
          Returns the dimension of the euclidean space containing this geometry.
private  java.util.Collection sortPolyCorners(java.util.Collection edges)
          Sorts the endpoints of a collection of Line2D-objects, so that these points describe the contiuous, closed path defined by the lines.
 java.awt.Shape toShape(java.awt.geom.AffineTransform transform)
          Returns the cell as Shape (only possible for 2-dimensional Complexes).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

complex

protected GeoComplex complex

cell

protected GeoCell cell

space

protected AffineSpace space
Constructor Detail

ImplicitGeometry

public ImplicitGeometry(GeoComplex complex,
                        GeoCell cell)
Constructs the implicit geometry for a given cell of a GeoComplex.

Parameters:
complex - a GeoComplex
cell - the cell contained in the complex, whose geometry will be described
Method Detail

addIntersection

public void addIntersection(HyperPlane plane,
                            EditableGeoComplex target)

toShape

public java.awt.Shape toShape(java.awt.geom.AffineTransform transform)
Description copied from interface: Geometry
Returns the cell as Shape (only possible for 2-dimensional Complexes).

Specified by:
toShape in interface Geometry
Returns:
intersection as Shape

affineClosure

public AffineSpace affineClosure()
Description copied from interface: Geometry
Computes the smallest affine space, which contains this geometry

Specified by:
affineClosure in interface Geometry
Returns:
the affine closure of this geometry

canIntersect

public boolean canIntersect(Geometry other)
Description copied from interface: Geometry
Tests, if this geometry knows how to intersect itself with another geometry.

Specified by:
canIntersect in interface Geometry
Parameters:
other - another geometry, which is to be intersected
Returns:
true if the method intersection will work

intersection

public Geometry intersection(Geometry other)
Description copied from interface: Geometry
Intersects this geometry with another. The intersection will be null, if the two geometries do not intersect. If this geometry doesn't know, how to intersect itself with the other geometry, it will throw an UnsupportedOperationException. This will happen only if canIntersect returns false.

Specified by:
intersection in interface Geometry
Parameters:
other - another geometry, which is to be intersected
Returns:
the intersection of the two geometries

dim

public int dim()
Description copied from interface: Geometry
Returns the dimension of this geometry.

Specified by:
dim in interface Geometry

outerDim

public int outerDim()
Description copied from interface: Geometry
Returns the dimension of the euclidean space containing this geometry.

Specified by:
outerDim in interface Geometry

canContain

public boolean canContain(Geometry other)
Description copied from interface: Geometry
Tests, if this geometry knows how to test if it contains another geometry. If the other geometry is a point, this has to be true.

Specified by:
canContain in interface Geometry
Parameters:
other - another geometry
Returns:
true if the method contains will work

contains

public boolean contains(Geometry other)
Description copied from interface: Geometry
Tests, if this geometry contains another geometry. If this geometry doesn't know, how to test this, it will throw an UnsupportedOperationException. This will happen only if canContain returns false.

Specified by:
contains in interface Geometry
Parameters:
other - another geometry
Returns:
true iff other is contained in the geometry.

canBeContainedIn

public boolean canBeContainedIn(Geometry other)
Description copied from interface: Geometry
Tests, if this geometry knows how to test if is contained in another geometry.

Specified by:
canBeContainedIn in interface Geometry
Parameters:
other - another geometry
Returns:
true if the method isContainedIn will work

isContainedIn

public boolean isContainedIn(Geometry other)
Description copied from interface: Geometry
Tests, if this geometry is contained in another geometry. If this geometry doesn't know, how to test this, it will throw an UnsupportedOperationException. This will happen only if canBeContainedIn returns false.

Specified by:
isContainedIn in interface Geometry
Parameters:
other - another geometry
Returns:
true iff this geometry contains other.

localization

public Point localization(Point p)
Description copied from interface: Geometry
Converts a point (which is contained in the geometry) to coordinates local to the geometry. The result will be a point containing dim() coordinates. The dimension of this geometry has to be nonzero.

Specified by:
localization in interface Geometry
Parameters:
p - a point contained in this geometry
Returns:
local coordinates of this point

getOrigin

public Point getOrigin()
Description copied from interface: Geometry
The origin of the local coordinate system.

Specified by:
getOrigin in interface Geometry
Returns:
the point whose localization is zero.

getNormal

public Vector getNormal(Point p)
Description copied from interface: Geometry
Returns a normal vector onto a hypersurface in a given point (only possible if dim()+1 == outerDim())

Specified by:
getNormal in interface Geometry
Parameters:
p - the starting point of the normal vector
Returns:
a vector orthogonal to the space in the point p

getRandomRay

public Geometry getRandomRay(Point origin)
Description copied from interface: Geometry
Construct a random one-dimensional submanifold, containing a given point. The point will become the origin of the compuded submanifold. The dimension of this geometry has to be nonzero.

Specified by:
getRandomRay in interface Geometry
Parameters:
origin - a point contained in this geometry
Returns:
a one-dimensional geometry, contained in this geometry, and containing the given origin

generatedSpace

private AffineSpace generatedSpace(GeoComplex complex,
                                   GeoCell cell)
Computes the smallest affine space containing the boundary of a given cell

Parameters:
complex - a GeoComplex
cell - the cell contained in the complex, whose geometry will be described
Returns:

makePolygon

private java.awt.Shape makePolygon(java.util.Collection corners)
Constructs a polygon from a collection of Point2D objects.

Parameters:
corners - the corners of the polygon
Returns:
the polygon as a shape

sortPolyCorners

private java.util.Collection sortPolyCorners(java.util.Collection edges)
Sorts the endpoints of a collection of Line2D-objects, so that these points describe the contiuous, closed path defined by the lines. The collection of lines will be destroyed!

Parameters:
edges - a collection of Line2D-objects
Returns:
a collection of Point2D-objects, describing the polygon defined by the edges