public void visualize(Cluster3DExt cluster) {
    if ((long) ((((double) (System.currentTimeMillis() - startTime)) / 500.0)) % 2 == 0) {
      //			GL gl = Tools3D.getGL(pApplet);
      //			Tools3D.beginGL(pApplet);
      //			gl.glBegin(gl.GL_LINES);
      //			MTLine[] lines = getVisualizationLines(cluster.getChildren());
      //			for(MTLine line : lines)
      //			{
      //
      //	gl.glVertex3f(line.getVerticesLocal()[0].x,line.getVerticesLocal()[0].y,line.getVerticesLocal()[0].z);
      //
      //	gl.glVertex3f(line.getVerticesLocal()[1].x,line.getVerticesLocal()[1].y,line.getVerticesLocal()[1].z);
      //			}
      //			gl.glEnd();
      //			Tools3D.endGL(pApplet);

      pApplet.beginShape(PApplet.LINES);
      MTLine[] lines = getVisualizationLines(cluster.getChildren());
      for (MTLine line : lines) {
        pApplet.vertex(
            line.getVerticesLocal()[0].x,
            line.getVerticesLocal()[0].y,
            line.getVerticesLocal()[0].z);
        pApplet.vertex(
            line.getVerticesLocal()[1].x,
            line.getVerticesLocal()[1].y,
            line.getVerticesLocal()[1].z);
      }
      //			gl.glEnd();
      //			Tools3D.endGL(pApplet);
      pApplet.endShape();
    }
  }
  public void addClusterToCollisionDomain(Cluster3DExt cluster) {
    ArrayList<CollisionObject> colObjs = new ArrayList<CollisionObject>();

    for (int i = 0; i < cluster.getChildren().length; i++) {
      colObjs.addAll(
          this.getAllObjectsForCollisionGroup(
              cluster.getChildren()[i])); // save all collision objects in on object
      removeObjectFromCollisionDomain(
          cluster.getChildren()[i]); // remove current object from collision world	
    }

    groupId = (short) (groupId << 1); // shift groupId so every group has a unique bit value

    for (int i = 0; i < colObjs.size(); i++) {
      collisionWorld.addCollisionObject(colObjs.get(i), groupId, (short) ~groupId);
    }
    colObjectsForGroup.put(cluster, colObjs);
  }
  public void visualize(Cluster3DExt cluster) {

    //		GL gl = Tools3D.getGL(pApplet);
    //		Tools3D.beginGL(pApplet);
    //		gl.glBegin(gl.GL_LINES);
    //		MTLine[] lines = getVisualizationLines(cluster.getChildren());
    //		MTComponent linesGroup = new MTComponent(pApplet);
    //		for(MTLine line : lines)
    //		{
    //			linesGroup.addChild(line);
    //		}
    //		cluster.setVisualComponentGroup(linesGroup);
    //
    //		for(MTLine line : lines)
    //		{
    //
    //	gl.glVertex3f(line.getVerticesLocal()[0].x,line.getVerticesLocal()[0].y,line.getVerticesLocal()[0].z);
    //
    //	gl.glVertex3f(line.getVerticesLocal()[1].x,line.getVerticesLocal()[1].y,line.getVerticesLocal()[1].z);
    //		}
    //		gl.glEnd();
    //		Tools3D.endGL(pApplet);

    pApplet.beginShape(PApplet.LINES);
    MTLine[] lines = getVisualizationLines(cluster.getChildren());
    MTComponent linesGroup = new MTComponent(pApplet);
    for (MTLine line : lines) {
      linesGroup.addChild(line);
    }
    cluster.setVisualComponentGroup(linesGroup);

    for (MTLine line : lines) {
      pApplet.vertex(
          line.getVerticesLocal()[0].x, line.getVerticesLocal()[0].y, line.getVerticesLocal()[0].z);
      pApplet.vertex(
          line.getVerticesLocal()[1].x, line.getVerticesLocal()[1].y, line.getVerticesLocal()[1].z);
    }
    pApplet.endShape();
  }
  public boolean processGestureEvent(MTGestureEvent ge) {
    DepthGestureEvent depthEv;
    if (ge instanceof DepthGestureEvent) {
      lastEvent = ge;
      depthEv = (DepthGestureEvent) ge;
    } else {
      return false;
    }

    switch (depthEv.getId()) {
      case MTGestureEvent.GESTURE_STARTED:
        {
          if (dragDepthTarget instanceof MTComponent) {
            MTComponent baseComp = (MTComponent) dragDepthTarget;
            baseComp.sendToFront();
          }
          Vector3D zVector = new Vector3D(0.0f, 0.0f, depthEv.getTranslationVect().z);

          if (!(dragDepthTarget instanceof Cluster3DExt)) {
            dragDepthTarget.translateGlobal(zVector);
          } else {
            // only move children, not cluster itself
            // cause it should stay on the floor
            Cluster3DExt cl = (Cluster3DExt) dragDepthTarget;
            for (MTComponent comp : cl.getChildren()) {
              if (!(comp instanceof MTPolygon)) {
                comp.translateGlobal(zVector);
              }
            }
          }
          break;
        }
      case MTGestureEvent.GESTURE_UPDATED:
        {
          Vector3D zVector = new Vector3D(0.0f, 0.0f, depthEv.getTranslationVect().z);

          if (!(dragDepthTarget instanceof Cluster3DExt) && !gestureAborted) {
            dragDepthTarget.translateGlobal(zVector);
          } else {
            // only move children, not cluster itself
            // cause it should stay on the floor
            Cluster3DExt cl = (Cluster3DExt) dragDepthTarget;
            // remove

            cl.translateGlobal(zVector);
            // remove end
            /*for(MTComponent comp : cl.getChildren())
            {
            	if(!(comp instanceof MTPolygon))
            	{
            		comp.translateGlobal(zVector);
            	}
            }*/
          }
          break;
        }
      case MTGestureEvent.GESTURE_ENDED:
        break;
      default:
        break;
    }
    return true;
  }