... | ... | @@ -434,4 +434,92 @@ var triangulation = cdt.generate(); |
|
|
|
|
|
The following illustrated the difference between the DT (left), the CDT (middle) and the CCDT (right) of a PSLG.
|
|
|
|
|
|
![CDT](uploads/28bdb462fa809bee789aaca6e5566c4e/CDT.png) |
|
|
\ No newline at end of file |
|
|
![CDT](uploads/28bdb462fa809bee789aaca6e5566c4e/CDT.png)
|
|
|
|
|
|
|
|
|
# EikMesh
|
|
|
|
|
|
![headMesh](uploads/76ced2ddd4ef0e71d3f76043bcbcad83/headMesh.png)
|
|
|
|
|
|
EikMesh uses our implementation of the [DCEL](https://gitlab.lrz.de/vadere/vadere/wikis/eikmesh/The-Mesh-Data-Structure) as underlying data structure. EikMesh requires three basically three ingredients:
|
|
|
1. a bounding box `VPolygon` (containing all mesh points)
|
|
|
2. a signed distance function d(x) which gives the distance to the topography border
|
|
|
3. an edge length function h(x) which gives the desired edge length depending on the midpoint of the edge
|
|
|
4. an initial edge `h0` length which determines the minimal edge length i.e. h(x) <= h0 everywhere.
|
|
|
|
|
|
However if (2) is missing EikMesh constructs d(x) by using only the bounding box (and maybe additional `VShape`s). If (3) is missing EikMesh assumes h(x) = h0 everywhere leading to a mesh of balanced edge lengths:
|
|
|
|
|
|
## Examples
|
|
|
|
|
|
### Example 1 (Uniform mesh)
|
|
|
|
|
|
In this example we use the mi
|
|
|
```java
|
|
|
// define the bounding box
|
|
|
VPolygon boundary = GeometryUtils.polygonFromPoints2D(
|
|
|
new VPoint(0,0),
|
|
|
new VPoint(0, 1),
|
|
|
new VPoint(1, 1),
|
|
|
new VPoint(1,0));
|
|
|
|
|
|
// define the initial edge length h0
|
|
|
double h0 = 0.1;
|
|
|
|
|
|
// define the EikMesh mesh generator
|
|
|
PEikMeshGen<EikMeshPoint, Double, Double> meshImprover = new PEikMeshGen<>(
|
|
|
boundary,
|
|
|
h0,
|
|
|
(x, y) -> new EikMeshPoint(x, y, false));
|
|
|
|
|
|
// generate the mesh
|
|
|
meshImprover.generate();
|
|
|
|
|
|
// get the generated mesh
|
|
|
meshImprover.getMesh()
|
|
|
```
|
|
|
|
|
|
#### Result:
|
|
|
<img src="uploads/bf06693e56e09d5ad4264d9316f00173/rectUniformMesh.png" alt="Uniform rect mesh" width="200"/>
|
|
|
|
|
|
### Example 2 (Uniform mesh)
|
|
|
|
|
|
Additionally we can add a list of geometrical shapes which are part of the boundary. In case of Pedestrian Dynamics those shapes may represent real world obstacles like walls:
|
|
|
|
|
|
```java
|
|
|
PEikMeshGen<EikMeshPoint, Double, Double> meshImprover = new PEikMeshGen<>(
|
|
|
boundary,
|
|
|
h0,
|
|
|
Arrays.asList(new VRectangle(0.25, 0.25, 0.5, 0.5)),
|
|
|
(x, y) -> new EikMeshPoint(x, y, false));
|
|
|
```
|
|
|
|
|
|
#### Result:
|
|
|
<img src="uploads/00fb6492c91f257fe18aeaabda9f5fce/rectUniformMeshHole.png" alt="Uniform rect mesh with hole" width="200"/>
|
|
|
|
|
|
### Example 3 (Adaptive mesh)
|
|
|
|
|
|
We can not only define our own distance function d and edge length function h but crucially h can depend on d:
|
|
|
|
|
|
```java
|
|
|
// define a bounding box
|
|
|
VRectangle bound = new VRectangle(-0.1, -0.1, 2.2, 2.2);
|
|
|
|
|
|
// distance function d that defines a disc with radius 1 at (1,1).
|
|
|
IDistanceFunction d = p -> Math.sqrt((p.getX() - 1) * (p.getX() - 1) + (p.getY() - 1) * (p.getY() - 1)) - 1.0;
|
|
|
|
|
|
// define edge length function h by using d
|
|
|
IEdgeLengthFunction h = p -> 1.0 + 5.0 * Math.abs(d.apply(p));
|
|
|
|
|
|
// define h0
|
|
|
double h0 = 0.1;
|
|
|
|
|
|
// define the EikMesh generator
|
|
|
PEikMeshGen<EikMeshPoint, Double, Double> meshImprover = new PEikMeshGen<>(
|
|
|
d, h, h0, bound, (x, y) -> new EikMeshPoint(x, y, false));
|
|
|
|
|
|
// mesh the geometry
|
|
|
meshImprover.generate();
|
|
|
```
|
|
|
|
|
|
#### Result:
|
|
|
<img src="uploads/deabaceadffaa1285a4115f8e652d226/discAdaptiveMesh.png" alt="Adaptive disc mesh" width="200"/> |
|
|
\ No newline at end of file |