24.09., 9:00 - 11:00: Due to updates GitLab will be unavailable for some minutes between 09:00 and 11:00.

Commit 3b6c15c5 authored by Benedikt Zoennchen's avatar Benedikt Zoennchen Committed by Benedikt Zoennchen

flipping problem is now fixed

parent 4d14df94
...@@ -316,8 +316,6 @@ kernel void computeCompleteSF(__const int size, __global double2* qlengths, __lo ...@@ -316,8 +316,6 @@ kernel void computeCompleteSF(__const int size, __global double2* qlengths, __lo
if(lid == 0) { if(lid == 0) {
//*scaleFactor = qlengths[10].s0;
//*scaleFactor = partialSums[0].s0;
*scaleFactor = sqrt(partialSums[0].s0 / partialSums[0].s1); *scaleFactor = sqrt(partialSums[0].s0 / partialSums[0].s1);
} }
} }
......
...@@ -63,10 +63,10 @@ public class CLGatherer { ...@@ -63,10 +63,10 @@ public class CLGatherer {
edgeBuffer.put(index, edge.getEnd()); edgeBuffer.put(index, edge.getEnd());
index++; index++;
if(mesh.isBoundary(mesh.getFace(edge))) { if(mesh.isBoundary(mesh.getFace(edge))) {
edgeBuffer.put(index, mesh.getFace(mesh.getTwin(edge)).getId());
index++;
edgeBuffer.put(index, -1); edgeBuffer.put(index, -1);
index++; index++;
edgeBuffer.put(index, mesh.getFace(mesh.getTwin(edge)).getId());
index++;
if(mesh.isBoundary(mesh.getFace(mesh.getTwin(edge)))) { if(mesh.isBoundary(mesh.getFace(mesh.getTwin(edge)))) {
throw new IllegalArgumentException("invalid mesh!"); throw new IllegalArgumentException("invalid mesh!");
} }
......
...@@ -174,6 +174,7 @@ public class CLPSMeshing implements IPSMeshing { ...@@ -174,6 +174,7 @@ public class CLPSMeshing implements IPSMeshing {
} }
triangulation = ITriangulation.createATriangulation(IPointLocator.Type.DELAUNAY_HIERARCHY, clDistMesh.getResult(), (x, y) -> new MeshPoint(x, y, false)); triangulation = ITriangulation.createATriangulation(IPointLocator.Type.DELAUNAY_HIERARCHY, clDistMesh.getResult(), (x, y) -> new MeshPoint(x, y, false));
removeTrianglesInsideObstacles(); removeTrianglesInsideObstacles();
removeLowQualityTriangles();
triangulation.finalize(); triangulation.finalize();
} }
......
...@@ -44,7 +44,7 @@ public class TestEnhancedVersion4 extends JFrame { ...@@ -44,7 +44,7 @@ public class TestEnhancedVersion4 extends JFrame {
while (counter < 1) { while (counter < 100) {
//obscuteTriangles = meshGenerator.getTriangles().stream().filter(tri -> tri.isNonAcute()).count(); //obscuteTriangles = meshGenerator.getTriangles().stream().filter(tri -> tri.isNonAcute()).count();
//PriorityQueue<PFace<MeshPoint>> priorityQueue = meshGenerator.getQuailties(); //PriorityQueue<PFace<MeshPoint>> priorityQueue = meshGenerator.getQuailties();
//avgQuality = priorityQueue.stream().reduce(0.0, (aDouble, meshPointPFace) -> aDouble + meshGenerator.faceToQuality(meshPointPFace), (d1, d2) -> d1 + d2) / priorityQueue.size(); //avgQuality = priorityQueue.stream().reduce(0.0, (aDouble, meshPointPFace) -> aDouble + meshGenerator.faceToQuality(meshPointPFace), (d1, d2) -> d1 + d2) / priorityQueue.size();
...@@ -57,7 +57,9 @@ public class TestEnhancedVersion4 extends JFrame { ...@@ -57,7 +57,9 @@ public class TestEnhancedVersion4 extends JFrame {
long ms = System.currentTimeMillis(); long ms = System.currentTimeMillis();
//meshGenerator.refresh(); //meshGenerator.refresh();
//meshGenerator.retriangulate(); //meshGenerator.retriangulate();
if(meshGenerator.step(true)) { boolean retriangulation = meshGenerator.step(true);
ms = System.currentTimeMillis() - ms;
if(retriangulation) {
//meshGenerator.refresh(); //meshGenerator.refresh();
meshGenerator.retriangulate(); meshGenerator.retriangulate();
} }
...@@ -68,7 +70,7 @@ public class TestEnhancedVersion4 extends JFrame { ...@@ -68,7 +70,7 @@ public class TestEnhancedVersion4 extends JFrame {
meshGenerator.retriangulate(); meshGenerator.retriangulate();
}*/ }*/
ms = System.currentTimeMillis() - ms;
time += ms; time += ms;
System.out.println("Step-Time: " + ms); System.out.println("Step-Time: " + ms);
......
...@@ -39,5 +39,18 @@ public class TestGeometryUtils { ...@@ -39,5 +39,18 @@ public class TestGeometryUtils {
assertFalse(!GeometryUtils.isRightOf(p2, p1, t)); assertFalse(!GeometryUtils.isRightOf(p2, p1, t));
} }
@Test
public void testCircumcenterOrder() {
double eps = 0.000001;
VPoint r = new VPoint(5, 0.5);
VPoint q = new VPoint(5, -0.5);
VPoint t = new VPoint(-5, -0.5);
VPoint c1 = GeometryUtils.getCircumcenter(r, q, t);
VPoint c2 = GeometryUtils.getCircumcenter(r, t, q);
VPoint c3 = GeometryUtils.getCircumcenter(t, r, q);
assertTrue(c1.distance(c2) < eps);
assertTrue(c2.distance(c3) < eps);
}
} }
...@@ -8,13 +8,10 @@ import org.apache.log4j.LogManager; ...@@ -8,13 +8,10 @@ import org.apache.log4j.LogManager;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import org.vadere.util.geometry.GeometryUtils;
import org.vadere.util.geometry.mesh.gen.*; import org.vadere.util.geometry.mesh.gen.*;
import org.vadere.util.geometry.mesh.impl.VPTriangulation; import org.vadere.util.geometry.mesh.impl.VPTriangulation;
import org.vadere.util.geometry.mesh.inter.IFace; import org.vadere.util.geometry.mesh.inter.*;
import org.vadere.util.geometry.mesh.inter.IHalfEdge;
import org.vadere.util.geometry.mesh.inter.IPointLocator;
import org.vadere.util.geometry.mesh.inter.ITriangulation;
import org.vadere.util.geometry.mesh.inter.IVertex;
import org.vadere.util.geometry.shapes.IPoint; import org.vadere.util.geometry.shapes.IPoint;
import org.vadere.util.geometry.shapes.VPoint; import org.vadere.util.geometry.shapes.VPoint;
import org.vadere.util.geometry.shapes.VRectangle; import org.vadere.util.geometry.shapes.VRectangle;
...@@ -117,8 +114,12 @@ public class TestBoyerWatson { ...@@ -117,8 +114,12 @@ public class TestBoyerWatson {
points.add(p3); points.add(p3);
ITriangulation<VPoint, PVertex<VPoint>, PHalfEdge<VPoint>, PFace<VPoint>> delaunayTriangulation = ITriangulation.createPTriangulation(IPointLocator.Type.BASE, points, (x, y) -> new VPoint(x, y)); ITriangulation<VPoint, PVertex<VPoint>, PHalfEdge<VPoint>, PFace<VPoint>> delaunayTriangulation = ITriangulation.createPTriangulation(IPointLocator.Type.BASE, points, (x, y) -> new VPoint(x, y));
PFace<VPoint> face = delaunayTriangulation.locateFace(centerPoint).get(); PFace<VPoint> face = delaunayTriangulation.locateFace(centerPoint).get();
IMesh<VPoint, PVertex<VPoint>, PHalfEdge<VPoint>, PFace<VPoint>> mesh = delaunayTriangulation.getMesh();
PHalfEdge<VPoint> edge = mesh.getEdge(face);
// triangulations are always ccw ordered!
assertTrue(GeometryUtils.isCCW(mesh.getVertex(edge), mesh.getVertex(mesh.getNext(edge)), mesh.getVertex(mesh.getPrev(edge))));
delaunayTriangulation.splitTriangle(face, centerPoint); delaunayTriangulation.splitTriangle(face, centerPoint);
delaunayTriangulation.finalize(); delaunayTriangulation.finalize();
......
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