|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcz.cuni.utils.math.vertexSpace.vertex2Dspace.Vertex2DSpaceSimple
public class Vertex2DSpaceSimple
In graphics we're in fact are working with discreet space. In math.M you have constants EPSILON / etc. which defines precision we're counting with. Vertex hash codes are created with respect to this precision (as they may not have doubles in x, y but long ~ discreet space). Idea behind this class is, that we're filling HashMap with vertexes and when we want to add vertex to a place where already someone is, we returns reference to an existing vertex instead.
Field Summary | |
---|---|
Vertex2DFactoryInterface |
vertexFactory
|
java.util.HashMap |
vertices
|
Constructor Summary | |
---|---|
Vertex2DSpaceSimple(Vertex2DFactoryInterface vfi)
|
Method Summary | |
---|---|
void |
clear()
Clears information about vertices, which have been created. |
Vertex2D |
get(double x,
double y)
Should return existing or new vertex which has "equal" coordinates. |
Vertex2D |
get(Tuple2D t)
Should return existing or new vertex which has "equal" coordinates. |
void |
remove(Vertex2D v)
Vertex must be removed from the space |
void |
set(Vertex2D v)
You have to insert this vertex into space, possibly overwriting the existing one. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public final Vertex2DFactoryInterface vertexFactory
public java.util.HashMap vertices
Constructor Detail |
---|
public Vertex2DSpaceSimple(Vertex2DFactoryInterface vfi)
Method Detail |
---|
public Vertex2D get(Tuple2D t)
Vertex2DSpaceInterface
get
in interface Vertex2DSpaceInterface
public Vertex2D get(double x, double y)
Vertex2DSpaceInterface
get
in interface Vertex2DSpaceInterface
x
- coordinatey
- coordinate
public void set(Vertex2D v)
Vertex2DSpaceInterface
set
in interface Vertex2DSpaceInterface
public void remove(Vertex2D v)
Vertex2DSpaceInterface
remove
in interface Vertex2DSpaceInterface
public void clear()
clear
in interface Vertex2DSpaceInterface
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |