⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 doublepoint.java

📁 Please read your package and describe it at least 40 bytes. System will automatically delete the di
💻 JAVA
字号:
import java.awt.Point;/** * DoublePoints are used as both vectors and data points here, which is * why they have all those funny vector methods. * * They should be considered immutable.  All algebraic operations always * return new DoublePoints. */class DoublePoint {	protected double x, y;	DoublePoint(double x, double y)	{		this.x = x;		this.y = y;	}	DoublePoint(DoublePoint p)	{		this.x = p.x;		this.y = p.y;	}	DoublePoint(Point p)	{		this.x = p.x;		this.y = p.y;	}	double getX()	{		return this.x;	}	double getY()	{		return this.y;	}	DoublePoint plus(DoublePoint p)	{		return new DoublePoint(this.x+p.x, this.y+p.y);	}	DoublePoint minus(DoublePoint p)	{		return new DoublePoint(this.x-p.x, this.y-p.y);	}	DoublePoint times(double lambda)	{		return new DoublePoint(this.x*lambda, this.y*lambda);	}	double scalTimes(DoublePoint other)	{		return this.x*other.x+this.y*other.y;	}}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -