public abstract class CubicCurve2D extends Object implements Shape, Cloneable
CubicCurve2D类
(x,y)坐标空间中定义了一个三次参数曲线段。
这类是所有对象的存储二维曲线段的抽象类。坐标的实际存储表示形式留给子类。
| Modifier and Type | Class and Description |
|---|---|
static class |
CubicCurve2D.Double
三次参数曲线段指定
double坐标。
|
static class |
CubicCurve2D.Float
三次参数曲线段指定
float坐标。
|
| Modifier | Constructor and Description |
|---|---|
protected |
CubicCurve2D()
这是一个抽象类不能被直接实例化。
|
| Modifier and Type | Method and Description |
|---|---|
Object |
clone()
创建这个对象的同一类的新对象。
|
boolean |
contains(double x, double y)
如果指定的坐标的
Shape边界内,由
definition of insideness描述。
|
boolean |
contains(double x, double y, double w, double h)
如果
Shape测试的内部完全包含指定的矩形区域。
|
boolean |
contains(Point2D p)
|
boolean |
contains(Rectangle2D r)
如果
Shape测试的内部完全包含指定的
Rectangle2D。
|
Rectangle |
getBounds()
返回一个整数
Rectangle完全封闭
Shape。
|
abstract Point2D |
getCtrlP1()
返回第一个控制点。
|
abstract Point2D |
getCtrlP2()
返回第二个控制点。
|
abstract double |
getCtrlX1()
返回双精度的第一个控制点的x坐标。
|
abstract double |
getCtrlX2()
以双精度返回第二控制点的X坐标。
|
abstract double |
getCtrlY1()
返回双精度的第一个控制点的Y坐标。
|
abstract double |
getCtrlY2()
以双精度返回第二控制点的Y坐标。
|
double |
getFlatness()
返回此曲线的平坦度。
|
static double |
getFlatness(double[] coords, int offset)
返回指定索引处存储在指示数组中的控制点指定的三次曲线的平坦度。
|
static double |
getFlatness(double x1, double y1, double ctrlx1, double ctrly1, double ctrlx2, double ctrly2, double x2, double y2)
返回指定的控制点指定的三次曲线的平坦度。
|
double |
getFlatnessSq()
返回此曲线的平坦度的平方。
|
static double |
getFlatnessSq(double[] coords, int offset)
返回指定的索引中存储在表示数组中的控制点指定的三次曲线的平坦度的平方。
|
static double |
getFlatnessSq(double x1, double y1, double ctrlx1, double ctrly1, double ctrlx2, double ctrly2, double x2, double y2)
返回指定的控制点指定的三次曲线的平坦度的平方。
|
abstract Point2D |
getP1()
返回起始点。
|
abstract Point2D |
getP2()
返回终点。
|
PathIterator |
getPathIterator(AffineTransform at)
返回一个定义形状边界的迭代对象。
|
PathIterator |
getPathIterator(AffineTransform at, double flatness)
返回定义扁平形状的边界的迭代对象。
|
abstract double |
getX1()
返回双精度的起始点的x坐标。
|
abstract double |
getX2()
返回双精度的终点的X坐标。
|
abstract double |
getY1()
以双精度返回起始点的Y坐标。
|
abstract double |
getY2()
以双精度返回终点的Y坐标。
|
boolean |
intersects(double x, double y, double w, double h)
如果
Shape测试的内部与一个指定的矩形区域内。
|
boolean |
intersects(Rectangle2D r)
如果
Shape测试的内部与指定的
Rectangle2D内部。
|
void |
setCurve(CubicCurve2D c)
设置位置的端点和控制点的曲线相同,在指定的
CubicCurve2D。
|
void |
setCurve(double[] coords, int offset)
将此曲线的结束点和控制点的位置设置为指定的数组中指定的偏移量的双坐标位置。
|
abstract void |
setCurve(double x1, double y1, double ctrlx1, double ctrly1, double ctrlx2, double ctrly2, double x2, double y2)
将此曲线的结束点和控制点的位置设置为指定的双坐标。
|
void |
setCurve(Point2D[] pts, int offset)
设置位置的端点和控制在指定的指定数组中的偏移曲线的
Point2D对象的坐标点。
|
void |
setCurve(Point2D p1, Point2D cp1, Point2D cp2, Point2D p2)
设置位置的端点和控制点的曲线,到指定的
Point2D坐标。
|
static int |
solveCubic(double[] eqn)
解决了立方的系数在
eqn阵列和场所的非复杂的根回到同一个数组,返回根数。
|
static int |
solveCubic(double[] eqn, double[] res)
解决立方的系数在
eqn阵列和非复杂的根在
res数组,返回根数。
|
void |
subdivide(CubicCurve2D left, CubicCurve2D right)
将这三次曲线和存储造成两细分曲线分为左、右曲线参数。
|
static void |
subdivide(CubicCurve2D src, CubicCurve2D left, CubicCurve2D right)
细分的
src参数指定的立方曲线和存储造成两细分曲线进入
left和
right曲线参数。
|
static void |
subdivide(double[] src, int srcoff, double[] left, int leftoff, double[] right, int rightoff)
细分的坐标存储在索引
srcoff的
src阵列通过指定的立方曲线(
srcoff + 7)和存储造成两细分曲线分成两结果数组的相应指标。
|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetBounds2Dprotected CubicCurve2D()
CubicCurve2D.Float,
CubicCurve2D.Double
public abstract double getX1()
CubicCurve2D起始点的X坐标。
public abstract double getY1()
CubicCurve2D起始点的Y坐标。
public abstract Point2D getP1()
Point2D的
CubicCurve2D起点。
public abstract double getCtrlX1()
CubicCurve2D第一个控制点的X坐标。
public abstract double getCtrlY1()
CubicCurve2D第一个控制点的Y坐标。
public abstract Point2D getCtrlP1()
Point2D的
CubicCurve2D第一个控制点。
public abstract double getCtrlX2()
CubicCurve2D第二控制点的x坐标。
public abstract double getCtrlY2()
CubicCurve2D第二控制点的Y坐标。
public abstract Point2D getCtrlP2()
Point2D的
CubicCurve2D第二控制点。
public abstract double getX2()
CubicCurve2D结束点的X坐标。
public abstract double getY2()
CubicCurve2D结束点的Y坐标。
public abstract Point2D getP2()
Point2D的
CubicCurve2D终点。
public abstract void setCurve(double x1,
double y1,
double ctrlx1,
double ctrly1,
double ctrlx2,
double ctrly2,
double x2,
double y2)
x1 - x坐标用于设置此
CubicCurve2D起点
y1 - Y坐标用于设置此
CubicCurve2D起点
ctrlx1 - x坐标用于设置此
CubicCurve2D第一个控制点
ctrly1 - Y坐标用于设置此
CubicCurve2D第一个控制点
ctrlx2 - x坐标用于设置此
CubicCurve2D第二控制点
ctrly2 - Y坐标用于设置此
CubicCurve2D第二控制点
x2 - x坐标用于设置此
CubicCurve2D终点
y2 - Y坐标用于设置此
CubicCurve2D终点
public void setCurve(double[] coords,
int offset)
coords -双数组包含坐标
offset -
coords从开始设置该曲线的端点和控制点的坐标中
coords指数
public void setCurve(Point2D p1, Point2D cp1, Point2D cp2, Point2D p2)
Point2D坐标。
p1 -第一个指定的
Point2D用于设置该曲线的起始点
cp1 -指定的第二个
Point2D用来设置该曲线的第一个控制点
cp2 -第三规定的
Point2D用来设置该曲线第二个控制点
p2 -第四规定的
Point2D用来设置该曲线的结束点
public void setCurve(Point2D[] pts, int offset)
Point2D对象的坐标点。
pts -
Point2D对象数组
offset -
pts从开始设置该曲线的端点和控制点包含在
pts点指数
public void setCurve(CubicCurve2D c)
CubicCurve2D。
c -指定
CubicCurve2D
public static double getFlatnessSq(double x1,
double y1,
double ctrlx1,
double ctrly1,
double ctrlx2,
double ctrly2,
double x2,
double y2)
x1 - x坐标指定一个
CubicCurve2D起点
y1 - Y坐标指定一个
CubicCurve2D起点
ctrlx1 - x坐标指定一个
CubicCurve2D第一个控制点
ctrly1 - Y坐标指定一个
CubicCurve2D第一个控制点
ctrlx2 - x坐标指定一个
CubicCurve2D第二控制点
ctrly2 - Y坐标指定一个
CubicCurve2D第二控制点
x2 - x坐标指定一个
CubicCurve2D终点
y2 - Y坐标指定一个
CubicCurve2D终点
CubicCurve2D平坦的广场。
public static double getFlatness(double x1,
double y1,
double ctrlx1,
double ctrly1,
double ctrlx2,
double ctrly2,
double x2,
double y2)
x1 - x坐标指定一个
CubicCurve2D起点
y1 - Y坐标指定一个
CubicCurve2D起点
ctrlx1 - x坐标指定一个
CubicCurve2D第一个控制点
ctrly1 - Y坐标指定一个
CubicCurve2D第一个控制点
ctrlx2 - x坐标指定一个
CubicCurve2D第二控制点
ctrly2 - Y坐标指定一个
CubicCurve2D第二控制点
x2 - x坐标指定一个
CubicCurve2D终点
y2 - Y坐标指定一个
CubicCurve2D终点
CubicCurve2D平整。
public static double getFlatnessSq(double[] coords,
int offset)
coords -一个数组包含坐标
offset -
coords从开始的曲线的端点和控制点的指标
coords坐标指定偏移量处的
CubicCurve2D平坦的广场。
public static double getFlatness(double[] coords,
int offset)
coords -一个数组包含坐标
offset -
coords从开始的曲线的端点和控制点的指标
coords坐标指定偏移量处的
CubicCurve2D平整。
public double getFlatnessSq()
public double getFlatness()
public void subdivide(CubicCurve2D left, CubicCurve2D right)
left -为左或细分曲线前半立方曲线对象存储
right -为右或下半年细分曲线存储立方曲线对象
public static void subdivide(CubicCurve2D src, CubicCurve2D left, CubicCurve2D right)
src参数指定的立方曲线和存储造成两细分曲线进入
left和
right曲线参数。该
left和
right对象或可能作为
src对象或
null相同。
src -分三次曲线
left -存储左或细分曲线前半立方曲线对象
right -存储正确的细分曲线或半立方曲线对象
public static void subdivide(double[] src,
int srcoff,
double[] left,
int leftoff,
double[] right,
int rightoff)
srcoff的
src阵列通过指定的立方曲线(
srcoff + 7)和存储造成两细分曲线分成两结果数组的相应指标。该
left和
right阵列或可能
null或引用数组作为
src阵列相同。请注意,第一次细分曲线的最后一点与第二次细分曲线的第一点是相同的。因此,有可能通过相同的阵列
left和
right和使用偏移量,如
rightoff等于(
leftoff + 6),为了避免这一共同点分配额外的存储。
src的数组保存的坐标曲线的来源
srcoff -偏移在6源初阵坐标
left -用于存储的细分曲线上半年坐标数组
leftoff坐标
right -用于存储的细分曲线下半年坐标数组
rightoff -偏移量在6年初对坐标数组
public static int solveCubic(double[] eqn)
eqn阵列和场所的非复杂的根回到同一个数组,返回根数。解决的立方是由方程表示:
eqn = { C,B,A,D }DX ^ 3 + AX ^ 2 + bx + c = 0返回值1是用来区分一个常数方程可能总是0不0从方程无零。
eqn -一个数组包含一个立方系数
public static int solveCubic(double[] eqn,
double[] res)
eqn阵列和非复杂的根在
res数组,返回根数。立方解决用方程表示:eqn = { C,B,A,D } DX ^ 3 + AX ^ 2 + bx + c = 0返回值1是用来区分一个常数方程,可总是0不0,从方程无零。
eqn -指定数组系数来解决三次方程
res -包含非复杂的根从三次方程的解产生的阵列
public boolean contains(double x,
double y)
Shape边界内,由
definition of insideness描述。
public boolean contains(Point2D p)
public boolean intersects(double x,
double y,
double w,
double h)
Shape测试的内部与一个指定的矩形区域内。矩形区域是相交的
Shape如果任何点是否包含在内部的
Shape和指定的矩形区域。
的Shape.intersects()方法允许Shape实施保守的回报true时:
Shape相交,但Shapes这个方法可能返回
true即使矩形区域不相交的
Shape。的
Area类执行更精确的计算几何相交比大多数
Shape对象,因此可以更准确的答案是需要用。
intersects 接口
Shape
x -指定的矩形区域左上角的x坐标
y -指定的矩形区域的左上角的Y坐标
w -指定的矩形区域的宽度
h -指定矩形区域的高度
true如果的
Shape内部与矩形区域内相交,或是相交,相交计算高度可能会执行
false否则太贵。
Area
public boolean intersects(Rectangle2D r)
Shape测试的内部与指定的
Rectangle2D内部,
Shape.intersects()方法允许
Shape实施保守的回报
true时:
Rectangle2D和Shape相交,但Shapes这个方法可能返回
true即使
Rectangle2D不相交的
Shape。的
Area类执行更精确的计算几何相交比大多数
Shape对象,因此可以更准确的答案是需要用。
intersects 接口
Shape
r -指定
Rectangle2D
true如果的
Shape内部和指定的
Rectangle2D内部相交,或是相交,相交计算高度可能会执行
false否则太贵。
Shape.intersects(double, double, double, double)
public boolean contains(double x,
double y,
double w,
double h)
Shape测试的内部完全包含指定的矩形区域。所有的坐标,在矩形区域必须位于
Shape整个矩形区域被认为是包含在
Shape。
的Shape.contains()方法允许Shape实施保守的回报false时:
true和intersectShape完全包含矩形区域是昂贵的计算。Shapes这个方法可能返回
false即使
Shape包含矩形区域。的
Area类执行更精确的几何计算比大多数
Shape对象,因此可以更准确的答案是需要用。
contains 接口
Shape
x -指定的矩形区域左上角的x坐标
y -指定的矩形区域的左上角的Y坐标
w -指定的矩形区域的宽度
h -指定矩形区域的高度
true如果的
Shape内部完全包含指定矩形区域;
false否则,如果
Shape包含矩形面积和
intersects方法返回
true和遏制的计算是执行太贵。
Area,
Shape.intersects(double, double, double, double)
public boolean contains(Rectangle2D r)
Shape测试的内部完全包含指定的
Rectangle2D。的
Shape.contains()方法允许
Shape实施保守的回报
false时:
true和intersectShape完全包含Rectangle2D是昂贵的计算。Shapes这个方法可能返回
false即使
Shape包含
Rectangle2D。的
Area类执行更精确的几何计算比大多数
Shape对象,因此可以更准确的答案是需要用。
contains 接口
Shape
r -指定
Rectangle2D
true如果的
Shape内部完全包含
false
Rectangle2D;否则,如果
Shape包含
Rectangle2D和
intersects方法返回
true和遏制的计算是执行太贵。
Shape.contains(double, double, double, double)
public Rectangle getBounds()
Rectangle完全封闭
Shape。需要注意的是不能保证返回的
Rectangle是最小包围盒包围
Shape,只有
Shape完全在于在显示
Rectangle。返回的
Rectangle也未能完全封闭
Shape如果
Shape溢出整数数据类型的范围。的
getBounds2D方法一般返回一个紧密的包围盒由于在表示其更大的灵活性。
请注意, definition of insideness可导致的情况下,点上的shape定义轮廓可能不被视为包含在返回的bounds对象,但只有在这些点的情况下,也不被认为是包含在原始的shape。
如果一个point在shape根据contains(point)方法,那么它必须在返回的Rectangle界根据的bounds的contains(point)方法对象。明确地:
shape.contains(x,y)需要bounds.contains(x,y)
如果一个point是不是在shape,那么它可能仍然包含在bounds对象:
bounds.contains(x,y)并不意味着shape.contains(x,y)
getBounds 接口
Shape
Rectangle完全封闭
Shape。
Shape.getBounds2D()
public PathIterator getPathIterator(AffineTransform at)
CubicCurve2D类不保证本
CubicCurve2D修改对象的几何不影响任何迭代几何已经在过程。
getPathIterator 接口
Shape
at可选
AffineTransform被应用到坐标作为他们在迭代返回,或
null如果需要转化的坐标
PathIterator对象,返回该
CubicCurve2D轮廓的几何,每次一段。
public PathIterator getPathIterator(AffineTransform at, double flatness)
CubicCurve2D类不保证本
CubicCurve2D修改对象的几何不影响任何迭代几何已经在过程。
getPathIterator 接口
Shape
at可选
AffineTransform被应用到坐标作为他们在迭代返回,或
null如果需要转化的坐标
flatness,给定曲线的控制点可以从之前的细分曲线是通过共线直线连接终结点替换的最大数量
PathIterator对象,返回该
CubicCurve2D轮廓的几何,每次一段。
public Object clone()
clone 方法重写,继承类
Object
OutOfMemoryError -如果没有足够的内存。
Cloneable
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.