Package org.h2gis.functions.spatial.mesh
Class DelaunayData
- java.lang.Object
-
- org.h2gis.functions.spatial.mesh.DelaunayData
-
public class DelaunayData extends Object
This class is used to collect all data used to compute a mesh based on a Delaunay triangulation- Author:
- Erwan Bocher, Nicolas Fortin
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classDelaunayData.MODE
-
Field Summary
Fields Modifier and Type Field Description static doubleDEFAULT_EPSILON
-
Constructor Summary
Constructors Constructor Description DelaunayData()Create a mesh data structure to collect points and edges that will be used by the Delaunay Triangulation
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddPolygon(org.locationtech.jts.geom.Polygon newPoly, int attribute)Append a polygon into the triangulationstatic doublecomputeTriangleArea3D(org.locationtech.jts.geom.Coordinate p1, org.locationtech.jts.geom.Coordinate p2, org.locationtech.jts.geom.Coordinate p3)Computes the 3D area of a triangle.doubleget3DArea()Return the 3D area of all trianglesorg.locationtech.jts.geom.MultiPolygongetTrianglesAsMultiPolygon()org.locationtech.jts.geom.MultiLineStringgetTrianglesSides()voidput(org.locationtech.jts.geom.Geometry geom, DelaunayData.MODE mode)Put a geometry into the data array.voidsetEpsilon(double epsilon)voidtriangulate()
-
-
-
Method Detail
-
put
public void put(org.locationtech.jts.geom.Geometry geom, DelaunayData.MODE mode) throws IllegalArgumentExceptionPut a geometry into the data array. Set true to populate the list of points and edges, needed for the ContrainedDelaunayTriangulation. Set false to populate only the list of points. Note the z-value is forced to O when it's equal to NaN.- Parameters:
geom- Geometrymode- Delaunay mode- Throws:
IllegalArgumentException
-
addPolygon
public void addPolygon(org.locationtech.jts.geom.Polygon newPoly, int attribute)Append a polygon into the triangulation- Parameters:
newPoly- Polygon to append into the mesh, internal rings willb be inserted as holes.attribute- Polygon attribute.Triangle.getAttribute()
-
setEpsilon
public void setEpsilon(double epsilon)
- Parameters:
epsilon- Merge vertices with this distance between
-
triangulate
public void triangulate()
-
getTrianglesAsMultiPolygon
public org.locationtech.jts.geom.MultiPolygon getTrianglesAsMultiPolygon()
-
get3DArea
public double get3DArea()
Return the 3D area of all triangles- Returns:
- the area of the triangles in 3D
-
computeTriangleArea3D
public static double computeTriangleArea3D(org.locationtech.jts.geom.Coordinate p1, org.locationtech.jts.geom.Coordinate p2, org.locationtech.jts.geom.Coordinate p3)Computes the 3D area of a triangle. Uses the formula 1/2 * | u x v | where u,v are the side vectors of the triangle x is the vector cross-product- Parameters:
p1- First vertexp2- Second vertexp3- Third vertex- Returns:
- triangle area
-
getTrianglesSides
public org.locationtech.jts.geom.MultiLineString getTrianglesSides()
- Returns:
- Unique triangles edges as a MultiLineString
-
-