while (tetBack!=null) { node = nodeBack; nodeBack = tet.nodeNabor(tetBack); tet = tetBack; tetBack = tet.tetNabor(node);
Tet td = tet.tetD(); if (ta!=null) Check.state(ta.tetNabor(tet.nodeNabor(ta))==tet,"a nabor ok"); if (tb!=null) Check.state(tb.tetNabor(tet.nodeNabor(tb))==tet,"b nabor ok"); if (tc!=null) Check.state(tc.tetNabor(tet.nodeNabor(tc))==tet,"c nabor ok"); if (td!=null) Check.state(td.tetNabor(tet.nodeNabor(td))==tet,"d nabor ok");
/** * Constructs an oriented face that references the specified nodes. * Optionally, a tet may be specified. If non-null, that tet may be * right or left of the face, but it must reference the specified nodes. * @param a a node of the face. * @param b a node of the face. * @param c a node of the face. * @param abcd a tet that references the specified nodes; null, if none. */ public Face(Node a, Node b, Node c, Tet abcd) { Node d = (abcd!=null)?otherNode(abcd,a,b,c):null; Check.argument(abcd==null || d!=null,"tet references nodes"); _a = a; _b = b; _c = c; if (d!=null) { if (nodesInOrder(abcd,a,b,c,d)) { _tetLeft = abcd; _nodeLeft = d; _tetRight = abcd.tetNabor(d); _nodeRight = (_tetRight!=null)?abcd.nodeNabor(_tetRight):null; } else { _tetRight = abcd; _nodeRight = d; _tetLeft = abcd.tetNabor(d); _nodeLeft = (_tetLeft!=null)?abcd.nodeNabor(_tetLeft):null; } } }
/** * Adds the mate of the face of the specified tet that is opposite * the specified node, unless the face is in the set, in which case * that face is removed. Sets the current face to the mate added or * the face removed. * @param tet the tet that references the nodes in the face. * @param node the other node in the tet that is not in the face. * @return true, if the mate was added; false, if the face was removed. */ boolean addMate(Tet tet, Node node) { Tet tetNabor = tet.tetNabor(node); Node nodeNabor = (tetNabor!=null)?tet.nodeNabor(tetNabor):null; if (node==tet._n0) { return add(tet._n1,tet._n2,tet._n3,nodeNabor,tetNabor); } else if (node==tet._n1) { return add(tet._n3,tet._n2,tet._n0,nodeNabor,tetNabor); } else if (node==tet._n2) { return add(tet._n3,tet._n0,tet._n1,nodeNabor,tetNabor); } else if (node==tet._n3) { return add(tet._n1,tet._n0,tet._n2,nodeNabor,tetNabor); } else { assert false:"node is referenced by tet"; return false; } }
/** * Given a node referenced by one face of the hull, gets the next * face on the hull that is opposite that node. */ private Face getNextFaceOnHull(Node node, Face face) { Tet tet = face.tetLeft(); Node next = face.nodeLeft(); for (Tet tnext=tet.tetNabor(node); tnext!=null; tnext=tet.tetNabor(node)) { node = next; next = tet.nodeNabor(tnext); tet = tnext; } return new Face(tet,node); }
/** * Given a tet and node on the hull, and another node, typically * inside (not on) the hull, gets the next tet on the hull that * is opposite the node on the hull. If the other node is also * on the hull, this method simply returns the specified tet. */ private Tet getNextTetOnHull(Tet tet, Node node, Node nodeOther) { for (Tet tnext=tet.tetNabor(node); tnext!=null; tnext=tet.tetNabor(node)) { node = nodeOther; nodeOther = tet.nodeNabor(tnext); tet = tnext; } return tet; }
private Face(Tet tetLeft, Node nodeLeft) { initLeft(tetLeft,nodeLeft); _tetLeft = tetLeft; _nodeLeft = nodeLeft; _tetRight = tetLeft.tetNabor(nodeLeft); _nodeRight = (_tetRight!=null)?_tetLeft.nodeNabor(_tetRight):null; }
/** * Returns the node opposite this tet in the tet nabor that is opposite * the specified node. The specified node cannot be null. If the tet * nabor opposite the specified node is null, then null is returned. * @param node a node. * @return the node opposite this tet. */ public final Node nodeNabor(Node node) { Tet tetNabor = tetNabor(node); return (tetNabor!=null)?nodeNabor(tetNabor):null; }