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()
返回该
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 结束点的位置。
|
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, setLine
public 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
结束点的位置。
public void setLine(float x1, float y1, float x2, float y2)
Line2D
结束点的位置到指定的浮动坐标系。
x1
-起始点的x坐标
y1
-出发点的Y坐标
x2
-结束点的X坐标
y2
-结束点的Y坐标
public Rectangle2D getBounds2D()
Shape
比
getBounds
方法。需要注意的是不能保证返回的
Rectangle2D
是最小包围盒包围
Shape
,只有
Shape
完全在于在显示
Rectangle2D
。包围盒返回此方法通常是更严格的比
getBounds
返回的方法,永远不会失败由于溢出的问题由于返回值可以使用双精度值存储维度的
Rectangle2D
实例。
请注意, definition of insideness可导致的情况下,点上的shape
定义轮廓可能不被视为包含在返回的bounds
对象,但只有在这些点的情况下,也不被认为是包含在原始的shape
。
如果一个point
在shape
根据contains(point)
方法,那么它必须在返回的Rectangle2D
界根据的bounds
的contains(point)
方法对象。明确地:
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.