public void updateTransform(boolean draw3D){
  if (draw3D) {
    final SortedSet<Pair<Double,Node>> pairs=new TreeSet<>(new Pair<Double,Node>());
    for (Iterator<Node> it=graph.nodeIteratorIncludingHidden(); it.hasNext(); ) {
      final Node v=it.next();
      Vector3D vector=node2vector.get(v);
      if (vector != null) {
        Vector3D newVector=new Vector3D(vector);
        newVector.transform(transformation3D);
        graphView.setLocation(v,newVector.get(0),newVector.get(1));
        pairs.add(new Pair<>(newVector.get(2),v));
        if (newVector.get(2) >= 0) {
          graphView.setColor(v,Color.BLACK);
        }
 else {
          graphView.setColor(v,Color.LIGHT_GRAY);
        }
      }
 else       pairs.add(new Pair<>(0d,v));
    }
    List<Node> nodeOrder=new ArrayList<>(pairs.size());
    for (    Pair<Double,Node> pair : pairs) {
      nodeOrder.add(pair.get2());
    }
    graph.reorderNodes(nodeOrder);
  }
 else {
    for (Iterator<Node> it=graph.nodeIteratorIncludingHidden(); it.hasNext(); ) {
      final Node v=it.next();
      graphView.setColor(v,Color.BLACK);
    }
  }
  graphView.repaint();
}

public void updateTransform ( boolean draw3D ) { if ( draw3D ) { final SortedSet < Pair < Double , Node > > pairs = new TreeSet < > ( new Pair < Double , Node > ( ) ) ; for ( Iterator < Node > it = graph . nodeIteratorIncludingHidden ( ) ; it . hasNext ( ) ; ) { final Node v = it . next ( ) ; Vector3D vector = node2vector . get ( v ) ; if ( vector != null ) { Vector3D newVector = new Vector3D ( vector ) ; newVector . transform ( transformation3D ) ; graphView . setLocation ( v , newVector . get ( 0 ) , newVector . get ( 1 ) ) ; pairs . add ( new Pair < > ( newVector . get ( 2 ) , v ) ) ; if ( newVector . get ( 2 ) >= 0 ) { graphView . setColor ( v , Color . BLACK ) ; } else { graphView . setColor ( v , Color . LIGHT_GRAY ) ; } } else pairs . add ( new Pair < > ( 0d , v ) ) ; } List < Node > nodeOrder = new ArrayList < > ( pairs . size ( ) ) ; for ( Pair < Double , Node > pair : pairs ) { nodeOrder . add ( pair . get2 ( ) ) ; } graph . reorderNodes ( nodeOrder ) ; } else { for ( Iterator < Node > it = graph . nodeIteratorIncludingHidden ( ) ; it . hasNext ( ) ; ) { final Node v = it . next ( ) ; graphView . setColor ( v , Color . BLACK ) ; } } graphView . repaint ( ) ; }
apply 3d transformation matrix . if draw3d = = true , modify colors etc to look 3d
