... | ... | @@ -479,9 +479,9 @@ Distance functions can be combined. |
|
|
```java
|
|
|
VRectangle bound = ...
|
|
|
VRectangle rect = new VRectangle(0.5, 0.5, 1, 1);
|
|
|
IDistanceFunction d_c = IDistanceFunction.createDisc(0.5, 0.5, 0.5);
|
|
|
IDistanceFunction d_r = IDistanceFunction.create(rect);
|
|
|
IDistanceFunction d = IDistanceFunction.substract(d_c, d_r);
|
|
|
IDistanceFunction d_comb = IDistanceFunction.createDisc(0.5, 0.5, 0.5);
|
|
|
IDistanceFunction d_rec = IDistanceFunction.create(rect);
|
|
|
IDistanceFunction d = IDistanceFunction.substract(d_comb, d_rec);
|
|
|
double edgeLength = 0.03;
|
|
|
var meshImprover = new PEikMeshGen<EikMeshPoint, Double, Double>(
|
|
|
d,
|
... | ... | @@ -510,7 +510,7 @@ The result for h0 = 0.1, 0.03 and 0.01. |
|
|
|
|
|
### Example 3 (Combining distance functions)
|
|
|
|
|
|
We can also construct geometries by the union and intersection of distance functions. For example, the above figure illustrate the result of the following code.
|
|
|
We can also construct geometries by the union and intersection of distance functions. For example, the figure below illustrate the result of the following code.
|
|
|
|
|
|
```java
|
|
|
// inner rectangle
|
... | ... | @@ -555,6 +555,38 @@ Here we define two circles and a rectangle and compute the union ``d_union`` of |
|
|
|
|
|
![eikmesh_d_combined_png](uploads/4f86de4de6bec3e4aa77870b63216685/eikmesh_d_combined_png.png)
|
|
|
|
|
|
### Example 4 (Meshing a PSLG)
|
|
|
|
|
|
The following code sniped produces the mesh illustrated in below by constructing a distance functions based on the given PSLG:
|
|
|
|
|
|
```java
|
|
|
PSLG pslg = ...
|
|
|
PEikMesh meshImprover = new PEikMesh(pslg.getSegmentBound(), 0.02, pslg.getHoles());
|
|
|
```
|
|
|
#### Result:
|
|
|
|
|
|
![A](uploads/e607706629de93771762d63c84c046de/A.png)
|
|
|
|
|
|
### Example 5 (Smoothing a given mesh)
|
|
|
|
|
|
The following code uses a Delaunay triangulation of 1000 random points as the initial triangulation, also depicted below (left).
|
|
|
|
|
|
```java
|
|
|
var dt = ... // the Delaunay triangulation
|
|
|
var eikMesh = new PEikMeshGen<>(p -> 1.0 + Math.abs(bound.distance(p)),
|
|
|
dt.getTriangulation());
|
|
|
var triangulation = eikMesh.generate();
|
|
|
```
|
|
|
|
|
|
The quality of the resulting triangulation is approximately 0.96 (using the same measure as Persson).
|
|
|
This example shows that EikMesh can be used to improve even a very low quality initial triangulation.
|
|
|
|
|
|
#### Result:
|
|
|
|
|
|
Mesh before (left) and after (right) of the smoothing stage.
|
|
|
|
|
|
![randomDelaunay](uploads/a10ceae64a53cbeb316e69e5eb487073/randomDelaunay.png)
|
|
|
|
|
|
## Videos
|
|
|
|
|
|
To get a good understanding of how EikMesh works, we constructed some videos of the meshing process which can be found at [vadere.org](http://www.vadere.org/the-eikmesh-library/). |
|
|
\ No newline at end of file |