package edu.berkeley.qfat;
import java.awt.*;
import java.util.*;
+import java.io.*;
import java.awt.event.*;
import javax.swing.*;
import javax.media.opengl.*;
// Vertexices //////////////////////////////////////////////////////////////////////////////
+
/** a vertex in the mesh */
- public final class Vertex extends HasQuadric implements Visitor {
+ public final class Vertex extends HasQuadric implements Visitor, HasPoint {
+ public void bindTo(Matrix bindingMatrix, HasBindingGroup other) {
+ bindTo(bindingMatrix, other, EPSILON);
+ }
+ public float getMaxX() { return getPoint().getMaxX(); }
+ public float getMinX() { return getPoint().getMinX(); }
+ public float getMaxY() { return getPoint().getMaxY(); }
+ public float getMinY() { return getPoint().getMinY(); }
+ public float getMaxZ() { return getPoint().getMaxZ(); }
+ public float getMinZ() { return getPoint().getMinZ(); }
+
public Point p, goodp;
public Point oldp;
E e; // some edge *leaving* this point
/** [UNIQUE] an edge */
public final class E extends HasBindingGroup implements Comparable<E> {
+ public void bindTo(Matrix bindingMatrix, HasBindingGroup other) {
+ bindTo(bindingMatrix, other, EPSILON);
+ }
+
public void sanity() {
if (destroyed) return;
if (pair!=null && (pair.v1!=v2 || pair.v2!=v1)) throw new RuntimeException();
super.glVertices(gl, m);
}
}
+
+ // Dump /////////////////////////////////////////////////////////////////////////////
+
+ public void dump(OutputStream os) throws IOException {
+ PrintWriter pw = new PrintWriter(new OutputStreamWriter(os));
+ pw.println("solid dump");
+ for(Mesh.T t : this) {
+ Vec normal = t.norm();
+ pw.println("facet normal " + normal.x + " " + normal.y + " " + normal.z);
+ pw.println(" outer loop");
+ for(Mesh.Vertex v : new Mesh.Vertex[] { t.v1(), t.v2(), t.v3() }) {
+ pw.println(" vertex " + v.p.x + " " + v.p.y + " " + v.p.z);
+ }
+ pw.println(" endloop");
+ pw.println("endfacet");
+ }
+ pw.println("endsolid dump");
+ pw.flush();
+ }
+
}