private void drawLine(Graphics g, Vector p, Vector q) { // FIXME: maybe eliminate class instantiations // from this method for performance reasons: // use static point arrays for transformations Vector u = rotation.apply(p.sub(origin)); Vector v = rotation.apply(q.sub(origin)); Point2D.Double from = new Point2D.Double(u.getX(), u.getZ()); Point2D.Double to = new Point2D.Double(v.getX(), v.getZ()); Point ifrom = new Point(); Point ito = new Point(); transform.transform(from, ifrom); transform.transform(to, ito); // g.drawLine(xInt(u.getX()),yInt(u.getZ()), // xInt(v.getX()),yInt(v.getZ())); g.drawLine(ifrom.x, ifrom.y, ito.x, ito.y); }
public void setRotation(double zangle) { initRotation(); rotation = rotation.rotz(zangle); repaint(); }
protected void initRotation() { rotation = new Transformation(); if (perspective == PERSPECTIVE_TOP) rotation = rotation.rotx(90); }