不明白double distance( Mypoint p )
{
double x, y;
public Mypoint( double x0, double y0 )
{
x = x0;
y = y0;
}
double distance( Mypoint p ){
return Math.sqrt( ( x - p.x) * (x - p.x ) + (y-p.y) * (y-p.y) );
}
public static void main(String[] args) {
Mypoint a = new Mypoint( 3, 4 );
Mypoint b = new Mypoint( 8, 9 );
System.out.println( a.distance( b ));
}
}
主要是实现计算两个点之间的距离,但double distance( Mypoint p )这句不懂是什么意思,该怎么使用这种类型的代码?该怎么解释?
相关推荐
定义Triangle2D类和MyPoint2D类进行三角形的多种几何问题
(几何:Triangle2D类)定义Triangle2D类和MyPoint2D类(自己定义:2维点),要求如下: A、三个MyPoint2D类数据域成员:p1、p2、p3;这个三个数据域都带有get和set方法。 B、一个无参构造方法,创建三个坐标为(0,0)、(1,1)、(2,5)的点组成的三角形。 C、一个带有指定点的三角形的构造方法。 D、一个返回三角形面积的方法getArea(); E、一个返回三角形周长的方法getPerimeter(); F、给定点p如果在当前三角形内返回true的方法contains(MyPoint p); G、给定三角形t如果在当前三角形内返回true的方法co
Simulation Study of a p-LDMOS With Double Electron Paths to Enhance Current Capability
In this letter, a p-channel lateral doublediffused MOSFET (p-LDMOS) with double electron paths used to enhance the current capability is proposed. The proposed p-LDMOS has two n-channels that are controlled by an auto-generated voltage signal (VGn). The voltage signal VGn is generated during the ON and OFF states of the hole current that flows across an integrated resistor (Rp) implemented in the P-base region. Thus, the current capability of the p-LDMOS can be significantly enhanced by the intr
MFC按行读取txt文件,以空格分隔字符,并转换为double型
MFC按行读取txt文件,以空格分隔字符,并转换为double型
C++项目分块示例.pdf
C++项目分块示例.pdf
An ultra-low specific on-resistance double-gate trench SOI LDMOS with P/N pillars
An ultra-low specific on-resistance double-gate trench SOI LDMOS with P/N pillars


Java SE
