Hi all,
I have a problem I'm trying to figure out, so I thought
I would create a simple test example and post here.
The example draws 12 lines to create the outline of
a box, and it uses the mousewheel to zoom in and
out. I've included the source at the end of this
message, but I've also put an applet here:
bebop.cns.ualberta.ca/~cwant/zoom_test/
(website won't let me post a URL, so protocol stripped).
Why is an 'X' drawn when one zooms in close?
An alternate phrasing for this question:why do lines
flip when one scales by a large(ish) amount?
I'd appreciate any tips for detecting and avoiding
this behavior.
Cheers,
Chris 
Quote:import java.awt.event.MouseWheelListener;
ZoomBox zoomBox;
void setup() {
  size(500,600,P3D);
  zoomBox = new ZoomBox();
}
void draw() {
  zoomBox.draw();
}
class ZoomBox implements MouseWheelListener { 
  float zoom = 1.0;
  float zoomFactor = 1.10;
  ZoomBox(){
    addMouseWheelListener(this);
  }
  
  void draw() {
    background(255);
    pushMatrix();
    translate(width/2, height/2);
    scale(zoom);
    beginShape(LINES);
    vertex(-100, -100, -100); vertex(-100,  100, -100);
    vertex( 100, -100, -100); vertex( 100,  100, -100);
    vertex(-100, -100, -100); vertex( 100, -100, -100);
    vertex(-100,  100, -100); vertex( 100,  100, -100);
    vertex(-100, -100,  100); vertex(-100,  100,  100);
    vertex( 100, -100,  100); vertex( 100,  100,  100);
    vertex(-100, -100,  100); vertex( 100, -100,  100);
    vertex(-100,  100,  100); vertex( 100,  100,  100);
    vertex(-100, -100,  100); vertex(-100, -100, -100);
    vertex( 100, -100,  100); vertex( 100, -100, -100);
    vertex(-100,  100,  100); vertex(-100,  100, -100);
    vertex( 100,  100,  100); vertex( 100,  100, -100);
    endShape();
    popMatrix();
  }
  void mouseWheelMoved(java.awt.event.MouseWheelEvent e) {
    int notches = e.getWheelRotation();
    if (notches < 0) {
      zoom *= zoomFactor;
    }
    else {
      zoom /= zoomFactor;
    }
    println(zoom);
  }
}