Commit 07abbe58 by Zoennchen Committed by Benedikt Zoennchen

### flip on the gpu shall now work, but there is a lot code-synchronization to implement.

parent 21d9ca60
 ... ... @@ -289,15 +289,17 @@ public class GeometryUtils { } /** * Tests if the circle defined by three non-lin points (p1,p2,p3) contains the point r. * Tests if the circle defined by three non-lin points (p1,p2,p3) contains the point p. * The center of the circle is the circumcenter of the triangle and the radius is equalt to the * distance between the circumcenter and any point of {p1, p2, p3}. * * Assumtion: a, b, c are in ccw-order! * * @param a point of the triangle * @param b point of the triangle * @param c point of the triangle * @param p point which the circle might contain. * @return true, if the circle defined by three non-lin points (p1,p2,p3) contains the point r, otherwise false * @return true, if the circle defined by three non-lin points (p1,p2,p3) contains the point p, otherwise false */ public static boolean isInsideCircle(final IPoint a, final IPoint b, final IPoint c, final IPoint p) { return isInsideCircle(a, b, c, p.getX(), p.getY()); ... ...
 ... ... @@ -53,9 +53,40 @@ public class CLGatherer { index++; edgeBuffer.put(index, edge.getEnd()); index++; edgeBuffer.put(index, mesh.getFace(edge).getId()); index++; edgeBuffer.put(index, mesh.getFace(mesh.getTwin(edge)).getId()); if(mesh.isBoundary(mesh.getFace(edge))) { edgeBuffer.put(index, mesh.getFace(mesh.getTwin(edge)).getId()); index++; edgeBuffer.put(index, -1); index++; if(mesh.isBoundary(mesh.getFace(mesh.getTwin(edge)))) { throw new IllegalArgumentException("invalid mesh!"); } } else if(mesh.isBoundary(mesh.getFace(mesh.getTwin(edge)))) { edgeBuffer.put(index, mesh.getFace(edge).getId()); index++; edgeBuffer.put(index, -1); index++; if(mesh.isBoundary(mesh.getFace(edge))) { throw new IllegalArgumentException("invalid mesh!"); } } else { edgeBuffer.put(index, mesh.getFace(edge).getId()); index++; edgeBuffer.put(index, mesh.getFace(mesh.getTwin(edge)).getId()); index++; } } return edgeBuffer; } public static

