Skip to content

Commit

Permalink
removing all print statements
Browse files Browse the repository at this point in the history
  • Loading branch information
madhephaestus committed Oct 27, 2024
1 parent 730e0f5 commit a6c4892
Show file tree
Hide file tree
Showing 21 changed files with 132 additions and 141 deletions.
32 changes: 16 additions & 16 deletions src/main/java/eu/mihosoft/vrl/v3d/CSG.java
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ public class CSG implements IuserAPI {
private static ICSGProgress progressMoniter = new ICSGProgress() {
@Override
public void progressUpdate(int currentIndex, int finalIndex, String type, CSG intermediateShape) {
System.out.println(type + "ing " + currentIndex + " of " + finalIndex);
//System.out.println(type + "ing " + currentIndex + " of " + finalIndex);
}
};

Expand Down Expand Up @@ -826,23 +826,23 @@ public CSG union(List<CSG> csgs) {
// for(int i=0;i<csgs.size();i++) {
// incomingPolys.addAll(csgs.get(i).getPolygons());
// }
// //System.out.println("Node list A");
// ////System.out.println("Node list A");
// Node a = new Node(this.clone().getPolygons());
// //System.out.println("Node list B");
// ////System.out.println("Node list B");
// Node b = new Node(incomingPolys);
// //System.out.println("a.clipTo(b)");
// ////System.out.println("a.clipTo(b)");
// a.clipTo(b);
// //System.out.println("b.clipTo(a)");
// ////System.out.println("b.clipTo(a)");
// b.clipTo(a);
// //System.out.println("b.invert();");
// ////System.out.println("b.invert();");
// b.invert();
// //System.out.println("b.clipTo(a);");
// ////System.out.println("b.clipTo(a);");
// b.clipTo(a);
// //System.out.println("b.invert();");
// ////System.out.println("b.invert();");
// b.invert();
// //System.out.println("a.build(b.allPolygons());");
// ////System.out.println("a.build(b.allPolygons());");
// a.build(b.allPolygons());
// //System.out.println("CSG.fromPolygons(a.allPolygons()).optimization(getOptType())");
// ////System.out.println("CSG.fromPolygons(a.allPolygons()).optimization(getOptType())");
// return CSG.fromPolygons(a.allPolygons()).optimization(getOptType());

CSG result = this;
Expand Down Expand Up @@ -1429,7 +1429,7 @@ public CSG triangulate(boolean fix) {
if(triangulated)
return this;

//System.out.println("CSG triangulating for " + name+"..");
////System.out.println("CSG triangulating for " + name+"..");
ArrayList<Polygon> toAdd = new ArrayList<Polygon>();
ArrayList<Polygon> degenerates = new ArrayList<Polygon>();
if (providerOf3d == null && Debug3dProvider.provider != null)
Expand Down Expand Up @@ -1458,7 +1458,7 @@ public CSG triangulate(boolean fix) {
Debug3dProvider.clearScreen();
Stream<Polygon> degenStreeam;
degenStreeam =polygons.stream(); // this operation is read-modify-write and can not be done in parallel
System.out.println("Found "+degenerates.size()+" degenerate triangles, Attempting to fix");
//System.out.println("Found "+degenerates.size()+" degenerate triangles, Attempting to fix");
degenStreeam.forEach(p -> fixDegenerates(toAdd, p));
}else {
needsDegeneratesPruned=true;
Expand Down Expand Up @@ -1490,7 +1490,7 @@ private CSG fixDegenerates(ArrayList<Polygon> toAdd, Polygon p) {
ArrayList<Edge> edges = ptoA.edges();
for(Edge e :edges) {
if(e.equals(longEdge)) {
//System.out.println("Degenerate Mate Found!");
////System.out.println("Degenerate Mate Found!");
polygonsSharing.add(ptoA);
Debug3dProvider.addObject(ptoA);
// TODO inject the points into the found edge
Expand Down Expand Up @@ -1524,7 +1524,7 @@ private CSG fixDegenerates(ArrayList<Polygon> toAdd, Polygon p) {
}
}
if(polygonsSharing.size()==0) {
//System.out.println("Error! Degenerate triangle does not share edge with any triangle");
////System.out.println("Error! Degenerate triangle does not share edge with any triangle");
}
if(polygonsSharingFixed.size()>0) {
toAdd.removeAll(polygonsSharing);
Expand All @@ -1545,7 +1545,7 @@ private CSG updatePolygons(ArrayList<Polygon> toAdd, ArrayList<Polygon> degenera
if (p.vertices.size() == 3) {
toAdd.add(p);
}else{
// System.out.println("Fixing error in STL " + name + " polygon# " + i + "
// //System.out.println("Fixing error in STL " + name + " polygon# " + i + "
// number of vertices " + p.vertices.size());
try {
List<Polygon> triangles = PolygonUtil.concaveToConvex(p);
Expand Down Expand Up @@ -1987,7 +1987,7 @@ public static enum OptType {
*/
@Deprecated
public ArrayList<CSG> minovsky(CSG travelingShape) {
System.out.println("Hail Zeon!");
//System.out.println("Hail Zeon!");
return minkowski(travelingShape);
}

Expand Down
20 changes: 10 additions & 10 deletions src/main/java/eu/mihosoft/vrl/v3d/DXF.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public static ArrayList<CSG> toParts(File source, double extrudeDistance) {
if (entityIterator != null) {
for (; entityIterator.hasNext();) {
String entityType = (String) entityIterator.next();
System.out.println(entityType);
//System.out.println(entityType);
if (entityType.contentEquals(DXFConstants.ENTITY_TYPE_POLYLINE)) {

// get all polylines from the layer
Expand All @@ -57,23 +57,23 @@ public static ArrayList<CSG> toParts(File source, double extrudeDistance) {
DXFVertex vertex = pline.getVertex(i);
Point point = vertex.getPoint();
points.add(new Vector3d(point.getX(), point.getY(), point.getZ()));
System.out.println(points.get(points.size()-1)+",");
//System.out.println(points.get(points.size()-1)+",");
}
}
}
}
else if (entityType.contentEquals(DXFConstants.ENTITY_TYPE_LINE)) {
// get all polylines from the layer
System.out.println("Loading line");
//System.out.println("Loading line");
List plines = layer.getDXFEntities(entityType);
if (plines != null) {
for (Object p : plines) {
DXFLine pline = (DXFLine) p;
Point point = pline.getStartPoint();
points.add(new Vector3d(point.getX(), point.getY(), point.getZ()));
System.out.println(points.get(points.size()-1)+",");
//System.out.println(points.get(points.size()-1)+",");
}
System.out.println("Extruding");
//System.out.println("Extruding");
parts.add(Extrude.points(new Vector3d(0, 0, extrudeDistance), points));
points.clear();

Expand All @@ -90,20 +90,20 @@ else if (entityType.contentEquals(DXFConstants.ENTITY_TYPE_SPLINE)) {
for (;splinePointIterator.hasNext();) {
SplinePoint point =(SplinePoint) splinePointIterator.next();
points.add(new Vector3d(point.getX(), point.getY(), point.getZ()));
System.out.println(points.get(points.size()-1)+",");
//System.out.println(points.get(points.size()-1)+",");
}
}
}
}
else {
System.out.println("Found type: " + entityType);
//System.out.println("Found type: " + entityType);

}
// System.out.println("Points: \n{");
// //System.out.println("Points: \n{");
// for(Vector3d v: points){
// System.out.println(v+",");
// //System.out.println(v+",");
// }
// System.out.println("}");
// //System.out.println("}");

}

Expand Down
28 changes: 14 additions & 14 deletions src/main/java/eu/mihosoft/vrl/v3d/Edge.java
Original file line number Diff line number Diff line change
Expand Up @@ -158,18 +158,18 @@ public static List<Polygon> toPolygons(List<Edge> boundaryEdges, Plane plane) {
filter(e -> finalEdge.p2.equals(e.p1)).findFirst().get());

if (used[nextEdgeIndex]) {
// System.out.println("nexIndex: " + nextEdgeIndex);
// //System.out.println("nexIndex: " + nextEdgeIndex);
break;
}
// System.out.print("edge: " + edge.p2.pos);
edge = boundaryEdges.get(nextEdgeIndex);
// System.out.println("-> edge: " + edge.p1.pos);
// //System.out.println("-> edge: " + edge.p1.pos);
used[nextEdgeIndex] = true;
}

List<Polygon> result = new ArrayList<>();

System.out.println("#bnd-path-length: " + boundaryPath.size());
//System.out.println("#bnd-path-length: " + boundaryPath.size());

result.add(toPolygon(boundaryPath, plane));

Expand Down Expand Up @@ -428,7 +428,7 @@ public static List<Polygon> boundaryPaths(List<Edge> boundaryEdges) {
filter(e -> finalEdge.p2.equals(e.p1)).findFirst();

if (!nextEdgeResult.isPresent()) {
// System.out.println("ERROR: unclosed path:"
// //System.out.println("ERROR: unclosed path:"
// + " no edge found with " + finalEdge.p2);
break;
}
Expand All @@ -442,7 +442,7 @@ public static List<Polygon> boundaryPaths(List<Edge> boundaryEdges) {
}

edge = nextEdge;
// System.out.println("-> edge: " + edge.p1.pos);
// //System.out.println("-> edge: " + edge.p1.pos);
used[nextEdgeIndex] = true;
}

Expand All @@ -460,7 +460,7 @@ public static List<Polygon> boundaryPaths(List<Edge> boundaryEdges) {

}
//
// System.out.println("paths: " + result.size());
// //System.out.println("paths: " + result.size());

return result;
}
Expand Down Expand Up @@ -504,18 +504,18 @@ public static List<Polygon> _toPolygons(List<Edge> boundaryEdges, Plane plane) {
filter(e -> finalEdge.p2.equals(e.p1)).findFirst().get());

if (used[nextEdgeIndex]) {
// System.out.println("nexIndex: " + nextEdgeIndex);
// //System.out.println("nexIndex: " + nextEdgeIndex);
break;
}
// System.out.print("edge: " + edge.p2.pos);
edge = boundaryEdges.get(nextEdgeIndex);
// System.out.println("-> edge: " + edge.p1.pos);
// //System.out.println("-> edge: " + edge.p1.pos);
used[nextEdgeIndex] = true;
}

List<Polygon> result = new ArrayList<>();

System.out.println("#bnd-path-length: " + boundaryPath.size());
//System.out.println("#bnd-path-length: " + boundaryPath.size());

result.add(toPolygon(boundaryPath, plane));

Expand Down Expand Up @@ -806,7 +806,7 @@ public static List<Edge> boundaryEdgesOfPlaneGroup(List<Polygon> planeGroup) {
).count() == 0).collect(Collectors.toList());

//
// System.out.println("#bnd-edges: " + realBndEdges.size()
// //System.out.println("#bnd-edges: " + realBndEdges.size()
// + ",#edges: " + edges.size()
// + ", #del-bnd-edges: " + (boundaryEdges.size() - realBndEdges.size()));
return realBndEdges;
Expand All @@ -824,7 +824,7 @@ private static List<Polygon> boundaryPolygonsOfPlaneGroup(
List<Polygon> polygons = boundaryPathsWithHoles(
boundaryPaths(boundaryEdgesOfPlaneGroup(planeGroup)));

System.out.println("polygons: " + polygons.size());
//System.out.println("polygons: " + polygons.size());

List<Polygon> result = new ArrayList<>(polygons.size());

Expand Down Expand Up @@ -876,7 +876,7 @@ public static boolean falseBoundaryEdgeSharedWithOtherEdge(Edge fbe, Edge e) {
private static List<List<Polygon>> searchPlaneGroups(List<Polygon> polygons) {
List<List<Polygon>> planeGroups = new ArrayList<>();
boolean[] used = new boolean[polygons.size()];
System.out.println("#polys: " + polygons.size());
//System.out.println("#polys: " + polygons.size());
for (int pOuterI = 0; pOuterI < polygons.size(); pOuterI++) {

if (used[pOuterI]) {
Expand All @@ -902,11 +902,11 @@ private static List<List<Polygon>> searchPlaneGroups(List<Polygon> polygons) {

double angle = nOuter.angle(nInner);

// System.out.println("angle: " + angle + " between " + pOuterI+" -> " + pInnerI);
// //System.out.println("angle: " + angle + " between " + pOuterI+" -> " + pInnerI);
if (angle < 0.01 /*&& abs(pOuter.plane.dist - pInner.plane.dist) < 0.1*/) {
otherPolysInPlane.add(pInner);
used[pInnerI] = true;
System.out.println("used: " + pOuterI + " -> " + pInnerI);
//System.out.println("used: " + pOuterI + " -> " + pInnerI);
}
}

Expand Down
16 changes: 8 additions & 8 deletions src/main/java/eu/mihosoft/vrl/v3d/Extrude.java
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ private CSG monotoneExtrude(Vector3d dir, Polygon polygon1) {
Polygon polygon2 = polygon1.translated(dir);

int numvertices = polygon1.vertices.size();
System.out.println("Building Polygon "+polygon1.getPoints().size());
//System.out.println("Building Polygon "+polygon1.getPoints().size());
for (int i = 0; i < numvertices; i++) {

int nexti = (i + 1) % numvertices;
Expand All @@ -101,14 +101,14 @@ private CSG monotoneExtrude(Vector3d dir, Polygon polygon1) {
Vector3d topV2 = polygon2.vertices.get(nexti).pos;
double distance = bottomV1.minus(bottomV2).magnitude();
if(Math.abs(distance)<Plane.EPSILON) {
System.out.println("Skipping invalid polygon "+i+" to "+nexti);
//System.out.println("Skipping invalid polygon "+i+" to "+nexti);
continue;
}
List<Vector3d> pPoints = Arrays.asList(bottomV2, topV2, topV1, bottomV1);
try {
newPolygons.add(Polygon.fromPoints(pPoints, polygon1.getStorage()));
}catch(Exception ex) {
System.out.println("Polygon has problems: ");
//System.out.println("Polygon has problems: ");
ex.printStackTrace();
}
}
Expand Down Expand Up @@ -437,7 +437,7 @@ public static ArrayList<Transform> bezierToTransforms(Vector3d controlA, Vector3
}

public static ArrayList<Transform> bezierToTransforms(List<Vector3d> parts, int iterations) {
// System.out.println("Bezier type "+parts.size());
// //System.out.println("Bezier type "+parts.size());
if (parts.size() == 3)
return bezierToTransforms(parts.get(0), parts.get(1), parts.get(2), iterations);
if (parts.size() == 2)
Expand Down Expand Up @@ -471,7 +471,7 @@ public static ArrayList<Transform> bezierToTransforms(BezierPath pathA, BezierPa
double rise = zdiff;
double run = Math.sqrt((ydiff * ydiff) + (xdiff * xdiff));
double rotz = 90 - Math.toDegrees(Math.atan2(xdiff, ydiff));
// System.out.println("Rot z = "+rotz+" x="+xdiff+" y="+ydiff);
// //System.out.println("Rot z = "+rotz+" x="+xdiff+" y="+ydiff);
double roty = Math.toDegrees(Math.atan2(rise, run));
Transform t = new Transform();
t.translateX(x);
Expand Down Expand Up @@ -517,13 +517,13 @@ public static ArrayList<Transform> bezierToTransforms(BezierPath pathA, BezierPa
rise = zdiff;
run = Math.sqrt((ydiff * ydiff) + (xdiff * xdiff));
rotz = 90 - Math.toDegrees(Math.atan2(xdiff, ydiff));
// System.out.println("Rot z = "+rotz+" x="+xdiff+" y="+ydiff);
// //System.out.println("Rot z = "+rotz+" x="+xdiff+" y="+ydiff);
roty = Math.toDegrees(Math.atan2(rise, run));

t.rotZ(-rotz);
t.rotY(roty);
// if(i==0)
// System.out.println( " Tr = "+x+" "+y+" "+z+" path = "+pathFunction);
// //System.out.println( " Tr = "+x+" "+y+" "+z+" path = "+pathFunction);
// println "z = "+rotz+" y = "+roty
p.add(t);
lastx = x;
Expand Down Expand Up @@ -576,7 +576,7 @@ public static ArrayList<Transform> bezierToTransforms(Vector3d start, Vector3d c
path2.parsePathString(b);
// newParts.remove(parts.size()-1)
// newParts.remove(0)
// System.out.println("Parsing "+startString+" \nand\n"+b);
// //System.out.println("Parsing "+startString+" \nand\n"+b);
return bezierToTransforms(path, path2, iterations, controlA, controlB);
}

Expand Down
4 changes: 2 additions & 2 deletions src/main/java/eu/mihosoft/vrl/v3d/Plane.java
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ else if (somePointsInBack) {
// skip adding broken polygon here
}
} else {
System.out.println("Front Clip Fault!");
//System.out.println("Front Clip Fault!");
}
if (b.size() >= 3) {
try {
Expand All @@ -279,7 +279,7 @@ else if (somePointsInBack) {
// skip adding broken polygon here
}
} else {
System.out.println("Back Clip Fault!");
//System.out.println("Back Clip Fault!");
}
break;
}
Expand Down
3 changes: 1 addition & 2 deletions src/main/java/eu/mihosoft/vrl/v3d/Slice.java
Original file line number Diff line number Diff line change
Expand Up @@ -314,8 +314,7 @@ public List<Polygon> slice(CSG incoming, Transform slicePlane, double normalInse
usedPixels.clear();
// if(display)BowlerStudioController.getBowlerStudio().getJfx3dmanager().clearUserNode()
// BowlerStudioController.getBowlerStudio() .addObject(polys, new File("."));
System.out.println(
"Slice took: " + (((double) (System.currentTimeMillis() - startTime)) / 1000.0) + " seconds");
//System.out.println("Slice took: " + (((double) (System.currentTimeMillis() - startTime)) / 1000.0) + " seconds");
return polys;
}

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/eu/mihosoft/vrl/v3d/Transform.java
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ public Transform translateZ(double value) {
*/
public Transform mirror(Plane plane) {

System.err.println("WARNING: I'm too dumb to implement the mirror() operation correctly. Please fix me!");
//System.err.println("WARNING: I'm too dumb to implement the mirror() operation correctly. Please fix me!");

double nx = plane.getNormal().x;
double ny = plane.getNormal().y;
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/eu/mihosoft/vrl/v3d/Vector3d.java
Original file line number Diff line number Diff line change
Expand Up @@ -621,8 +621,8 @@ public Vector3d orthogonal() {
// if ((this.x ==Double.NaN) || (this.y == Double.NaN) || (this.z == Double.NaN)) {
// throw new IllegalStateException("NaN is not a valid entry for a vector.");
// }
// System.out.println(" this : "+ this);
// System.out.println(" result : "+ result);
// //System.out.println(" this : "+ this);
// //System.out.println(" result : "+ result);
// check if the created vector is really orthogonal to this
// if not try one more time
while (this.dot(result) != 0.0) {
Expand Down
Loading

0 comments on commit a6c4892

Please sign in to comment.