Commit 2c00283e authored by Benedikt Zoennchen's avatar Benedikt Zoennchen
Browse files

change pom and javadoc.

parent 1b2845a6
......@@ -119,13 +119,7 @@
<!-- end generated by lwjgl -->
<dependencies>
<!-- utility methods i.e. StopWatch -->
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>r05</version>
</dependency>
<!-- GeoLib: JTS -->
<dependency>
<groupId>com.vividsolutions</groupId>
<artifactId>jts</artifactId>
......
......@@ -3,8 +3,7 @@ package org.vadere.geometry;
import org.vadere.geometry.shapes.VPoint;
/**
* VPoint with implementation of the comparable interface.
*
* @author Benedikt Zoennchen
*/
public class ComparablePoint extends VPoint implements
Comparable<ComparablePoint> {
......@@ -20,8 +19,15 @@ public class ComparablePoint extends VPoint implements
/**
* Checks whether the given point is greater than the current point with
* respect to:<br>
* 1. x-coordinate -> 2. y-coordinate
* respect to:
* <ol>
* <li>
* x-coordinate and then to the
* </li>
* <li>
* y-coordinate
* </li>
* </ol>
*
* @param p
* point to compare with
......@@ -48,9 +54,6 @@ public class ComparablePoint extends VPoint implements
return -1;
}
/**
* Uses compareTo to implement the object.equals method.
*/
@Override
public boolean equals(Object obj) {
if (obj == null)
......
......@@ -13,7 +13,7 @@ import java.util.function.Function;
/**
* @author Benedikt Zoennchen
* @param <P>
* @param <P> the type of the points (containers)
*/
public class FixPointGenerator<P extends IPoint> {
......
......@@ -16,8 +16,8 @@ import java.util.function.Function;
* @author Benedikt Zoennchen
*
* A signed distance function d.
* d(x) > 0 => x is outside
* d(x) <= 0 => x is inside
* d(x) greater than 0 then x is outside
* d(x) smaller or equals 0 then x is inside
*/
@FunctionalInterface
public interface IDistanceFunction extends Function<IPoint, Double> {
......
......@@ -54,6 +54,8 @@ public class Vector2D extends VPoint {
/**
* Computes the angle between the x-axis through the given Point (0,0) and this.
* Result is in interval (0,2*PI) according to standard math usage.
*
* @return the angle between the x-axis through the given Point (0,0) and this
*/
public double angleToZero() {
double atan2 = Math.atan2(this.y, this.x);
......@@ -66,9 +68,11 @@ public class Vector2D extends VPoint {
}
/**
*
* Computes the angle between the x-axis through the given Point "center" and this.
* Computes the angle between the x-axis through the given Point center and this.
* Result is in interval (0,2*PI) according to standard math usage.
*
* @param center the given center
* @return the angle between the x-axis through the given Point center and this
*/
public double angleTo(VPoint center) {
return GeometryUtils.angleTo(this, center);
......
package org.vadere.geometry.gui;
import org.jetbrains.annotations.NotNull;
import org.vadere.geometry.mesh.inter.IFace;
import org.vadere.geometry.mesh.inter.IHalfEdge;
import org.vadere.geometry.mesh.inter.IMesh;
......@@ -12,14 +13,14 @@ import java.util.HashMap;
import java.util.function.BiFunction;
/**
* Provides color values for mesh drawings depending on some functions.
* <p>Provides color values for mesh drawings depending on some functions.
* default implementations for faceDrawColor (boarder lines) and faceFillColor (filling)
* are present.
* are present.</p>
*
* @param <P> P extends IPoint
* @param <V> V extends IVertex<P>
* @param <E> E extends IHalfEdge<P>
* @param <F> F extends IFace<P>
* @param <V> V extends IVertex
* @param <E> E extends IHalfEdge
* @param <F> F extends IFace
*/
public class ColorFunctions
<P extends IPoint, V extends IVertex<P>, E extends IHalfEdge<P>, F extends IFace<P>> {
......@@ -30,6 +31,9 @@ public class ColorFunctions
private HashMap<F, Color> faceDrawColorMap;
/**
* <p>The default constructor.</p>
*/
public ColorFunctions() {
faceFillColorFunc = (mesh, face) -> ColorFunctions.qualityToGrayScale(mesh, face);
faceDrawColorFunc = (m, f) -> Color.BLACK;
......@@ -38,11 +42,17 @@ public class ColorFunctions
}
/**
* Create gray scale color codes for 'goodness' of a triangle from black (bad) to white (good)
* <p>Computes the triangle quality of this face / triangle.</p>
*
* <p>Assumption: The face is a valid triangle.</p>
*
* @param mesh Mesh used for coloring
* @param face Face to color
* @return double value used for Color (only one needed for gray scale)
* @param face face / triangle of which the quality will be computed
* @param <P> P extends IPoint
* @param <V> V extends IVertex<P>
* @param <E> E extends IHalfEdge<P>
* @param <F> F extends IFace<P>
* @return the quality in (0;1) of the triangle
*/
public static <P extends IPoint, V extends IVertex<P>, E extends IHalfEdge<P>, F extends IFace<P>> double faceToQuality(final IMesh<P, V, E, F> mesh, final F face) {
VLine[] lines = mesh.toTriangle(face).getLines();
......@@ -59,11 +69,14 @@ public class ColorFunctions
}
/**
* Create gray scale color codes for 'goodness' of a triangle from black (bad) to white (good)
*
* @param mesh Mesh used for coloring
* @param face Face to color
* @return Gray scale color object
* @param face face / triangle of which the color will be computed
* @param <P> P extends IPoint
* @param <V> V extends IVertex<P>
* @param <E> E extends IHalfEdge<P>
* @param <F> F extends IFace<P>
* @return gray scale color object
*/
public static <P extends IPoint, V extends IVertex<P>, E extends IHalfEdge<P>, F extends IFace<P>> Color qualityToGrayScale(final IMesh<P, V, E, F> mesh, final F face) {
float quality = (float) faceToQuality(mesh, face);
......@@ -76,12 +89,12 @@ public class ColorFunctions
}
/**
* Select face FillColor based on {@link #faceFillColorFunc} set in this object. If the color is
* overwritten for the specified face by {@link #faceFillColorMap} then use this color.
* <p>Select face FillColor based on {@link #faceFillColorFunc} set in this object. If the color is
* overwritten for the specified face by {@link #faceFillColorMap} then use this color.</p>
*
* @param mesh Mesh used for coloring
* @param face Face to color
* @return Color object
* @return color object
*/
public Color faceFillColor(final IMesh<P, V, E, F> mesh, final F face) {
if (faceFillColorMap.containsKey(face)) {
......@@ -91,8 +104,8 @@ public class ColorFunctions
}
/**
* Select face DrawColor based on {@link #faceDrawColorFunc} set in this object. If the color is
* overwritten for the specified face by {@link #faceDrawColorMap} then use this color.
* <p>Select face DrawColor based on {@link #faceDrawColorFunc} set in this object. If the color is
* overwritten for the specified face by {@link #faceDrawColorMap} then use this color.</p>
*
* @param mesh Mesh used for coloring
* @param face Face to color
......@@ -107,45 +120,45 @@ public class ColorFunctions
}
/**
* Overwrite color returned by {@link #faceFillColorFunc} for specified face with specified color
* <p>Overwrite color returned by {@link #faceFillColorFunc} for specified face with specified color.</p>
*
* @param face Face which color will be overwritten
* @param color New color for face
*/
public void overwriteFillColor(F face, Color color) {
public void overwriteFillColor(@NotNull final F face, @NotNull final Color color) {
faceFillColorMap.put(face, color);
}
/**
* Set a new faceFillColorFunc for this object.
* <p>Set a new faceFillColorFunc for this object.</p>
*
* @param faceFillColorFunc BiFunction which specifies which color a face interior will get.
*/
public void setFaceFillColorFunc(BiFunction<IMesh<P, V, E, F>, F, Color> faceFillColorFunc) {
public void setFaceFillColorFunc(@NotNull final BiFunction<IMesh<P, V, E, F>, F, Color> faceFillColorFunc) {
this.faceFillColorFunc = faceFillColorFunc;
}
/**
* Set a new faceFillColorFunc for this object.
* <p>Set a new faceFillColorFunc for this object.</p>
*
* @param faceDrawColorFunc BiFunction which specifies which color the face contour will get.
*/
public void setFaceDrawColorFunc(BiFunction<IMesh<P, V, E, F>, F, Color> faceDrawColorFunc) {
public void setFaceDrawColorFunc(@NotNull final BiFunction<IMesh<P, V, E, F>, F, Color> faceDrawColorFunc) {
this.faceDrawColorFunc = faceDrawColorFunc;
}
/**
* Overwrite color returned by {@link #faceDrawColorFunc} for specified face with specified color
* <p>Overwrite color returned by {@link #faceDrawColorFunc} for specified face with specified color.</p>
*
* @param face Face which color will be overwritten
* @param color New color for face
*/
public void overwriteDrawColor(F face, Color color) {
public void overwriteDrawColor(@NotNull final F face, @NotNull final Color color) {
faceDrawColorMap.put(face, color);
}
/**
* delete previously overwritten face/color pairs.
* <p>delete previously overwritten face/color pairs.</p>
*/
public void clear() {
faceDrawColorMap.clear();
......
......@@ -21,7 +21,7 @@ import javax.swing.*;
* <ul>
* <li>Key: n "Next Step": continue with the algorithm and if the gui is called again show the new state.</li>
* <li>Key: q "Stop Debugging Gui": dispose the gui, turn of the {@link DebugGui} and continue the algorithm.</li>
* <li>Key: p "print Tikz output": create tex tikzi drawing and log to konsole</li>
* <li>Key: p "print Tikz output": create tex tikzi drawing and log to console</li>
* <li>Key: s "Print State Info": print the State information defined within the {@link TriCanvas} implementation </li>
* </ul>
*/
......@@ -65,6 +65,7 @@ public class DebugGui<P extends IPoint, V extends IVertex<P>, E extends IHalfEdg
/**
* Activate or Deactivate the {@link DebugGui}
* @param debugOn if true the debugger will be active otherwise it will be inactive.
*/
public static void setDebugOn(boolean debugOn) {
get().debugOn = debugOn;
......@@ -77,9 +78,9 @@ public class DebugGui<P extends IPoint, V extends IVertex<P>, E extends IHalfEdg
*
* @param canvas canvas to show
* @param <P> P extends IPoint
* @param <V> V extends IVertex<P>
* @param <E> E extends IHalfEdge<P>
* @param <F> F extends IFace<P>>
* @param <V> V extends IVertex
* @param <E> E extends IHalfEdge
* @param <F> F extends IFace
*/
public static <P extends IPoint, V extends IVertex<P>, E extends IHalfEdge<P>, F extends IFace<P>>
void forceShowAndWait(TriCanvas<P, V, E, F> canvas) {
......@@ -92,9 +93,9 @@ public class DebugGui<P extends IPoint, V extends IVertex<P>, E extends IHalfEdg
*
* @param canvas canvas to show
* @param <P> P extends IPoint
* @param <V> V extends IVertex<P>
* @param <E> E extends IHalfEdge<P>
* @param <F> F extends IFace<P>>
* @param <V> V extends IVertex
* @param <E> E extends IHalfEdge
* @param <F> F extends IFace
*/
public static <P extends IPoint, V extends IVertex<P>, E extends IHalfEdge<P>, F extends IFace<P>>
void showAndWait(TriCanvas<P, V, E, F> canvas) {
......
......@@ -25,6 +25,11 @@ import java.util.function.Consumer;
*
* With the stateLog consumer information for the specifc state within the algorithm can be printed
* from the {@link org.vadere.geometry.gui.DebugGui}.
*
* @param <P> the type of the points (containers)
* @param <V> the type of the vertices
* @param <E> the type of the half-edges
* @param <F> the type of the faces
*/
public abstract class TriCanvas
<P extends IPoint, V extends IVertex<P>, E extends IHalfEdge<P>, F extends IFace<P>>
......@@ -105,6 +110,8 @@ public abstract class TriCanvas
/**
* Add additional graphics primitive which should be drawn to the canvas.
* @param c a Consumer {@link Consumer} of {@link Graphics2D}
* @return this canvas
*/
public TriCanvas<P, V, E, F> addGuiDecorator(Consumer<Graphics2D> c) {
paintDecorator.add(c);
......@@ -113,6 +120,8 @@ public abstract class TriCanvas
/**
* Add a complete line which will be included in the tikzdrawing. Note: add a newline character!
* @param c a Consumer {@link Consumer} of {@link StringBuilder}
* @return this canvas
*/
public TriCanvas<P, V, E, F> addTexDecorator(Consumer<StringBuilder> c) {
texGraphBuilder.addElement(c);
......@@ -121,6 +130,7 @@ public abstract class TriCanvas
/**
* Get current {@link ColorFunctions} object used for java.swing and tex tikz drawing.
* @return the current used color function {@link ColorFunctions}
*/
public ColorFunctions getColorFunctions() {
return colorFunctions;
......@@ -128,6 +138,7 @@ public abstract class TriCanvas
/**
* Add new {@link ColorFunctions} object to the {@link TriCanvas} implementation.
* @param colorFunctions the new color function
*/
public void setColorFunctions(ColorFunctions<P, V, E, F> colorFunctions) {
this.colorFunctions = colorFunctions;
......
......@@ -13,14 +13,6 @@ public class VoronoiFactory {
geometryFactory = new GeometryFactory();
}
/**
* Calcluates/Creates a new voronoiDiagramm subtracted by polygons.
*
* @param coordinates the coordinates of the sites
* @param polygons the polygons that will be subtracted from the diagram
* @param envolve
* @return a new voronoiDiagramm subtracted by polygons
*/
public Geometry createVoronoiDiagram(final Collection<Coordinate> coordinates, final Collection<Polygon> polygons,
final Envelope envolve) {
VoronoiDiagramBuilder builder = new VoronoiDiagramBuilder();
......
......@@ -446,13 +446,13 @@ public class AMesh<P extends IPoint> implements IMesh<P, AVertex<P>, AHalfEdge<P
}
/**
* Rearranges all indices of faces, vertices and halfEdges of the mesh according to
* <p>Rearranges all indices of faces, vertices and halfEdges of the mesh according to
* the {@link Iterable} faceOrder. All indices start at 0 and will be incremented one by one.
* For example, the vertices of the first face of faceOrder will receive id 0,1 and 2.
* For example, the vertices of the first face of faceOrder will receive id 0,1 and 2.</p>
*
* Note: that any mapping id -> vertex or id -> halfEdge or id -> face has to be recomputed!
* Assumption: faceOrder contains all faces of this mesh.
* Invariant: the geometry i.e. the connectivity and the vertex positions will not change.
* <p>Note: that every mapping id to vertex or id to halfEdge or id to face has to be recomputed!</p>
* <p>Assumption: faceOrder contains all faces of this mesh.</p>
* <p>Invariant: the geometry i.e. the connectivity and the vertex positions will not change.</p>
*
* @param faceOrder the new order
*/
......@@ -577,7 +577,7 @@ public class AMesh<P extends IPoint> implements IMesh<P, AVertex<P>, AHalfEdge<P
* This method rearranges the indices of faces, vertices and edges according to their positions.
* After the call, neighbouring faces are near arrange inside the face {@link ArrayList}.
*
* Note: that any mapping id -> vertex or id -> halfEdge or id -> face has to be recomputed!
* Note: that any mapping id to vertex or id to halfEdge or id to face has to be recomputed!
*/
public void spatialSort() {
// get the bound for the space filling curve!
......@@ -624,7 +624,7 @@ public class AMesh<P extends IPoint> implements IMesh<P, AVertex<P>, AHalfEdge<P
/**
* removes all destroyed object from this mesh and re-arranges all indices.
*
* Note: that any mapping id -> vertex or id -> halfEdge or id -> face has to be recomputed!
* Note: that any mapping id to vertex or id to halfEdge or id to face has to be recomputed!
*/
public void garbageCollection() {
Map<Integer, Integer> faceIdMap = new HashMap<>();
......
......@@ -18,10 +18,10 @@ import java.util.Optional;
* checking each each face of the mesh but it is more clever and faste in the most cases.
*
*
* @param <P>
* @param <V>
* @param <E>
* @param <F>
* @param <P> the type of the points (containers)
* @param <V> the type of the vertices
* @param <E> the type of the half-edges
* @param <F> the type of the faces
*/
public class BasePointLocator<P extends IPoint, V extends IVertex<P>, E extends IHalfEdge<P>, F extends IFace<P>> implements IPointLocator<P, V, E, F> {
......
......@@ -30,7 +30,7 @@ public class DAG<E> {
/**
* Default constructor.
* @param element
* @param element the element of the Dag-node
*/
public DAG(@NotNull final E element) {
this.element = element;
......@@ -63,7 +63,7 @@ public class DAG<E> {
/**
* Returns the element of the DAG.
* @return
* @return the element of the DAG
*/
public E getElement() {
return element;
......@@ -87,6 +87,7 @@ public class DAG<E> {
/**
* Test whether this DAG-Node is a child or not.
*
* @return true if this node is a child node, false otherwise.
*/
public boolean isLeaf(){
......@@ -95,8 +96,10 @@ public class DAG<E> {
/**
* Finds the first DAG-node element in a dept first fashion.
*
* @param test the predicate the element of the DAG-node has to fulfill.
* @return
*
* @return (optional) the first DAG-node element in a dept first fashion
*/
public Optional<E> findFirstElement(final Predicate<E> test){
Optional<DAG<E>> optDag = findFirst(test);
......@@ -111,7 +114,8 @@ public class DAG<E> {
/**
* Finds the first DAG-node in a dept first fashion.
* @param test the predicate the element of the DAG-node has to fulfill.
* @return
*
* @return (optional) the first DAG-node in a dept first fashion.
*/
public Optional<DAG<E>> findFirst(final Predicate<E> test){
LinkedList<DAG<E>> nodesToVisit = new LinkedList<>();
......@@ -133,8 +137,8 @@ public class DAG<E> {
* The path will be constructed in a dept first fashion, therefore there
* may exist other paths.
*
* @param test
* @return
* @param test the test that has to be satisfied
* @return the last node of a path of elements that satisfy the test
*/
public Optional<DAG<E>> matchFirst(final Predicate<E> test) {
......@@ -165,8 +169,8 @@ public class DAG<E> {
* to the leaf and for each node on the path the condition is feasible including
* the leaf itself.
*
* @param test
* @return
* @param test a condition which has to be feasible for the path from leaf to leaf
* @return a set of leaf Dag elements
*/
public Set<DAG<E>> matchAll(final Predicate<E> test) {
Set<DAG<E>> leafs = new HashSet<>();
......
......@@ -107,7 +107,7 @@ public class DelaunayHierarchy<P extends IPoint, V extends IVertex<P>, E extends
* triangulation which already contains points.
*
* @param base T_0
* @param triangulationSupplier a supplier to construct T_k, k > 0.
* @param triangulationSupplier a supplier to construct T_k, k greater 0.
*/
public DelaunayHierarchy(
@NotNull final ITriangulation<P, V, E, F> base,
......
......@@ -19,7 +19,7 @@ import java.util.Set;
/**
* An implementation of the so called Delaunay Tree which does not suppport deletion of points from the
* triangulation {@link ITriangulation<P, V, E, F>}.
* triangulation {@link ITriangulation}.
*
* The Delaunay Tree see Computational Geometry: Algorithms and Applications (berg-2008) page 191.
*
......
......@@ -93,9 +93,9 @@ public class PFace<P extends IPoint> implements IFace<P>, Cloneable {
}
/**
* non-deep cloning!
* @return
* @throws CloneNotSupportedException
* Construct a deep clone / copy of this face!
* @return a deep clone of the face
* @throws CloneNotSupportedException if the method is not jet implemented.
*/
@Override
protected PFace<P> clone() throws CloneNotSupportedException {
......
......@@ -7,8 +7,10 @@ import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;
/**
* The A pointer based version of {@link IVertex}.
*
* @author Benedikt Zoennchen
* @param <P>
* @param <P> the type of the points (containers)
*/
public class PVertex<P extends IPoint> implements IVertex<P> {
......@@ -86,9 +88,9 @@ public class PVertex<P extends IPoint> implements IVertex<P> {
}
/**
* Non-deep cloning.
* Returns a deep clone of the vertex.
*
* @return
* @return a deep clone of the vertex.
*/
@Override
public PVertex<P> clone() {
......
......@@ -40,18 +40,17 @@ import java.util.stream.StreamSupport;
/**
* <p>
* A {@link IMesh} is a set of {@link IFace}, their half-edges {@link IHalfEdge}, vertices {@link IVertex<P>} and points {@link P}
* A {@link IMesh} is a set of {@link IFace}, their half-edges {@link IHalfEdge}, vertices {@link IVertex} and points {@link P}
* defining a geometry. It also is a factory for those geometric base elements: points, vertices, half-edges and faces. The user should use one mesh
* for exactly one geometric and the user should never create any base element without calling its mesh. Furthermore, the user is responsible for the
* correctness of the mesh definition e.g. no overlapping edges. There are some classes for automatic mesh generation like
* {@link org.vadere.geometry.mesh.triangulation.triangulator.ITriangulator} or other factory methods like {@link IMesh#createSimpleTriMesh}
* </p>
* <p>It uses the half-edge data structure to store all information and is a generic interface to provide different implementations such as:
It uses the half-edge data structure to store all information and is a generic interface to provide different implementations such as:
* <ul>
* <li>A pointer based version which implements a doubled-linked-list data structure {@link org.vadere.geometry.mesh.gen.PMesh}</li>
* <li>An index based version which implements an array data structure {@link org.vadere.geometry.mesh.gen.AMesh}</li>
* </ul>
* </p>
* <p>
* It should be impossible to create faces, edges, and vertices of the mesh without using the mesh i.e. IMesh is a factory for faces, edges and vertices.
* A boundary can be a hole or the border. A hole is surrounded by faces and the border is the infinite large face representing the space which is not
......@@ -63,16 +62,15 @@ import java.util.stream.StreamSupport;
* iterate over the list {@link List} while changing elements in the mesh. The mesh offers a large set of different iterators and streams to iterate over all neighbouring
* faces of a face, vertices of a vertex, edges of a vertex or over all edges / vertices / points of a face.
* </p>
* <p>
* We define as base elements: points {@link P}, vertices {@link V}, half-edges {@link E} and faces {@link F}.
* <ul>
* <li>
* point {@link P}: </br>
* point {@link P}:
* A point is a container object which can be identified by its 2-D coordinates (x,y) and is part of a vertex {@link V}. A point has no reference to
* any other base element of the mesh data structure.
* </li>
* <li>
* vertex {@link V}: </br>
* vertex {@link V}:
* A vertex is the end node / point of a half-edge. Each vertex has exactly one distinct point {@link P}. One can access the point
* of a vertex in O(1). A vertex has also a 1 to 1 relation to a half-edge and the half-edge of a vertex can accessed in O(1) time. Furthermore, it has
* a reference to one arbitrary of its half-edges (half-edges ending in it). If the vertex is at the boundary (hole or border) the half-edge should be
......@@ -81,18 +79,17 @@ import java.util.stream.StreamSupport;
* its half-edge and extracting from the half-edge the face.
* </li>
* <li>
* half-edge {@link E}: </br>
* half-edge {@link E}:
* A half-edge is part of a full-edge i.e. the half-edge and its twin fully define the full-edge. Each half-edge has a predecessor
* and a successor and a twin half-edge {@link E} which can be accessed in O(1). Furthermore, each half-edge is part of exactly one face {@link F} and ends
* in exactly one vertex {@link V} both can be accessed in O(1) time. As one can see the half-edge has the most amount of references (5).
* </li>
* <li>
* face {@link F}: </br>
* face {@link F}:
* A face can be a interior face i.e. a simple polygon, a hole (also a polygon but representing empty space) or the border i.e. the infinite
* face which represents all the space which is not represented by any finite face. An arbitrary half-edge {@link E} can be accessed in O(1).
* </li>
* </ul>
* </p>