/** * Tests whether a vertex is a vertex of the outer triangle. * * @param v * the vertex to test * @return true if the vertex is an outer triangle vertex */ public boolean isFrameVertex(Vertex v) { if (v.equals(frameVertex[0])) return true; if (v.equals(frameVertex[1])) return true; if (v.equals(frameVertex[2])) return true; return false; }
/** * Tests whether a {@link Vertex} is the start or end vertex of a * {@link QuadEdge}, up to the subdivision tolerance distance. * * @param e * @param v * @return true if the vertex is a endpoint of the edge */ public boolean isVertexOfEdge(QuadEdge e, Vertex v) { if ((v.equals(e.orig(), tolerance)) || (v.equals(e.dest(), tolerance))) { return true; } return false; }
public int classify(Vertex p0, Vertex p1) { Vertex p2 = this; Vertex a = p1.sub(p0); Vertex b = p2.sub(p0); double sa = a.crossProduct(b); if (sa > 0.0) return LEFT; if (sa < 0.0) return RIGHT; if ((a.getX() * b.getX() < 0.0) || (a.getY() * b.getY() < 0.0)) return BEHIND; if (a.magn() < b.magn()) return BEYOND; if (p0.equals(p2)) return ORIGIN; if (p1.equals(p2)) return DESTINATION; return BETWEEN; }
/** * Tests whether a vertex is a vertex of the outer triangle. * * @param v * the vertex to test * @return true if the vertex is an outer triangle vertex */ public boolean isFrameVertex(Vertex v) { if (v.equals(frameVertex[0])) return true; if (v.equals(frameVertex[1])) return true; if (v.equals(frameVertex[2])) return true; return false; }
/** * Tests whether a {@link Vertex} is the start or end vertex of a * {@link QuadEdge}, up to the subdivision tolerance distance. * * @param e * @param v * @return true if the vertex is a endpoint of the edge */ public boolean isVertexOfEdge(QuadEdge e, Vertex v) { if ((v.equals(e.orig(), tolerance)) || (v.equals(e.dest(), tolerance))) { return true; } return false; }
public int classify(Vertex p0, Vertex p1) { Vertex p2 = this; Vertex a = p1.sub(p0); Vertex b = p2.sub(p0); double sa = a.crossProduct(b); if (sa > 0.0) return LEFT; if (sa < 0.0) return RIGHT; if ((a.getX() * b.getX() < 0.0) || (a.getY() * b.getY() < 0.0)) return BEHIND; if (a.magn() < b.magn()) return BEYOND; if (p0.equals(p2)) return ORIGIN; if (p1.equals(p2)) return DESTINATION; return BETWEEN; }
if (currentDestVertex.equals(startVertex)) break;