1 package edu.berkeley.slipway.gui;
3 import static com.atmel.fpslic.FpslicConstants.*;
4 import edu.berkeley.slipway.*;
6 import java.awt.geom.*;
7 import java.awt.event.*;
8 import java.awt.color.*;
9 import org.ibex.util.*;
14 /** a point, since Java2D's Point2D class sucks rocks */
17 public final double x;
18 public final double y;
20 public P(double x, double y) { this.x = x; this.y = y; }
21 public P(Point2D p) { this(p.getX(), p.getY()); }
22 public double getX() { return x; }
23 public double getY() { return y; }
25 public P transform(AffineTransform a) {
26 Point2D me = new Point2D.Double(x, y);
27 return new P(a.transform(me, me));
29 public P inverseTransform(AffineTransform a) {
31 Point2D me = new Point2D.Double(x, y);
32 return new P(a.inverseTransform(me, me));
33 } catch (Exception e) {
34 throw new RuntimeException(e);
38 public P translate(double dx, double dy) {
39 return new P(dx+x, dy+y);
42 public P scale(double factor) {
43 return new P(x*factor, y*factor);