
/*

	class PointMapper.java
	by Richard Unger, March 1998

	This class maps AWT points to our internal representation of space. By later
	subclassing this class it will be possible to map points from 3space (ie do
	projections) or implement zoom, etc...
	
	In general it is necessary to subclass this class (usually as an inner class
	in the canvas you're drawing on) to perform actual mappings.
*/

import java.awt.Point;


public class PointMapper {
	
	public PointMapper(){
		}
		
	public Point Spoint2AWT(Spoint sp){
		return new Point((int)Math.round(sp.x),(int)Math.round(sp.y));
		}
		
	public Spoint AWT2Spoint(Point p){
		return new Spoint((double)p.x,(double)p.y);
		}

	public double AWT2X(int x){
		return x;
		}
	public int X2AWT(double x){
		return (int)Math.round(x);
		}
	public double AWT2Y(int y){
		return y;
		}
	public int Y2AWT(double y){
		return (int)Math.round(y);
		}
	public int Dist2AWT(double d){
		return (int)Math.round(d);
		}
	public double AWT2Dist(double d){
		return d;
		}
}