projects
/
org.ibex.core.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
a523360
)
better Edge-tracking algorithms in Mesh
author
adam
<adam@megacz.com>
Sat, 2 Jul 2005 10:04:33 +0000
(10:04 +0000)
committer
adam
<adam@megacz.com>
Sat, 2 Jul 2005 10:04:33 +0000
(10:04 +0000)
darcs-hash:
20050702100433
-5007d-
ce9f480a56cb14877cb7f5b5777e135ba57e37a4
.gz
src/org/ibex/graphics/Mesh.java
patch
|
blob
|
history
diff --git
a/src/org/ibex/graphics/Mesh.java
b/src/org/ibex/graphics/Mesh.java
index
6fc2349
..
f9bd44a
100644
(file)
--- a/
src/org/ibex/graphics/Mesh.java
+++ b/
src/org/ibex/graphics/Mesh.java
@@
-229,6
+229,7
@@
public final class Mesh {
}
private Point point(float x, float y) { return new Point(x,y); }
}
private Point point(float x, float y) { return new Point(x,y); }
+ private Point point(Point a, Point b) { return new Point((a.x+b.x)/2,(a.y+b.y)/2); }
private Point point(Point p, Affine a) { return point(p.x(a), p.y(a)); }
private class Point {
public float x;
private Point point(Point p, Affine a) { return point(p.x(a), p.y(a)); }
private class Point {
public float x;
@@
-271,11
+272,24
@@
public final class Mesh {
//if (ret != null) throw new Error("tried to get an edge that already exists!");
if (ret == null) ret = new Edge(v1,v2);
return ret;
//if (ret != null) throw new Error("tried to get an edge that already exists!");
if (ret == null) ret = new Edge(v1,v2);
return ret;
+ */
}
public Edge getEdge(Vertex v1, Vertex v2) {
if (v1==v2) throw new Error();
}
public Edge getEdge(Vertex v1, Vertex v2) {
if (v1==v2) throw new Error();
- Edge ret = (Edge)edges.get(v1,v2);
+ //Edge ret = (Edge)edges.get(v1,v2);
+ Edge ret = null;
+ Triangle t = null;
+ if (triangle0 != null) {
+ t = triangle0.seek(point(v1,v2));
+ if (t != null)
+ for(int i=1; i<=3; i++)
+ if (t.e(i).hasVertex(v1) && t.e(i).hasVertex(v2)) ret = t.e(i);
+ }
+ if (ret == null) {
+ ret = (Edge)edges.get(v1,v2);
+ if (ret != null && (ret.t1 != null || ret.t2 != null)) throw new Error("bah! " + ret);
+ }
if (ret == null) ret = new Edge(v1,v2);
return ret;
}
if (ret == null) ret = new Edge(v1,v2);
return ret;
}