Example #1
0
 /**
  * Set the view matrix `s' is the scaling factor of translating real coordinates to the screen
  * coordinates (x0, y0) the screen coordinates of the center
  */
 void setMatrix(Matrix3D viewMat, double s, double x0, double y0) {
   mat.unit();
   mat.mult(viewMat);
   mat.scale(s, s, s);
   real2Screen = s;
   mat.translate(x0, y0, 0);
   transformed = false;
 }
Example #2
0
 public void mouseDragged(MouseEvent e) {
   int x = e.getX();
   int y = e.getY();
   tmpMatrix.unit();
   tmpMatrix.xrot(360.0 * (mouseY - y) / getSize().height);
   tmpMatrix.yrot(360.0 * (x - mouseX) / getSize().width);
   viewMatrix.mult(tmpMatrix);
   repaint();
   mouseX = x;
   mouseY = y;
   e.consume();
 }