Notice: If you are member of any public project or group, please make sure that your GitLab username is not the same as the LRZ identifier/Kennung (see https://gitlab.lrz.de/profile/account). Please change your username if necessary. For more information see the section "Public projects / Öffentliche Projekte" at https://doku.lrz.de/display/PUBLIC/GitLab . Thank you!

Commit cfc19a08 authored by BZoennchen's avatar BZoennchen

implement property management for AMesh (i.e. array-based). Default value...

implement property management for AMesh (i.e. array-based). Default value indicating null values not jet implemented.
parent 91b372df
package org.vadere.meshing.examples;
import org.jetbrains.annotations.NotNull;
import org.vadere.meshing.mesh.gen.AFace;
import org.vadere.meshing.mesh.gen.AHalfEdge;
import org.vadere.meshing.mesh.gen.PFace;
import org.vadere.meshing.mesh.gen.PHalfEdge;
import org.vadere.meshing.mesh.gen.PMesh;
......@@ -11,6 +13,7 @@ import org.vadere.meshing.mesh.inter.IPointConstructor;
import org.vadere.meshing.mesh.triangulation.IEdgeLengthFunction;
import org.vadere.meshing.mesh.triangulation.improver.eikmesh.EikMeshPoint;
import org.vadere.meshing.mesh.triangulation.improver.eikmesh.impl.PEikMesh;
import org.vadere.meshing.mesh.triangulation.triangulator.impl.ADelaunayTriangulator;
import org.vadere.meshing.mesh.triangulation.triangulator.impl.PContrainedDelaunayTriangulator;
import org.vadere.meshing.mesh.triangulation.triangulator.impl.PVoronoiVertexInsertion;
import org.vadere.meshing.mesh.triangulation.triangulator.impl.PDelaunayTriangulator;
......@@ -59,7 +62,7 @@ public class MeshExamples {
//ruppertsTriangulationKaiserslautern();
//ruppertsTriangulationPoly();
//ruppertsTriangulationPolyGreenland();
//delaunayTriangulation();
delaunayTriangulation();
//dirichletRefinment();
// delaunayRefinment();
//constrainedDelaunayTriangulation();
......@@ -145,7 +148,7 @@ public class MeshExamples {
List<VPoint> points = randomPoints.limit(numberOfPoints).collect(Collectors.toList());
// (2) compute the Delaunay triangulation
var delaunayTriangulator = new PDelaunayTriangulator(points);
var delaunayTriangulator = new ADelaunayTriangulator(points);
var triangulation = delaunayTriangulator.generate();
// \definecolor{mygreen}{RGB}{85,168,104}
......@@ -179,8 +182,8 @@ public class MeshExamples {
String propertyName = "area";
LinkedList<PHalfEdge> visitedEdges = delaunayTriangulator.generate().straightGatherWalk2D(5, 5, delaunayTriangulator.getMesh().getFace());
for(PFace f : delaunayTriangulator.getMesh().getFaces()) {
LinkedList<AHalfEdge> visitedEdges = delaunayTriangulator.generate().straightGatherWalk2D(5, 5, delaunayTriangulator.getMesh().getFace());
for(AFace f : delaunayTriangulator.getMesh().getFaces()) {
delaunayTriangulator.getMesh().setData(f, propertyName, delaunayTriangulator.getMesh().toTriangle(f).getArea());
}
......@@ -192,7 +195,7 @@ public class MeshExamples {
VPoint q = delaunayTriangulator.getMesh().toTriangle(delaunayTriangulator.getMesh().getFace(visitedEdges.peekFirst())).midPoint();
Set<PFace> faceSet = visitedEdges.stream().map(e -> delaunayTriangulator.getMesh().getFace(e)).collect(Collectors.toSet());
Set<AFace> faceSet = visitedEdges.stream().map(e -> delaunayTriangulator.getMesh().getFace(e)).collect(Collectors.toSet());
//\definecolor{myred}{RGB}{196,78,82}
......
package org.vadere.meshing.mesh.gen;
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
public class AObjectArrayList<K> extends ObjectArrayList<K> {
public void swap(int i, int j) {
if (i >= size || j >= size) {
throw new IndexOutOfBoundsException("Index (" + i + ") or (" + j + ") is greater than or equal to list size (" + size + ")");
} else {
K tmp = a[j];
a[j] = a[i];
a[i] = tmp;
}
}
}
......@@ -319,6 +319,8 @@ public interface IMesh<V extends IVertex, E extends IHalfEdge, F extends IFace>
setData(vertex, name, data);
}
//default void setDoubleDataNull
/**
* Returns the data saved on the half-edge in O(1) if there is any and otherwise <tt>Optional.empty()</tt>.
*
......
package org.vadere.meshing.mesh.triangulation.triangulator.impl;
import org.jetbrains.annotations.NotNull;
import org.vadere.meshing.mesh.gen.AFace;
import org.vadere.meshing.mesh.gen.AHalfEdge;
import org.vadere.meshing.mesh.gen.AMesh;
import org.vadere.meshing.mesh.gen.AVertex;
import org.vadere.meshing.mesh.triangulation.triangulator.gen.GenDelaunayTriangulator;
import org.vadere.util.geometry.shapes.IPoint;
import java.util.Collection;
public class ADelaunayTriangulator extends GenDelaunayTriangulator<AVertex, AHalfEdge, AFace> {
public ADelaunayTriangulator(@NotNull final Collection<? extends IPoint> pointSet) {
super(new AMesh(), pointSet);
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment