org.xistrat.math
Class GraphTopology

java.lang.Object
  extended by org.xistrat.math.GraphTopology

public class GraphTopology
extends java.lang.Object

here general tools for dealing with graphs can be found (is topology the correct name? or better geometry?)

Since:
0.5.42

Field Summary
static int NOTSET
           
 
Constructor Summary
GraphTopology()
           
 
Method Summary
static boolean areEqual(int[] a, int[] b, int poly)
          are those 2 faces about the same face?
static int distanceInEdges(int location, int last, int next, FaceData faceData)
          we assume (in order to save time) that (location,last) and (next, location) exist
static int gcd(int a, int b)
          Euclid's algorithm
static int[] getConnectingEdge(int center, int faceA, FaceData faceData)
          it is actually not assumed that the result is uniquely determined, but at least the 2 polygons have got the same orientation and are connected
static int[] getCorrespondingEdge(int a, int b, FastFace fastFace)
          it is already assumed that the points are connected!
static int getDistance(FigurData theFig, int target, FastFace fastFace, FigurData[] _figures, int index)
           
static int[] getNeighbours(int k, FaceData faceData)
           
static int[] getNeighbours(int k, FaceData faceData, boolean onlyStart)
          get neighbours (without using an edge iterator) neisF[k][0] will not necessarily go over an edge with the points face[0][k], face[1][k] (we could change the order of loops below to achieve this, but instead we prefer knowing for sure that neisF[k][0] is always not pointing to a hole)
static boolean haveSameOrientation(int center, int faceA, FaceData faceData)
           
static boolean isConnnectedVia(int n, int i, FaceData faceData)
          is face i connected via edge n, (n+1)%poly to another face, or is this a boundary edge?
static boolean isNei(int loca, int locb, FastFace fastFace)
          are those two faces neighboured
static boolean isNei(int i, java.util.LinkedList<java.lang.Integer> help, FastFace fastFace)
          used for morphing stuff
static boolean isNeighbourHood(int k, int i, FaceData faceData)
          are those 2 faces having at least one edge in common?
static boolean isNeighbourHood(int k, int i, FastFace fastFace)
          are those 2 faces having at least one edge in common?
static boolean notContAlready(java.util.LinkedList<java.util.LinkedList<java.lang.Integer>> current, java.util.LinkedList<java.lang.Integer> help)
          for morphing lists have to be sorted
static boolean notMember(int i, java.util.LinkedList<java.lang.Integer> help)
          used for morphing
static boolean shareVertex(int a, int b, FaceData faceData)
          do those 2 faces share common vertex?
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NOTSET

public static final int NOTSET
See Also:
Constant Field Values
Constructor Detail

GraphTopology

public GraphTopology()
Method Detail

areEqual

public static boolean areEqual(int[] a,
                               int[] b,
                               int poly)
are those 2 faces about the same face?


shareVertex

public static boolean shareVertex(int a,
                                  int b,
                                  FaceData faceData)
do those 2 faces share common vertex?


isConnnectedVia

public static boolean isConnnectedVia(int n,
                                      int i,
                                      FaceData faceData)
is face i connected via edge n, (n+1)%poly to another face, or is this a boundary edge?

assumes that the faces are already properly oriented


getCorrespondingEdge

public static int[] getCorrespondingEdge(int a,
                                         int b,
                                         FastFace fastFace)
it is already assumed that the points are connected!

supposed to be the inverse of getConnectingEdge()

Parameters:
a - is in [0, .., _vertices-1]
b - is in [0, .., _vertices-1]
fastFace -
Returns:
values in [0, .., faces-1]
Since:
0.6.90

getConnectingEdge

public static int[] getConnectingEdge(int center,
                                      int faceA,
                                      FaceData faceData)
it is actually not assumed that the result is uniquely determined, but at least the 2 polygons have got the same orientation and are connected

Parameters:
center - is within [0, .. polygons-1] (invalid incl.)
faceA - is within [0, .. polygons-1] (invalid incl.)
faceData -
Returns:
the first connecting edge (of possibly multiple edges) between the two polygons

haveSameOrientation

public static boolean haveSameOrientation(int center,
                                          int faceA,
                                          FaceData faceData)
Parameters:
center - 2 faces what are proved to be connected (possibly over more than 1 edge...)

distanceInEdges

public static int distanceInEdges(int location,
                                  int last,
                                  int next,
                                  FaceData faceData)
we assume (in order to save time) that (location,last) and (next, location) exist


getDistance

public static int getDistance(FigurData theFig,
                              int target,
                              FastFace fastFace,
                              FigurData[] _figures,
                              int index)
Parameters:
target - valid face within [0, .. faces-1]

breadth - first search

See Also:
ChessEngine, ExportData

notContAlready

public static boolean notContAlready(java.util.LinkedList<java.util.LinkedList<java.lang.Integer>> current,
                                     java.util.LinkedList<java.lang.Integer> help)
for morphing

lists have to be sorted

Parameters:
current - a LinkedList of LinkedLists of Integers
help - a LinkedList of Integers

notMember

public static boolean notMember(int i,
                                java.util.LinkedList<java.lang.Integer> help)
used for morphing


isNei

public static boolean isNei(int i,
                            java.util.LinkedList<java.lang.Integer> help,
                            FastFace fastFace)
used for morphing stuff


isNeighbourHood

public static boolean isNeighbourHood(int k,
                                      int i,
                                      FastFace fastFace)
are those 2 faces having at least one edge in common? common vertex is not sufficient


isNeighbourHood

public static boolean isNeighbourHood(int k,
                                      int i,
                                      FaceData faceData)
are those 2 faces having at least one edge in common? common vertex is not sufficient


getNeighbours

public static int[] getNeighbours(int k,
                                  FaceData faceData)

getNeighbours

public static int[] getNeighbours(int k,
                                  FaceData faceData,
                                  boolean onlyStart)
get neighbours (without using an edge iterator)

neisF[k][0] will not necessarily go over an edge with the points face[0][k], face[1][k] (we could change the order of loops below to achieve this, but instead we prefer knowing for sure that neisF[k][0] is always not pointing to a hole)

Parameters:
k - within [0, .., polygons-1]
onlyStart - if only the first neighbour is needed, for example as used in FastFace.buildNeis() because the other info is redone there again anyway
Returns:
values within [0, .., polygons-1]

isNei

public static boolean isNei(int loca,
                            int locb,
                            FastFace fastFace)
are those two faces neighboured

Since:
0.6.90

gcd

public static int gcd(int a,
                      int b)
Euclid's algorithm

Since:
0.6.90