geometry
Class Point

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

public class Point
extends java.lang.Object
implements Geometry

Represents a point in n-dimensional space, defined by a vector containing the coordinats of this point.

Author:
karsten

Field Summary
protected  Vector coords
          A vector containig the coordinats of this point.
 
Constructor Summary
Point(double[] coords)
          Constructs a point with the given coordinates.
Point(int dim)
          Constructs the origin of the given dimension.
Point(int dim, int coord)
          Constructs a point from a unit coordinate-vector.
Point(Vector v)
          Constructs a point with the coordinates given by a vector.
 
Method Summary
 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.
 Point copy()
          Returns a deep copy of this point.
 int dim()
          Returns the dimension of this geometry.
 double getCoord(int i)
          Gets the i-th coordinate of this point.
 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.
 Vector getVector()
          Constructs a point with the coordinates given by a vector.
 Vector getVectorTo(Point other)
          Computes the vector from this point to another 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.
 int outerDim()
          Returns the dimension of the space containg this point.
 void setCoord(int i, double value)
          Sets the i-th coordinate of this point to a given value.
 java.awt.Shape toShape(java.awt.geom.AffineTransform transform)
          Returns the cell as Shape (only possible for 2-dimensional Complexes).
 java.lang.String toString()
          Returns a String representation of this vector.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

coords

protected Vector coords
A vector containig the coordinats of this point.

Constructor Detail

Point

public Point(int dim)
Constructs the origin of the given dimension. All entries will be zero.

Parameters:
dim - the number of coordinates

Point

public Point(int dim,
             int coord)
Constructs a point from a unit coordinate-vector. All entries except one will be zero.

Parameters:
dim - the number of coordinates
coord - the index of the only non-zero coordinate of this point

Point

public Point(double[] coords)
Constructs a point with the given coordinates. Attention: The first entry coords[0] will be the first entry of the vecor get(1)

Parameters:
coords - the coordinates of this point

Point

public Point(Vector v)
Constructs a point with the coordinates given by a vector. The coordinates are not copied from the vector!

Parameters:
v - a vector containing the coordinates of this point
Method Detail

getVector

public Vector getVector()
Constructs a point with the coordinates given by a vector. The coordinates are not copied from the vector!

Returns:
a vector containing the coordinates of this point

getVectorTo

public Vector getVectorTo(Point other)
Computes the vector from this point to another point.

Parameters:
other - another point
Returns:
a vector from this point to the other point

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

setCoord

public void setCoord(int i,
                     double value)
Sets the i-th coordinate of this point to a given value. The first index is 1.

Parameters:
i - the index of the changing coordinate
value - the new value for the selected coordinate

getCoord

public double getCoord(int i)
Gets the i-th coordinate of this point. The first index is 1.

Parameters:
i - the index of a coordinate
Returns:
the value at the selected coordinate

outerDim

public int outerDim()
Returns the dimension of the space containg this point.

Specified by:
outerDim in interface Geometry
Returns:
the number of coordinates of this point

dim

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

Specified by:
dim 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.

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

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

toString

public java.lang.String toString()
Returns a String representation of this vector.

Returns:
a string containing every coordinate of this point

copy

public Point copy()
Returns a deep copy of this point.