refactor mirror, add P2D to processing sketch