public static class Line2D.Float extends Line2D implements Serializable
Line2D.Double, Line2D.Float| 修飾子と型 | フィールド | 説明 |
|---|---|---|
float |
x1 |
ライン・セグメントの始点のX座標です。
|
float |
x2 |
ライン・セグメントの終点のX座標です。
|
float |
y1 |
ライン・セグメントの始点のY座標です。
|
float |
y2 |
ライン・セグメントの終点のY座標です。
|
| コンストラクタ | 説明 |
|---|---|
Float() |
座標(0, 0) → (0, 0)でLineを構築および初期化します。
|
Float(float x1, float y1, float x2, float y2) |
指定された座標からLineを構築および初期化します。
|
Float(Point2D p1, Point2D p2) |
指定された
Point2DオブジェクトからLine2Dを構築および初期化します。 |
| 修飾子と型 | メソッド | 説明 |
|---|---|---|
Rectangle2D |
getBounds2D() |
高精度で、かつ
getBoundsメソッドより正確なShapeのバウンディング・ボックスを返します。 |
Point2D |
getP1() |
この
Line2Dの始点Point2Dを返します。 |
Point2D |
getP2() |
この
Line2Dの終点Point2Dを返します。 |
double |
getX1() |
始点のX座標を倍精度で返します。
|
double |
getX2() |
終点のX座標を倍精度で返します。
|
double |
getY1() |
始点のY座標を倍精度で返します。
|
double |
getY2() |
終点のY座標を倍精度で返します。
|
void |
setLine(double x1, double y1, double x2, double y2) |
この
Line2Dの両方の終点の位置を、指定されたdouble座標に設定します。 |
void |
setLine(float x1, float y1, float x2, float y2) |
この
Line2Dの両方の終点の位置を、指定されたfloat座標に設定します。 |
clone, contains, contains, contains, contains, getBounds, getPathIterator, getPathIterator, intersects, intersects, intersectsLine, intersectsLine, linesIntersect, ptLineDist, ptLineDist, ptLineDist, ptLineDistSq, ptLineDistSq, ptLineDistSq, ptSegDist, ptSegDist, ptSegDist, ptSegDistSq, ptSegDistSq, ptSegDistSq, relativeCCW, relativeCCW, relativeCCW, setLine, setLinepublic float x1
public float y1
public float x2
public float y2
public Float()
public Float(float x1,
float y1,
float x2,
float y2)
x1 - 始点のX座標y1 - 始点のY座標x2 - 終点のX座標y2 - 終点のY座標public double getX1()
public double getY1()
public Point2D getP1()
Line2Dの始点Point2Dを返します。public double getX2()
public double getY2()
public Point2D getP2()
Line2Dの終点Point2Dを返します。public void setLine(double x1,
double y1,
double x2,
double y2)
Line2Dの両方の終点の位置を、指定されたdouble座標に設定します。public void setLine(float x1,
float y1,
float x2,
float y2)
Line2Dの両方の終点の位置を、指定されたfloat座標に設定します。x1 - 始点のX座標y1 - 始点のY座標x2 - 終点のX座標y2 - 終点のY座標public Rectangle2D getBounds2D()
getBoundsメソッドより正確なShapeのバウンディング・ボックスを返します。 返されたRectangle2Dが、Shapeを囲む最小のバウンディング・ボックスであるという保証はありません。Shapeが、示されたRectangle2D内に完全に含まれているだけです。 戻り値を、倍精度値を使用して寸法を格納するRectangle2Dのインスタンスにすることができるため、このメソッドによって返されたバウンディング・ボックスは通常、getBoundsメソッドによって返されたものより厳密であり、オーバーフローの問題のために失敗することはありません。
内側の定義によって、shapeの定義する輪郭上の点が、返されたboundsオブジェクトに含まれていると見なされない状況が発生する場合があります。ただし、これは、これらの点が元のshapeにも含まれていないと見なされる場合のみです。
pointがcontains(point)メソッドに従ってshapeの内側にある場合は、boundsのcontains(point)メソッドに従って、返されたRectangle2D境界オブジェクトの内側にある必要があります。 具体的には、次のようになります。
shape.contains(p)にはbounds.contains(p)が必要
pointがshapeの内側にない場合は、引き続きboundsオブジェクトに含まれている可能性があります。
bounds.contains(p)はshape.contains(p)を示さない
getBounds2D、インタフェースShapeShapeの高精度のバウンディング・ボックスであるRectangle2Dのインスタンス。Shape.getBounds() バグまたは機能を送信
詳細なAPIリファレンスおよび開発者ドキュメントについては、Java SEのドキュメントを参照してください。 そのドキュメントには、概念的な概要、用語の定義、回避方法、有効なコード例などの、開発者を対象にしたより詳細な説明が含まれています。
Copyright © 1993, 2025, Oracle and/or its affiliates. All rights reserved. Use is subject to license terms. Documentation Redistribution Policyも参照してください。