public Mesh.Vert[] points;
- public boolean tileon = false;
+ public boolean tileon = true;
public boolean tilemeshon = false;
- public boolean goalon = true;
- public boolean anneal = false;
+ public boolean goalon = false;
+ public boolean anneal = true;
public int breaks = 0;
boolean alt = false;
package edu.berkeley.qfat.geom;
import javax.media.opengl.*;
-/** point in 3-space; immutable */
+/** any object associated with a specific point in 3D space */
public abstract class HasPoint implements HasBoundingBox {
public abstract Point getPoint();
public float getMaxX() { return getPoint().getMaxX(); }
+++ /dev/null
-package edu.berkeley.qfat.geom;
-import javax.media.opengl.*;
-
-public class IntervalTree<V extends HasBoundingBox> {
-
-
- private static final int X_AXIS = 0;
- private static final int Y_AXIS = 1;
- private static final int Z_AXIS = 2;
-
- private class Node {
- int axis; /* 0, 1, 2 */
- V vthis;
- float maxmax, minmin;
- Node small, large;
- float bias = 0;
-
- public Node(V vthis, int axis) {
- this.vthis = vthis;
- this.axis = axis;
- maxmax = getMax(vthis);
- minmin = getMin(vthis);
- }
-
- private float getMin(V v) {
- switch(axis) {
- case X_AXIS: return v.getMinX();
- case Y_AXIS: return v.getMinY();
- case Z_AXIS: return v.getMinZ();
- }
- throw new Error();
- }
- private float getMax(V v) {
- switch(axis) {
- case X_AXIS: return v.getMaxX();
- case Y_AXIS: return v.getMaxY();
- case Z_AXIS: return v.getMaxZ();
- }
- throw new Error();
- }
- public Node insert(V vnew) {
- // FIXME bias
- if (getMax(vnew) > maxmax && getMin(vnew) < minmin) {
- float diff = Math.abs(maxmax - getMax(vnew)) - Math.abs(minmin - getMin(vnew));
- if (diff < 0) {
- maxmax = getMax(vnew);
- } else {
- minmin = getMin(vnew);
- }
- }
- if (getMax(vnew) <= maxmax) {
- right++;
- small = small == null ? new Node(vnew, (axis+1)%3) : small.insert(vnew);
- bias = (left - right) / (float)(left + right);
- if (Math.abs(bias) > Math.abs(maxbias)) maxbias = bias;
- return this;
-
- } else if (getMin(vnew) >= minmin) {
- left++;
- large = large == null ? new Node(vnew, (axis+1)%3) : large.insert(vnew);
- bias = (left - right) / (float)(left + right);
- if (Math.abs(bias) > Math.abs(maxbias)) maxbias = bias;
- return this;
- }
-
- throw new Error();
- }
- int left=0, right=0;
-
- }
-
- private Node root;
-
- public void insert(V v) {
- if (root==null) {
- root = new Node(v, X_AXIS);
- } else {
- root.insert(v);
- }
- System.out.println(maxbias + " " + size);
- size++;
- }
- int size = 0;
- float maxbias = 0;
-
- public V nearest(Point p) {
- return null;
- }
-
-}
float max_x = Float.MIN_VALUE;
float max_y = Float.MIN_VALUE;
float max_z = Float.MIN_VALUE;
- for(Point p : exact.keySet()) {
+ for(V v : this) {
+ Point p = v.getPoint();
if (p.x < min_x) min_x = p.x;
if (p.y < min_y) min_y = p.y;
if (p.z < min_z) min_z = p.z;
float max_x = Float.MIN_VALUE;
float max_y = Float.MIN_VALUE;
float max_z = Float.MIN_VALUE;
- for(Point p : exact.keySet()) {
+ for(V v : this) {
+ Point p = v.getPoint();
if (p.x < min_x) min_x = p.x;
if (p.y < min_y) min_y = p.y;
if (p.z < min_z) min_z = p.z;
import com.infomatiq.jsi.*;
import com.infomatiq.jsi.rtree.*;
-public class RTree<V extends HasBoundingBox> {
+public class RTree<V extends HasBoundingBox> implements Iterable<V> {
private com.infomatiq.jsi.rtree.RTree rtree =
new com.infomatiq.jsi.rtree.RTree();
HashMap<Integer, V> idToV = new HashMap<Integer, V>();
HashMap<V, Integer> vToId = new HashMap<V, Integer>();
+ public Iterator<V> iterator() { return vToId.keySet().iterator(); }
+
public RTree() {
Properties props = new Properties();
props.put("MinNodeEntries", "1");