cz.cuni.utils.math.vertexSpace.vertex3Dspace
Class Vertex3DSpaceCube

java.lang.Object
  extended by cz.cuni.utils.math.vertexSpace.vertex3Dspace.Vertex3DSpaceCube

public class Vertex3DSpaceCube
extends java.lang.Object

This represent one cube of the VertexSpace. It may contain more then one vertex and is responsible for raising the errors if three vertices which are too close are inserted. It goes like this: 1) first vertex creates an epsilon surrounding, other vertices in those surrounding is reported as the first one 2) note that distance of 2 points may be 1.5 epsilon and the third one may lie in both surroundings - that's the time when error is reported Also - those cubes will be stored in HashMap for quick search. So we will need a hash and equal function. equals() is considering precision, size, x, y, z, NOT STORED VERTICES! Use add(Tuple3D) to insert and obtain a Vertex.


Field Summary
protected  int hashCode
           
protected  double precision
           
protected  int precisionInt
           
(package private)  java.util.HashSet vertices
           
protected  double[] x
          X-Extends of the space cube. x[0] < x[1]
protected  double[] y
          Y-Extends of the space cube. y[0] < y[1]
protected  double[] z
          Z-Extends of the space cube. z[0] < z[1]
 
Constructor Summary
Vertex3DSpaceCube(double[] xyz, double iSize, int iPrecisionInt)
           
Vertex3DSpaceCube(double iX, double iY, double iZ, double iSize, int iPrecisionInt)
           
 
Method Summary
 Vertex3D addReferenceUnsafe(Vertex3D v)
           
 boolean equals(java.lang.Object obj)
           
static int getHash(double x, double y, double z, double size, int precisionInt)
          Returns hash code for the cube which starts at x, y, z with a certain precision.
 int hashCode()
           
 java.util.ArrayList check(Tuple3D tuple)
          Returns list of vertices in whose surroundings tuple lies.
 void remove(Vertex3D vertex)
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

x

protected double[] x
X-Extends of the space cube. x[0] < x[1]


y

protected double[] y
Y-Extends of the space cube. y[0] < y[1]


z

protected double[] z
Z-Extends of the space cube. z[0] < z[1]


precisionInt

protected int precisionInt

precision

protected double precision

hashCode

protected final int hashCode

vertices

java.util.HashSet vertices
Constructor Detail

Vertex3DSpaceCube

public Vertex3DSpaceCube(double iX,
                         double iY,
                         double iZ,
                         double iSize,
                         int iPrecisionInt)

Vertex3DSpaceCube

public Vertex3DSpaceCube(double[] xyz,
                         double iSize,
                         int iPrecisionInt)
Method Detail

getHash

public static int getHash(double x,
                          double y,
                          double z,
                          double size,
                          int precisionInt)
Returns hash code for the cube which starts at x, y, z with a certain precision.

Parameters:
x -
y -
z -
precisionInt -

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object

check

public java.util.ArrayList check(Tuple3D tuple)
Returns list of vertices in whose surroundings tuple lies.

Parameters:
tuple -
Returns:
ArrayList

remove

public void remove(Vertex3D vertex)

addReferenceUnsafe

public Vertex3D addReferenceUnsafe(Vertex3D v)