appendix> 2D> Point2D.Double TOPUPPREVNEXT

Point2D.Double 点

【主な機能】

点を表現します。

【継承関係】

    java.lang.Object
      └java.awt.geom.Point2D
            └java.awt.geom.Point2D.Double
    

【主なコンストラクタ】

コンストラクタ機能
Point2D.Double ( double x , double y ) (x,y)の座標をもつ点を生成します。

【よく使われるメソッド】

メソッド機能
double getX ( ) x座標を獲得します。
double getY ( ) y座標を獲得します。
void setLocation ( double x , double y ) 座標を ( x , y)に設定します。

【Point2D から継承した主なメソッド】

メソッド機能
static double distance ( double x1 , double y1 , double x2 , double y2 ) 点( x1 , y1)と 点( x2 , y2) の距離
double distance ( double px , double py ) 自分自身と 点( px , py) の距離
double distance ( Point2D p ) 自分自身と 点 p の距離
static double distanceSq ( double x1 , double y1 , double x2 , double y2 ) 点( x1 , y1)と 点( x2 , y2) の距離の2乗
double distanceSq ( double px , double py ) 自分自身と 点( px , py) の距離の2乗
double distanceSq ( Point2D p ) 自分自身と 点 p の距離の2乗
boolean equals ( Object obj ) 2つの点の座標が等しいかどうかの判定
void setLocation ( Point2D p ) p と同じ座標を設定します。

【使用例】

プログラム Point1.java

実行結果

Point1-1.jpg       Point1-2.GIF


更新日:2004-04-04