// http://www.cs.cmu.edu/afs/cs/project/quake/public/code/predicates.c
/*
-blender keys
-- middle mouse = option+click
-- right mouse = command+click
+ blender keys
+ - middle mouse = option+click
+ - right mouse = command+click
-3,7,1 = view along axes (control for opp direction)
-4, 8, 7, 2 = rotate in discrete increments (+control to translate)
-middle trag: rotate space
-shift+middle drag: translate space
-wheel: zoom
-home: home view: take current angle, zoom to whole scnee
-5 = ortho vs non-ortho
+ 3,7,1 = view along axes (control for opp direction)
+ 4, 8, 7, 2 = rotate in discrete increments (+control to translate)
+ middle trag: rotate space
+ shift+middle drag: translate space
+ wheel: zoom
+ home: home view: take current angle, zoom to whole scnee
+ 5 = ortho vs non-ortho
- */
+*/
// FIXME: re-orient goal (how?)
float goal_depth = goal.diagonal().dot(new Vec(0, 0, 1));
/*
- float width = (float)0.6;
- float height = (float)0.08;
- float depth = (float)0.3;
+ float width = (float)0.6;
+ float height = (float)0.08;
+ float depth = (float)0.3;
*/
float width = (float)0.7;
float depth = (float)0.08;
Matrix.translate(new Vec(rshift, -depth, halfup)),
/*
- Matrix.translate(new Vec(0, depth, halfup)),
- Matrix.translate(new Vec(0, -depth, halfup)),
+ Matrix.translate(new Vec(0, depth, halfup)),
+ Matrix.translate(new Vec(0, -depth, halfup)),
*/
Matrix.translate(new Vec(lshift, 0, height)),
Vec v;
/*
- Matrix inv = p.errorQuadric();
- v = new Vec(inv.d, inv.h, inv.l).norm().times(1/(float)300);
- if (p.quadric_count == 0) {
- v = goal.nearest(p.p).p.minus(p.p).norm().times(1/(float)300);
- }
+ Matrix inv = p.errorQuadric();
+ v = new Vec(inv.d, inv.h, inv.l).norm().times(1/(float)300);
+ if (p.quadric_count == 0) {
+ v = goal.nearest(p.p).p.minus(p.p).norm().times(1/(float)300);
+ }
*/
Vec v2 = new Vec((random.nextFloat() - (float)0.5) / 500,
- (random.nextFloat() - (float)0.5) / 500,
- (random.nextFloat() - (float)0.5) / 500);
+ (random.nextFloat() - (float)0.5) / 500,
+ (random.nextFloat() - (float)0.5) / 500);
//v = v.plus(v2.norm().times(1/(float)300));
v = v2.norm().times(1/(float)300);
float last = 10;
while(true) {
synchronized(this) {
- double ratio = (hits+misses==0) ? 1 : (hits / (hits+misses));
- hits = 0;
- misses = 0;
- float gamma = 0;
- double acceptance = ratio;
- accepts = (int)(Math.ceil(ratio*100));
- temps = (int)(Math.ceil(temp*1000));
- vertss = tile.size();
- if (breaks > 0) { while (breaks>0) {
- breaks--;
- breakit();
- //gamma = 1;
- gamma = 1;
- //temp = last * 0.8f;
- //last = temp;
- //temp = hightemp;
- } } else
- if (acceptance > 0.96) gamma = 0.4f;
- else if (acceptance > 0.9) gamma = 0.5f;
- else if (acceptance > 0.8) gamma = 0.65f;
- else if (acceptance > 0.6) gamma = 0.7f;
- else {
- if (acceptance > 0.3) {
- gamma = 0.9f;
- } else if (acceptance > 0.15) {
- gamma = 0.95f;
- } else if (acceptance > 0.10) {
- gamma = 0.98f;
- } else {
- breakit();
- //gamma = 1;
- gamma = 0.99f;
- //gamma = 1;
- //temp = last * 0.8f;
- //last = temp;
- //temp = hightemp;
- }
- }
- temp = temp * gamma;
+ double ratio = (hits+misses==0) ? 1 : (hits / (hits+misses));
+ hits = 0;
+ misses = 0;
+ float gamma = 0;
+ double acceptance = ratio;
+ accepts = (int)(Math.ceil(ratio*100));
+ temps = (int)(Math.ceil(temp*1000));
+ vertss = tile.size();
+ if (breaks > 0) { while (breaks>0) {
+ breaks--;
+ breakit();
+ //gamma = 1;
+ gamma = 1;
+ //temp = last * 0.8f;
+ //last = temp;
+ //temp = hightemp;
+ } } else
+ if (acceptance > 0.96) gamma = 0.4f;
+ else if (acceptance > 0.9) gamma = 0.5f;
+ else if (acceptance > 0.8) gamma = 0.65f;
+ else if (acceptance > 0.6) gamma = 0.7f;
+ else {
+ if (acceptance > 0.3) {
+ gamma = 0.9f;
+ } else if (acceptance > 0.15) {
+ gamma = 0.95f;
+ } else if (acceptance > 0.10) {
+ gamma = 0.98f;
+ } else {
+ breakit();
+ //gamma = 1;
+ gamma = 0.99f;
+ //gamma = 1;
+ //temp = last * 0.8f;
+ //last = temp;
+ //temp = hightemp;
+ }
+ }
+ temp = temp * gamma;
- HashSet<Mesh.Vertex> hs = new HashSet<Mesh.Vertex>();
- for(Mesh.Vertex p : tile.vertices()) hs.add(p);
- Mesh.Vertex[] pts = (Mesh.Vertex[])hs.toArray(new Mesh.Vertex[0]);
+ HashSet<Mesh.Vertex> hs = new HashSet<Mesh.Vertex>();
+ for(Mesh.Vertex p : tile.vertices()) hs.add(p);
+ Mesh.Vertex[] pts = (Mesh.Vertex[])hs.toArray(new Mesh.Vertex[0]);
- int count = 0;
- long then = System.currentTimeMillis();
- for(int i=0; i<40; i++) {
- if (anneal) {
- count++;
- Mesh.Vertex v = pts[Math.abs(random.nextInt()) % pts.length];
- rand(temp,v);
+ int count = 0;
+ long then = System.currentTimeMillis();
+ for(int i=0; i<40; i++) {
+ if (anneal) {
+ count++;
+ Mesh.Vertex v = pts[Math.abs(random.nextInt()) % pts.length];
+ rand(temp,v);
+ }
+ Thread.yield();
+ repaint();
+ }
+ System.out.println("temp="+temp + " ratio="+(Math.ceil(ratio*100)) + " " +
+ "points_per_second=" +
+ (count*1000)/((double)(System.currentTimeMillis()-then)));
+
+ //for(Mesh.Vertex p : goal.vertices()) p.recomputeFundamentalQuadricIfNeighborChanged();
+ //for(Mesh.Vertex p : tile.vertices()) p.recomputeFundamentalQuadric();
+
+ synchronized(safeTriangles) {
+ safeTriangles.clear();
+ for(Mesh.T t : tile) if (t.shouldBeDrawn()) safeTriangles.add(t);
}
- Thread.yield();
- repaint();
- }
- System.out.println("temp="+temp + " ratio="+(Math.ceil(ratio*100)) + " " +
- "points_per_second=" +
- (count*1000)/((double)(System.currentTimeMillis()-then)));
-
- for(Mesh.Vertex p : goal.vertices()) p.recomputeFundamentalQuadricIfNeighborChanged();
- repaint();
- for(Mesh.Vertex p : tile.vertices()) p.recomputeFundamentalQuadric();
- repaint();
-
- synchronized(safeTriangles) {
- safeTriangles.clear();
- for(Mesh.T t : tile) if (t.shouldBeDrawn()) safeTriangles.add(t);
- }
}
- }
+ }
}