public class Main extends InteractiveMeshViewer {
+
public static int verts = 1;
public static final Random random = new Random();
public Main(JFrame f) { super(f); }
- public void fixupTile() {
- synchronized(safeTriangles) {
+ public synchronized void fixupTile() {
for(Matrix m1 : transforms) {
for(Matrix m2 : transforms) {
if (m1==m2) continue;
tile.error_against = goal;
goal.error_against = tile;
fixupGoal();
- }
}
public void breakit() {
Vec v = new Vec(random.nextFloat(), random.nextFloat(), random.nextFloat());
v = v.norm().times((random.nextFloat() - 0.5f) * max);
Matrix m = Matrix.translate(v);
-
- boolean good = p.move(m, false);
+ boolean good = p.move(v, false);
if (!good) { return false; }
double new_tile_error = tile.error();
hits++;
p.goodp = p.p;
} else {
- p.move(Matrix.translate(v.times(-1)), true);
+ p.move(v.times(-1), true);
misses++;
}
p.reComputeErrorAround();
double acceptance = 1;
while(true) {
synchronized(this) {
- synchronized(safeTriangles) {
- safeTriangles.clear();
- for(Mesh.T t : tile)
- if (t.shouldBeDrawn())
- safeTriangles.add(t);
- }
- if (!anneal) { repaint(); Thread.sleep(10); continue; }
+ if (!anneal) { repaint(); Thread.sleep(10); continue; }
double ratio = (hits+misses==0) ? 1 : (hits / (hits+misses));
hits = 0;
}
public void actionPerformed(ActionEvent event) {
synchronized(Main.this) {
- synchronized(safeTriangles) {
hit();
- }
}
}
public void hit() {}
Matrix.translate(new Vec(-0.2f,0,0))
.times(Matrix.rotate(new Vec(1,0,0), (float)(-1*Math.PI/2))),
+
//Matrix.rotate(new Vec(0,0,1), (float)(1*Math.PI/2)),
/*