IntBuffer getTwins(@NotNull final AMesh

mesh) { Collection> edges = mesh.getEdges(); IntBuffer edgeBuffer = MemoryUtil.memAllocInt(edges.size()); int index = 0; for(AHalfEdge

edge : edges) { edgeBuffer.put(index, mesh.getTwin(edge).getId()); index++; } return edgeBuffer; ... ...

{ // first triangle xyz face1 = mesh.createFace(); x = mesh.insertVertex(-30, 0); y = mesh.insertVertex(30, 0); z = mesh.insertVertex(1.5,3.0); x = mesh.insertVertex(-100, 0); y = mesh.insertVertex(100, 0); z = mesh.insertVertex(0, 1); zx = mesh.createEdge(x, face1); mesh.setEdge(x, zx); ... ... @@ -51,7 +52,7 @@ public interface IFace

{ // second triangle yxw face2 = mesh.createFace(); w = mesh.insertVertex(1.5,-1.5); w = mesh.insertVertex(0, -1); AHalfEdge yx = mesh.createEdge(x, face2); AHalfEdge xw = mesh.createEdge(w, face2); ... ... @@ -86,6 +87,13 @@ public interface IFace

{ mesh.setNext(wx, xz); mesh.setNext(xz, zy); /*System.out.println(GeometryUtils.isInCircumscribedCycle(x, y, z, w)); System.out.println(GeometryUtils.isInCircumscribedCycle(x, w, y, z)); System.out.println(GeometryUtils.isInCircumscribedCycle(y, w, x, z)); System.out.println(GeometryUtils.isInCircumscribedCycle(x, w, z, y)); System.out.println(GeometryUtils.isInCircumscribedCycle(z, w, x, y));*/ return mesh; } } \ No newline at end of file

 ... ... @@ -98,11 +98,15 @@ public class CLPSMeshing implements IPSMeshing { } public void step() { step(true); } public void step(boolean flipAll) { minDeltaTravelDistance = Double.MAX_VALUE; illegalMovement = false; //log.info(scalingFactor); clDistMesh.step(); clDistMesh.step(flipAll); //flipEdges(); //retriangulate(); ... ... @@ -176,7 +180,7 @@ public class CLPSMeshing implements IPSMeshing { //Set points = getMesh().getVertices().stream().map(vertex -> getMesh().getPoint(vertex)).collect(Collectors.toSet()); //removeLowQualityTriangles(); triangulation = ITriangulation.createATriangulation(IPointLocator.Type.DELAUNAY_HIERARCHY, getMesh().getPoints(), (x, y) -> new MeshPoint(x, y, false)); removeTrianglesInsideObstacles(); // removeTrianglesInsideObstacles(); triangulation.finalize(); if(clDistMesh != null) { ... ...
 ... ... @@ -22,9 +22,9 @@ public class TestEnhancedVersion3 extends JFrame { IDistanceFunction distanceFunc = p -> Math.abs(6 - Math.sqrt(p.getX() * p.getX() + p.getY() * p.getY())) - 4; //IDistanceFunction distanceFunc4 = p -> Math.max(Math.abs(p.getY()) - 4, Math.abs(p.getX()) - 25); //IEdgeLengthFunction edgeLengthFunc = p -> 1.0 + p.distanceToOrigin(); //IEdgeLengthFunction edgeLengthFunc = p -> 1.0; IEdgeLengthFunction edgeLengthFunc = p -> 1.0; //IEdgeLengthFunction edgeLengthFunc = p -> 1.0 + Math.min(Math.abs(distanceFunc.apply(p) + 4), Math.abs(distanceFunc.apply(p))); IEdgeLengthFunction edgeLengthFunc = p -> 1.0 + Math.abs(distanceFunc.apply(p)*0.5); //IEdgeLengthFunction edgeLengthFunc = p -> 1.0 + Math.abs(distanceFunc.apply(p)*0.5); //IDistanceFunction distanceFunc = p -> Math.max(Math.max(Math.max(distanceFunc1.apply(p), distanceFunc2.apply(p)), distanceFunc3.apply(p)), distanceFunc4.apply(p)); ... ... @@ -33,7 +33,7 @@ public class TestEnhancedVersion3 extends JFrame { //IEdgeLengthFunction edgeLengthFunc = p -> 1.0 + Math.min(Math.abs(distanceFunc.apply(p) + 4), Math.abs(distanceFunc.apply(p))); //IEdgeLengthFunction edgeLengthFunc = p -> 1.0; VRectangle bbox = new VRectangle(-11, -11, 22, 22); PSMeshing meshGenerator = new PSMeshing(distanceFunc, edgeLengthFunc, 0.6, bbox, new ArrayList<>()); PSMeshing meshGenerator = new PSMeshing(distanceFunc, edgeLengthFunc, 0.5, bbox, new ArrayList<>()); meshGenerator.initialize(); PSMeshingPanel distmeshPanel = new PSMeshingPanel(meshGenerator, 1000, 800); ... ... @@ -62,7 +62,7 @@ public class TestEnhancedVersion3 extends JFrame { counter++; long ms = System.currentTimeMillis(); meshGenerator.stepParallel(); meshGenerator.step(); ms = System.currentTimeMillis() - ms; time += ms; System.out.println("Quality: " + meshGenerator.getQuality()); ... ...
 ... ... @@ -27,7 +27,7 @@ public class TestEnhancedVersion4 extends JFrame { //IEdgeLengthFunction edgeLengthFunc = p -> 1.0 + Math.min(Math.abs(distanceFunc.apply(p) + 4), Math.abs(distanceFunc.apply(p))); //IEdgeLengthFunction edgeLengthFunc = p -> 1.0; VRectangle bbox = new VRectangle(-11, -11, 22, 22); CLPSMeshing meshGenerator = new CLPSMeshing(distanceFunc, edgeLengthFunc, 1.0, bbox, new ArrayList<>()); CLPSMeshing meshGenerator = new CLPSMeshing(distanceFunc, edgeLengthFunc, 0.5, bbox, new ArrayList<>()); meshGenerator.initialize(); PSMeshingPanel distmeshPanel = new PSMeshingPanel(meshGenerator, 1000, 800); ... ... @@ -56,14 +56,30 @@ public class TestEnhancedVersion4 extends JFrame { long ms = System.currentTimeMillis(); meshGenerator.step(); if(counter < 100) { meshGenerator.step(false); } else { meshGenerator.step(true); } ms = System.currentTimeMillis() - ms; time += ms; System.out.println("Step-Time: " + ms); meshGenerator.refresh(); distmeshPanel.update(); distmeshPanel.repaint(); if(counter < 100) { meshGenerator.retriangulate(); } counter++; /*try { Thread.sleep(2000); } catch (InterruptedException e) { e.printStackTrace(); }*/ } meshGenerator.finish(); distmeshPanel.update(); ... ...
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!