Skip to content

Commit

Permalink
https://github.com/CommonWealthRobotics/BowlerStudio/issues/431
Browse files Browse the repository at this point in the history
  • Loading branch information
madhephaestus committed Nov 16, 2024
1 parent e4e247a commit 89f967d
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 118 deletions.
98 changes: 0 additions & 98 deletions src/main/java/eu/mihosoft/vrl/v3d/TextExtrude.java
Original file line number Diff line number Diff line change
Expand Up @@ -199,104 +199,6 @@ public List<Vector3d> getOffset() {
.map(LineSegment::getOrigen).collect(Collectors.toList());
}

private void addPoint(Vector3d v) {
// if (!unique.add(v)) {
//
// System.out.println("Skipping Duplicate " + v);
// } else
// points.add(v);

}

// private void getPoints(PathElement elem) {
// if (elem instanceof MoveTo) {
// loadPoints();
// p0 = new Vector3d((float) ((MoveTo) elem).getX(), (float) ((MoveTo) elem).getY(), 0f);
// addPoint(p0);
// } else if (elem instanceof LineTo) {
// addPoint(new Vector3d((float) ((LineTo) elem).getX(), (float) ((LineTo) elem).getY(), 0f));
// } else if (elem instanceof CubicCurveTo) {
// Vector3d ini = (points.size() > 0 ? points.get(points.size() - 1) : p0);
// IntStream.rangeClosed(1, POINTS_CURVE)
// .forEach(i -> addPoint(evalCubicBezier((CubicCurveTo) elem, ini, ((double) i) / POINTS_CURVE)));
// } else if (elem instanceof QuadCurveTo) {
// Vector3d ini = (points.size() > 0 ? points.get(points.size() - 1) : p0);
// IntStream.rangeClosed(1, POINTS_CURVE)
// .forEach(i -> addPoint(evalQuadBezier((QuadCurveTo) elem, ini, ((double) i) / POINTS_CURVE)));
// } else if (elem instanceof ClosePath) {
// addPoint(p0);
// // Every closed path is a polygon (exterior or interior==hole)
// // the text, the list of points and a new path between them are
// // stored in a LineSegment: a continuous line that can change direction
// if (Math.abs(getArea()) > 0.001) {
// LineSegment line = new LineSegment(text);
// line.setHole(isHole());
// line.setPoints(points);
// line.setPath(generatePath());
// line.setOrigen(p0);
// polis.add(line);
// }
// loadPoints();
//
// }
// }
//
// private void loadPoints() {
// if (points.size() > 4) {
// // points.remove(points.size() - 1);
// boolean hole = Extrude.isCCW(Polygon.fromPoints(points));
// CSG newLetter = Extrude.points(new Vector3d(0, 0, dir), points);
//
// if (!hole)
// sections.add(newLetter);
// else
// holes.add(newLetter);
// }
// points = new ArrayList<>();
// }
//
// private Vector3d evalCubicBezier(CubicCurveTo c, Vector3d ini, double t) {
// Vector3d p = new Vector3d(
// (float) (Math.pow(1 - t, 3) * ini.x + 3 * t * Math.pow(1 - t, 2) * c.getControlX1()
// + 3 * (1 - t) * t * t * c.getControlX2() + Math.pow(t, 3) * c.getX()),
// (float) (Math.pow(1 - t, 3) * ini.y + 3 * t * Math.pow(1 - t, 2) * c.getControlY1()
// + 3 * (1 - t) * t * t * c.getControlY2() + Math.pow(t, 3) * c.getY()),
// 0f);
// return p;
// }
//
// private Vector3d evalQuadBezier(QuadCurveTo c, Vector3d ini, double t) {
// Vector3d p = new Vector3d(
// (float) (Math.pow(1 - t, 2) * ini.x + 2 * (1 - t) * t * c.getControlX() + Math.pow(t, 2) * c.getX()),
// (float) (Math.pow(1 - t, 2) * ini.y + 2 * (1 - t) * t * c.getControlY() + Math.pow(t, 2) * c.getY()),
// 0f);
// return p;
// }
//
// private double getArea() {
// DoubleProperty res = new SimpleDoubleProperty();
// IntStream.range(0, points.size())
// .forEach(i -> res.set(res.get() + points.get(i).cross(points.get((i + 1) % points.size())).z));
// // com.neuronrobotics.sdk.common.Log.error("path: "+res.doubleValue()/2);
//
// return res.doubleValue() / 2d;
// }
//
// private boolean isHole() {
// // area>0 -> the path is a hole, clockwise (y up)
// // area<0 -> the path is a polygon, counterclockwise (y up)
// return getArea() > 0;
// }
//
// private Path generatePath() {
// Path path = new Path(new MoveTo(points.get(0).x, points.get(0).y));
// points.stream().skip(1).forEach(p -> path.getElements().add(new LineTo(p.x, p.y)));
// path.getElements().add(new ClosePath());
// path.setStroke(Color.GREEN);
// // Path must be filled to allow Shape.intersect
// path.setFill(Color.RED);
// return path;
// }
// Below is AI slop
private static final double CURVE_SEGMENTS = 6; // Number of segments to approximate curves
private static final double POINT_EPSILON = 0.0000001; // Distance threshold for considering points equal
Expand Down
20 changes: 0 additions & 20 deletions src/main/java/eu/mihosoft/vrl/v3d/Vector3d.java
Original file line number Diff line number Diff line change
Expand Up @@ -447,26 +447,6 @@ public int hashCode() {
return hash;
}

// @Override
// public boolean equals(Object obj) {
// if (obj == null) {
// return false;
// }
// if (getClass() != obj.getClass()) {
// return false;
// }
// final Vector3d other = (Vector3d) obj;
// if (Double.doubleToLongBits(this.x) != Double.doubleToLongBits(other.x)) {
// return false;
// }
// if (Double.doubleToLongBits(this.y) != Double.doubleToLongBits(other.y)) {
// return false;
// }
// if (Double.doubleToLongBits(this.z) != Double.doubleToLongBits(other.z)) {
// return false;
// }
// return true;
// }
/**
* Creates a new vector with specified {@code x}.
*
Expand Down

0 comments on commit 89f967d

Please sign in to comment.