update docs on sharp corner weighting

pull/1109/head
Mike Barry 2024-11-22 08:59:45 -05:00
rodzic 3476a10efd
commit d234b2ed70
1 zmienionych plików z 6 dodań i 3 usunięć

Wyświetl plik

@ -24,9 +24,10 @@ public class VWSimplifier extends GeometryTransformer implements Function<Geomet
} }
/** /**
* Apply a penalty to filter-out sharp corners: {@code k=0} means no penalty, {@code k=0.5} makes the effective area * Apply a penalty from {@code k=0} to {@code k=1} to drop more sharp corners from the resulting geometry.
* of shallow corners 50% larger than sharp corners, and {@code k=1} makes the effective area of shallow corners * <p>
* double that of sharp corners. * {@code k=0} is the default to apply no penalty for corner sharpness and just drop based on effective triangle area
* at the vertex. {@code k=0.7} is the recommended setting to drop corners based on weighted effective area.
*/ */
public VWSimplifier setWeight(double k) { public VWSimplifier setWeight(double k) {
this.k = k; this.k = k;
@ -79,6 +80,7 @@ public class VWSimplifier extends GeometryTransformer implements Function<Geomet
DoubleMinHeap heap = DoubleMinHeap.newArrayHeap(num, Integer::compare); DoubleMinHeap heap = DoubleMinHeap.newArrayHeap(num, Integer::compare);
Vertex[] points = new Vertex[num]; Vertex[] points = new Vertex[num];
// TODO
// Stack<Vertex> intersecting = new Stack<>(); // Stack<Vertex> intersecting = new Stack<>();
Vertex prev = null; Vertex prev = null;
for (int i = 0; i < num; i++) { for (int i = 0; i < num; i++) {
@ -103,6 +105,7 @@ public class VWSimplifier extends GeometryTransformer implements Function<Geomet
if (point.area > tolerance || left <= min) { if (point.area > tolerance || left <= min) {
break; break;
} }
// TODO
// // Check that the new segment doesnt intersect with // // Check that the new segment doesnt intersect with
// // any existing segments, except for the points // // any existing segments, except for the points
// // immediate neighbours. // // immediate neighbours.