org.jdelaunay.delaunay.tools
Class Tools

java.lang.Object
  extended by org.jdelaunay.delaunay.tools.Tools

public final class Tools
extends Object

A set of utility methods

Author:
Alexis Guéganno, Jean-Yves Martin

Field Summary
static int BIT_LEVEL
           
static int BIT_LOCKED
           
static int BIT_MARKED
           
static int BIT_OUTSIDE
           
static int BIT_POLYGON
           
static int BIT_ZUSED
           
static double EPSILON
           
static double EPSILON2
           
 
Method Summary
static
<T extends Element>
int
addToSortedList(T elt, List<T> sortedList, Comparator<T> comp)
          Add an element to the list.
static DPoint computeIntersection(DPoint p1, DPoint v1, DPoint p2, DPoint v2)
          Calcule le point d'intersection de 2 droites coplanaires
static boolean isColinear(DPoint v1, DPoint v2)
          Checks that the vectors resulting from v1 and v2 are colinear.
static boolean isVerticallySorted(List<DEdge> edgeList, double abs)
          Check if the list given in argument is vertically sorted or not.
static
<T extends Element>
int
sortedListContains(List<T> sortedList, T elt, Comparator<T> comp)
          Search the element elt in the sorted list sortedList.
static DPoint vectorialDiff(DPoint v1, DPoint v2)
          Compute the difference between two vectors.
static DPoint vectorProduct(DPoint v1, DPoint v2)
          Compute the vector product from the vectors v1 and v2 represented with DPoint
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EPSILON

public static final double EPSILON
See Also:
Constant Field Values

EPSILON2

public static final double EPSILON2
See Also:
Constant Field Values

BIT_OUTSIDE

public static final int BIT_OUTSIDE
See Also:
Constant Field Values

BIT_LOCKED

public static final int BIT_LOCKED
See Also:
Constant Field Values

BIT_LEVEL

public static final int BIT_LEVEL
See Also:
Constant Field Values

BIT_POLYGON

public static final int BIT_POLYGON
See Also:
Constant Field Values

BIT_ZUSED

public static final int BIT_ZUSED
See Also:
Constant Field Values

BIT_MARKED

public static final int BIT_MARKED
See Also:
Constant Field Values
Method Detail

addToSortedList

public static <T extends Element> int addToSortedList(T elt,
                                                      List<T> sortedList,
                                                      Comparator<T> comp)
Add an element to the list. This method takes care to ensure that we don't insert duplicated items in the list.

Type Parameters:
T -
Parameters:
elt -
sortedList -
comp -
Returns:
the position of the element in the list.

sortedListContains

public static <T extends Element> int sortedListContains(List<T> sortedList,
                                                         T elt,
                                                         Comparator<T> comp)
Search the element elt in the sorted list sortedList. You are supposed to be sure that sortedList is actually sorted ;-)

Type Parameters:
T -
Parameters:
sortedList -
elt -
Returns:
the index of the element, or (-1-index) where index would be the index of the element after insertion

vectorProduct

public static DPoint vectorProduct(DPoint v1,
                                   DPoint v2)
                            throws DelaunayError
Compute the vector product from the vectors v1 and v2 represented with DPoint

Parameters:
v1 -
v2 -
Returns:
The vector product as a DPoint.
Throws:
DelaunayError

isColinear

public static boolean isColinear(DPoint v1,
                                 DPoint v2)
Checks that the vectors resulting from v1 and v2 are colinear.

Parameters:
v1 -
v2 -
Returns:
true if v1 and v2 are colinear.

vectorialDiff

public static DPoint vectorialDiff(DPoint v1,
                                   DPoint v2)
                            throws DelaunayError
Compute the difference between two vectors.

Parameters:
v1 -
v2 -
Returns:
v1 - v2
Throws:
DelaunayError

computeIntersection

public static DPoint computeIntersection(DPoint p1,
                                         DPoint v1,
                                         DPoint p2,
                                         DPoint v2)
                                  throws DelaunayError
Calcule le point d'intersection de 2 droites coplanaires

Parameters:
p1 - point de la premiere droite
v1 - vecteur directeur de la premiere droite
p2 - point de la seconde droite
v2 - vecteur directeur de la seconde droite
Returns:
coordonnees du point d'intersection des 2 droites ou null si les droites sont parrallèles
Throws:
DelaunayError

isVerticallySorted

public static boolean isVerticallySorted(List<DEdge> edgeList,
                                         double abs)
                                  throws DelaunayError
Check if the list given in argument is vertically sorted or not.

Parameters:
edgeList -
Returns:
true if edgeList is vertically sorted.
Throws:
DelaunayError
See Also:
VerticalComparator


Copyright © 2014 IRSTV CNRS-FR-2488. All Rights Reserved.