public static class Line2D.Float extends Line2D implements Serializable
Line2D.Double, Line2D.Float| Modifier and Type | Field and Description |
|---|---|
float |
x1
线段起始点的X坐标。
|
float |
x2
线段终点的X坐标。
|
float |
y1
线段起始点的Y坐标。
|
float |
y2
线段终点的Y坐标。
|
| Constructor and Description |
|---|
Float()
构造并初始化坐标(0,0)→(0,0)的线。
|
Float(float x1, float y1, float x2, float y2)
从指定的坐标构造和初始化一行。
|
Float(Point2D p1, Point2D p2)
构造并初始化一个
Line2D从指定的
Point2D对象。
|
| Modifier and Type | Method and Description |
|---|---|
Rectangle2D |
getBounds2D()
Shape比
getBounds方法返回一个高精度和更准确的边界框。
|
Point2D |
getP1()
返回开始
Point2D这一点
Line2D 。
|
Point2D |
getP2()
返回结束
Point2D这一点
Line2D 。
|
double |
getX1()
以双精度返回起始点的X坐标。
|
double |
getX2()
以双精度返回终点的X坐标。
|
double |
getY1()
以双精度返回起始点的Y坐标。
|
double |
getY2()
以双精度返回终点的Y坐标。
|
void |
setLine(double x1, double y1, double x2, double y2)
将此
Line2D的终点的位置设置为指定的双坐标。
|
void |
setLine(float x1, float y1, float x2, float y2)
将此
Line2D的终点的位置设置为指定的浮点坐标。
|
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 -
x1的X坐标
y1 -
y1的Y坐标
x2 - 终点的X坐标
y2 - 终点的Y坐标
public double getX1()
public double getY1()
public Point2D getP1()
Point2D这一点
Line2D 。
public double getX2()
public double getY2()
public Point2D getP2()
Point2D这一点
Line2D 。
public void setLine(double x1,
double y1,
double x2,
double y2)
Line2D的终点的位置设置为指定的双坐标。
public void setLine(float x1,
float y1,
float x2,
float y2)
Line2D的终点的位置设置为指定的浮点坐标。
x1 -
x1的X坐标
y1 -
y1的Y坐标
x2 - 终点的X坐标
y2 - 终点的Y坐标
public Rectangle2D getBounds2D()
Shape比getBounds方法更高精度和更精确的边界框。
需要注意的是没有保证返回Rectangle2D是最小的边框包围Shape ,只表示Shape完全在指定的范围内Rectangle2D 。
通过此方法返回的边界框通常比通过返回的更紧密getBounds方法,而且永远不会因为溢出问题,因为返回值可以是实例Rectangle2D一个使用双精度值存储尺寸。
请注意, definition of insideness可能导致shape定义轮廓上的shape不能被视为包含在返回的bounds对象中的情况,但仅在这些点也未被包含在原始shape中的情况下。
如果point是内部shape根据contains(point)方法,那么它必须是内部返回Rectangle2D界限根据对象contains(point)所述的方法bounds 。 特别:
shape.contains(p)要求bounds.contains(p)
如果point不在shape ,那么它可能仍然包含在bounds对象中:
bounds.contains(p)并不代表shape.contains(p)
getBounds2D在界面
Shape
Rectangle2D那是一个高精度边界框
Shape 。
Shape.getBounds()
Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2014, Oracle and/or its affiliates. All rights reserved.