mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-09-26 18:11:16 +00:00
Fixed code style
This commit is contained in:
@@ -35,22 +35,22 @@ import java.util.Stack;
|
||||
public class BezierEdge implements Serializable {
|
||||
|
||||
public List<Point2D> points = new ArrayList<>(3);
|
||||
|
||||
|
||||
private List<Point2D> revPoints = new ArrayList<>();
|
||||
|
||||
|
||||
private int hash;
|
||||
|
||||
|
||||
private int revHash;
|
||||
|
||||
|
||||
private Rectangle2D bbox;
|
||||
|
||||
private boolean empty;
|
||||
|
||||
|
||||
public BezierEdge(List<Point2D> points) {
|
||||
this.points = points;
|
||||
calcParams();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public BezierEdge clone() {
|
||||
return new BezierEdge(new ArrayList<>(points));
|
||||
@@ -127,17 +127,15 @@ public class BezierEdge implements Serializable {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
this.bbox = new Rectangle2D.Double(minX, minY, maxX - minX, maxY - minY);
|
||||
this.bbox = new Rectangle2D.Double(minX, minY, maxX - minX, maxY - minY);
|
||||
this.hash = points.hashCode();
|
||||
|
||||
|
||||
revPoints = new ArrayList<>();
|
||||
for (int i = points.size() - 1; i >= 0; i--) {
|
||||
revPoints.add(points.get(i));
|
||||
}
|
||||
this.revHash = revPoints.hashCode();
|
||||
|
||||
|
||||
|
||||
empty = true;
|
||||
Point2D p1 = getBeginPoint();
|
||||
for (int i = 1; i < points.size(); i++) {
|
||||
@@ -147,7 +145,7 @@ public class BezierEdge implements Serializable {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public Rectangle2D bbox() {
|
||||
return bbox;
|
||||
}
|
||||
@@ -398,7 +396,7 @@ public class BezierEdge implements Serializable {
|
||||
right.setVal(new BezierEdge(rightPoints));
|
||||
}
|
||||
|
||||
public BezierEdge reverse() {
|
||||
public BezierEdge reverse() {
|
||||
return new BezierEdge(revPoints);
|
||||
}
|
||||
|
||||
@@ -430,7 +428,7 @@ public class BezierEdge implements Serializable {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) {
|
||||
return true;
|
||||
}
|
||||
@@ -446,7 +444,7 @@ public class BezierEdge implements Serializable {
|
||||
}
|
||||
return Objects.equals(this.points, other.points);
|
||||
}
|
||||
|
||||
|
||||
public boolean equalsReverse(BezierEdge other) {
|
||||
if (hash != other.revHash) {
|
||||
return false;
|
||||
@@ -538,8 +536,8 @@ public class BezierEdge implements Serializable {
|
||||
System.err.println("t1 is " + t1);
|
||||
System.err.println("t2 is " + t2);
|
||||
System.err.println("intersections is " + ps);
|
||||
*/
|
||||
/*Shape r1 = new Rectangle2D.Double(0, 0, 200, 100);
|
||||
*/
|
||||
/*Shape r1 = new Rectangle2D.Double(0, 0, 200, 100);
|
||||
GeneralPath r2 = new GeneralPath(GeneralPath.WIND_EVEN_ODD);
|
||||
r2.moveTo(0, 0);
|
||||
r2.lineTo(100, 0);
|
||||
@@ -573,9 +571,8 @@ public class BezierEdge implements Serializable {
|
||||
//a1.exclusiveOr(a2);
|
||||
|
||||
|
||||
*/
|
||||
|
||||
/*GeneralPath p1 = new GeneralPath(GeneralPath.WIND_EVEN_ODD);
|
||||
*/
|
||||
/*GeneralPath p1 = new GeneralPath(GeneralPath.WIND_EVEN_ODD);
|
||||
p1.moveTo(0, 0);
|
||||
p1.lineTo(200, 0);
|
||||
p1.lineTo(200, 200);
|
||||
@@ -590,10 +587,8 @@ public class BezierEdge implements Serializable {
|
||||
p1.closePath();
|
||||
|
||||
System.err.println("cont:" + p1.contains(100, 100));
|
||||
System.err.println("cont:" + p1.contains(150, 150)); */
|
||||
|
||||
System.err.println("cont:" + p1.contains(150, 150)); */
|
||||
//System.err.println("minDist = " + minDist+", maxDist = "+ maxDist);
|
||||
|
||||
//System.err.println("eArea = " + Areas.calcArea(a1));
|
||||
|
||||
/*Point2D c = new Point2D.Double(
|
||||
|
||||
@@ -28,12 +28,13 @@ import java.util.List;
|
||||
* @author JPEXS
|
||||
*/
|
||||
public class Distances {
|
||||
|
||||
public static double getBatchDistance(List<BezierEdge> batch1, List<BezierEdge> batch2) {
|
||||
Area a1 = batchToArea(batch1);
|
||||
Area a2 = batchToArea(batch2);
|
||||
return areaDist(a1, a2);
|
||||
}
|
||||
|
||||
|
||||
private static Area batchToArea(List<BezierEdge> batch) {
|
||||
GeneralPath path = new GeneralPath(GeneralPath.WIND_EVEN_ODD);
|
||||
if (batch.isEmpty()) {
|
||||
@@ -53,7 +54,7 @@ public class Distances {
|
||||
path.closePath();
|
||||
return new Area(path);
|
||||
}
|
||||
|
||||
|
||||
private static double areaDist(Area a1, Area a2) {
|
||||
List<Point2D> points1 = getAreaPoints(a1);
|
||||
List<Point2D> points2 = getAreaPoints(a2);
|
||||
@@ -76,7 +77,7 @@ public class Distances {
|
||||
}
|
||||
return maxDist;
|
||||
}
|
||||
|
||||
|
||||
private static List<Point2D> getAreaPoints(Area area) {
|
||||
double F = 1.0;
|
||||
List<Point2D> points = new ArrayList<>();
|
||||
@@ -110,13 +111,13 @@ public class Distances {
|
||||
for (int d = 1; d <= divisor; d++) {
|
||||
Point2D p2 = new Point2D.Double(xPrev + d * dx / divisor, yPrev + d * dy / divisor);
|
||||
points.add(p2);
|
||||
}
|
||||
}
|
||||
//points.add(np);
|
||||
//System.err.println("dx, dy: "+dx+", "+dy);
|
||||
break;
|
||||
case PathIterator.SEG_CLOSE:
|
||||
|
||||
break;
|
||||
|
||||
break;
|
||||
default:
|
||||
throw new RuntimeException("Curved edge not expected");
|
||||
}
|
||||
|
||||
@@ -166,7 +166,6 @@ public class Intersections {
|
||||
return intersectPolylinePolyline(a, b);
|
||||
}
|
||||
|
||||
|
||||
public static boolean rectIntersection(Rectangle2D r1, Rectangle2D r2) {
|
||||
double xmin = Math.max(r1.getX(), r2.getX());
|
||||
double xmax1 = r1.getX() + r1.getWidth();
|
||||
@@ -183,8 +182,8 @@ public class Intersections {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static Rectangle2D getBBox(Point2D ...points) {
|
||||
|
||||
public static Rectangle2D getBBox(Point2D... points) {
|
||||
double minX = Double.MAX_VALUE;
|
||||
double minY = Double.MAX_VALUE;
|
||||
double maxX = -Double.MAX_VALUE;
|
||||
@@ -206,8 +205,8 @@ public class Intersections {
|
||||
|
||||
return new Rectangle2D.Double(minX, minY, maxX - minX, maxY - minY);
|
||||
}
|
||||
|
||||
public static List<Point2D> intersectBezier2Bezier2(Point2D a1, Point2D a2, Point2D a3, Point2D b1, Point2D b2, Point2D b3) {
|
||||
|
||||
public static List<Point2D> intersectBezier2Bezier2(Point2D a1, Point2D a2, Point2D a3, Point2D b1, Point2D b2, Point2D b3) {
|
||||
Point2D pa;
|
||||
Point2D pb;
|
||||
List<Point2D> result = new ArrayList<>();
|
||||
@@ -259,7 +258,7 @@ public class Intersections {
|
||||
Samples where this happens:
|
||||
M 6369 13040 Q 6380 13030 6427 13018 and M 6338 13099 Q 6358 13050 6369 13040
|
||||
M 6369 13040 Q 6380 13030 6427 13018 and M 6338 13099 Q 6358 13050 6369 13040
|
||||
*/
|
||||
*/
|
||||
roots = new ArrayList<>();
|
||||
}
|
||||
for (double s : roots) {
|
||||
|
||||
Reference in New Issue
Block a user