APIdia Launch Partner
Top Fields Constructors Methods
sun.awt.geom

public abstract Class Curve

extends Object
Class Inheritance
Known Direct Subclasses
sun.awt.geom.Order0, sun.awt.geom.Order1, sun.awt.geom.Order2, sun.awt.geom.Order3
Imports
java.awt.geom.Rectangle2D, .QuadCurve2D, .CubicCurve2D, .PathIterator, .IllegalPathStateException, java.util.Vector

Field Summary

Modifier and TypeField and Description
public static final int
protected int
public static final int
public static final int
RECT_INTERSECTS

The rectangle intersection test counts the number of times that the path crosses through the shadow that the rectangle projects to the right towards (x => +INFINITY).

public static final double

Constructor Summary

AccessConstructor and Description
public
Curve(int direction)

Method Summary

Modifier and TypeMethod and Description
public boolean
public static void
accumulateExtremaBoundsForCubic(double[]
the bounds to update, which are expressed as: { minX, maxX }
bounds
,
int
the index in boundsof the minimum value
boundsOffset
,
double
the starting value of the bezier curve where t = 0.0
x1
,
double
the first control value of the bezier curve
ctrlX1
,
double
the second control value of the bezier curve
ctrlX2
,
double
the ending value of the bezier curve where t = 1.0
x2
,
double[]
an array of at least 3 elements that will be overwritten and reused
coeff
,
double[]
an array of at least 2 elements that will be overwritten and reused
deriv_coeff
)

Accumulate the cubic extrema into the pre-existing bounding array.

public static void
accumulateExtremaBoundsForQuad(double[]
the bounds to update, which are expressed as: { minX, maxX }
bounds
,
int
the index in boundsof the minimum value
boundsOffset
,
double
the starting value of the bezier curve where t = 0.0
x1
,
double
the control value of the bezier curve
ctrlX
,
double
the ending value of the bezier curve where t = 1.0
x2
,
double[]
an array of at least 3 elements that will be overwritten and reused
coeff
,
double[]
an array of at least 2 elements that will be overwritten and reused
deriv_coeff
)

Accumulate the quadratic extrema into the pre-existing bounding array.

public int
compareTo(Curve that, double[] yrange)

public String
public int
crossingsFor(double x, double y)

public static long
diffbits(double y1, double y2)

public abstract double
dXforT(double t, int deriv)

public abstract double
dYforT(double t, int deriv)

public abstract void
public boolean
fairlyClose(double v1, double v2)

public boolean
findIntersect(Curve that, double[] yrange, double ymin, int slevel, int tlevel, double s0, double xs0, double ys0, double s1, double xs1, double ys1, double t0, double xt0, double yt0, double t1, double xt1, double yt1)

public final int
public abstract int
public abstract Curve
public abstract int
getSegment(double[] coords)

public Curve
getSubCurve(double ystart, double yend)

public abstract Curve
getSubCurve(double ystart, double yend, int dir)

public final Curve
getWithDirection(int direction)

public abstract double
public abstract double
public abstract double
public abstract double
public abstract double
public abstract double
public abstract double
public abstract double
public abstract double
public abstract double
public static void
insertCubic(Vector<Curve> curves, double x0, double y0, double[] coords)

public static void
insertLine(Vector<Curve> curves, double x0, double y0, double x1, double y1)

public static void
insertMove(Vector<Curve> curves, double x, double y)

public static void
insertQuad(Vector<Curve> curves, double x0, double y0, double[] coords)

public static double
next(double v)

public abstract double
nextVertical(double t0, double t1)

public static int
orderof(double x1, double x2)

public static int
pointCrossingsForCubic(double px, double py, double x0, double y0, double xc0, double yc0, double xc1, double yc1, double x1, double y1, int level)

Calculates the number of times the cubic from (x0,y0) to (x1,y1) crosses the ray extending to the right from (px,py).

public static int
pointCrossingsForLine(double px, double py, double x0, double y0, double x1, double y1)

Calculates the number of times the line from (x0,y0) to (x1,y1) crosses the ray extending to the right from (px,py).

public static int
pointCrossingsForPath(PathIterator pi, double px, double py)

Calculates the number of times the given path crosses the ray extending to the right from (px,py).

public static int
pointCrossingsForQuad(double px, double py, double x0, double y0, double xc, double yc, double x1, double y1, int level)

Calculates the number of times the quad from (x0,y0) to (x1,y1) crosses the ray extending to the right from (px,py).

public static double
prev(double v)

public static int
rectCrossingsForCubic(int crossings, double rxmin, double rymin, double rxmax, double rymax, double x0, double y0, double xc0, double yc0, double xc1, double yc1, double x1, double y1, int level)

Accumulate the number of times the cubic crosses the shadow extending to the right of the rectangle.

public static int
rectCrossingsForLine(int crossings, double rxmin, double rymin, double rxmax, double rymax, double x0, double y0, double x1, double y1)

Accumulate the number of times the line crosses the shadow extending to the right of the rectangle.

public static int
rectCrossingsForPath(PathIterator pi, double rxmin, double rymin, double rxmax, double rymax)

Accumulate the number of times the path crosses the shadow extending to the right of the rectangle.

public static int
rectCrossingsForQuad(int crossings, double rxmin, double rymin, double rxmax, double rymax, double x0, double y0, double xc, double yc, double x1, double y1, int level)

Accumulate the number of times the quad crosses the shadow extending to the right of the rectangle.

public double
refineTforY(double t0, double yt0, double y0)

public static double
round(double v)

public static long
signeddiffbits(double y1, double y2)

public abstract double
TforY(double y)

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

public abstract double
XforT(double t)

public abstract double
XforY(double y)

public abstract double
YforT(double t)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

DECREASINGback to summary
public static final int DECREASING
directionback to summary
protected int direction
INCREASINGback to summary
public static final int INCREASING
RECT_INTERSECTSback to summary
public static final int RECT_INTERSECTS

The rectangle intersection test counts the number of times that the path crosses through the shadow that the rectangle projects to the right towards (x => +INFINITY). During processing of the path it actually counts every time the path crosses either or both of the top and bottom edges of that shadow. If the path enters from the top, the count is incremented. If it then exits back through the top, the same way it came in, the count is decremented and there is no impact on the winding count. If, instead, the path exits out the bottom, then the count is incremented again and a full pass through the shadow is indicated by the winding count having been incremented by 2. Thus, the winding count that it accumulates is actually double the real winding count. Since the path is continuous, the final answer should be a multiple of 2, otherwise there is a logic error somewhere. If the path ever has a direct hit on the rectangle, then a special value is returned. This special value terminates all ongoing accumulation on up through the call chain and ends up getting returned to the calling function which can then produce an answer directly. For intersection tests, the answer is always "true" if the path intersects the rectangle. For containment tests, the answer is always "false" if the path intersects the rectangle. Thus, no further processing is ever needed if an intersection occurs.

TMINback to summary
public static final double TMIN

Constructor Detail

Curveback to summary
public Curve(int direction)

Method Detail

accumulateCrossingsback to summary
public boolean accumulateCrossings(Crossings c)
accumulateExtremaBoundsForCubicback to summary
public static void accumulateExtremaBoundsForCubic(double[] bounds, int boundsOffset, double x1, double ctrlX1, double ctrlX2, double x2, double[] coeff, double[] deriv_coeff)

Accumulate the cubic extrema into the pre-existing bounding array.

This method focuses on one dimension at a time, so to get both the x and y dimensions you'll need to call this method twice.

Whenever we have to examine cubic or quadratic extrema that change our bounding box: we run the risk of machine error that may produce a box that is slightly too small. But the contract of Shape#getBounds2D() says we should err on the side of being too large. So to address this: we'll apply a margin based on the upper limit of numerical error caused by the polynomial evaluation (horner scheme).

Parameters
bounds:double[]

the bounds to update, which are expressed as: { minX, maxX }

boundsOffset:int

the index in boundsof the minimum value

x1:double

the starting value of the bezier curve where t = 0.0

ctrlX1:double

the first control value of the bezier curve

ctrlX2:double

the second control value of the bezier curve

x2:double

the ending value of the bezier curve where t = 1.0

coeff:double[]

an array of at least 3 elements that will be overwritten and reused

deriv_coeff:double[]

an array of at least 2 elements that will be overwritten and reused

accumulateExtremaBoundsForQuadback to summary
public static void accumulateExtremaBoundsForQuad(double[] bounds, int boundsOffset, double x1, double ctrlX, double x2, double[] coeff, double[] deriv_coeff)

Accumulate the quadratic extrema into the pre-existing bounding array.

This method focuses on one dimension at a time, so to get both the x and y dimensions you'll need to call this method twice.

Whenever we have to examine cubic or quadratic extrema that change our bounding box: we run the risk of machine error that may produce a box that is slightly too small. But the contract of Shape#getBounds2D() says we should err on the side of being too large. So to address this: we'll apply a margin based on the upper limit of numerical error caused by the polynomial evaluation (horner scheme).

Parameters
bounds:double[]

the bounds to update, which are expressed as: { minX, maxX }

boundsOffset:int

the index in boundsof the minimum value

x1:double

the starting value of the bezier curve where t = 0.0

ctrlX:double

the control value of the bezier curve

x2:double

the ending value of the bezier curve where t = 1.0

coeff:double[]

an array of at least 3 elements that will be overwritten and reused

deriv_coeff:double[]

an array of at least 2 elements that will be overwritten and reused

compareToback to summary
public int compareTo(Curve that, double[] yrange)
controlPointStringback to summary
public String controlPointString()
crossingsForback to summary
public int crossingsFor(double x, double y)
diffbitsback to summary
public static long diffbits(double y1, double y2)
dXforTback to summary
public abstract double dXforT(double t, int deriv)
dYforTback to summary
public abstract double dYforT(double t, int deriv)
enlargeback to summary
public abstract void enlarge(Rectangle2D r)
fairlyCloseback to summary
public boolean fairlyClose(double v1, double v2)
findIntersectback to summary
public boolean findIntersect(Curve that, double[] yrange, double ymin, int slevel, int tlevel, double s0, double xs0, double ys0, double s1, double xs1, double ys1, double t0, double xt0, double yt0, double t1, double xt1, double yt1)
getDirectionback to summary
public final int getDirection()
getOrderback to summary
public abstract int getOrder()
getReversedCurveback to summary
public abstract Curve getReversedCurve()
getSegmentback to summary
public abstract int getSegment(double[] coords)
getSubCurveback to summary
public Curve getSubCurve(double ystart, double yend)
getSubCurveback to summary
public abstract Curve getSubCurve(double ystart, double yend, int dir)
getWithDirectionback to summary
public final Curve getWithDirection(int direction)
getX0back to summary
public abstract double getX0()
getX1back to summary
public abstract double getX1()
getXBotback to summary
public abstract double getXBot()
getXMaxback to summary
public abstract double getXMax()
getXMinback to summary
public abstract double getXMin()
getXTopback to summary
public abstract double getXTop()
getY0back to summary
public abstract double getY0()
getY1back to summary
public abstract double getY1()
getYBotback to summary
public abstract double getYBot()
getYTopback to summary
public abstract double getYTop()
insertCubicback to summary
public static void insertCubic(Vector<Curve> curves, double x0, double y0, double[] coords)
insertLineback to summary
public static void insertLine(Vector<Curve> curves, double x0, double y0, double x1, double y1)
insertMoveback to summary
public static void insertMove(Vector<Curve> curves, double x, double y)
insertQuadback to summary
public static void insertQuad(Vector<Curve> curves, double x0, double y0, double[] coords)
nextback to summary
public static double next(double v)
nextVerticalback to summary
public abstract double nextVertical(double t0, double t1)
orderofback to summary
public static int orderof(double x1, double x2)
pointCrossingsForCubicback to summary
public static int pointCrossingsForCubic(double px, double py, double x0, double y0, double xc0, double yc0, double xc1, double yc1, double x1, double y1, int level)

Calculates the number of times the cubic from (x0,y0) to (x1,y1) crosses the ray extending to the right from (px,py). If the point lies on a part of the curve, then no crossings are counted for that intersection. the level parameter should be 0 at the top-level call and will count up for each recursion level to prevent infinite recursion +1 is added for each crossing where the Y coordinate is increasing -1 is added for each crossing where the Y coordinate is decreasing

pointCrossingsForLineback to summary
public static int pointCrossingsForLine(double px, double py, double x0, double y0, double x1, double y1)

Calculates the number of times the line from (x0,y0) to (x1,y1) crosses the ray extending to the right from (px,py). If the point lies on the line, then no crossings are recorded. +1 is returned for a crossing where the Y coordinate is increasing -1 is returned for a crossing where the Y coordinate is decreasing

pointCrossingsForPathback to summary
public static int pointCrossingsForPath(PathIterator pi, double px, double py)

Calculates the number of times the given path crosses the ray extending to the right from (px,py). If the point lies on a part of the path, then no crossings are counted for that intersection. +1 is added for each crossing where the Y coordinate is increasing -1 is added for each crossing where the Y coordinate is decreasing The return value is the sum of all crossings for every segment in the path. The path must start with a SEG_MOVETO, otherwise an exception is thrown. The caller must check p[xy] for NaN values. The caller may also reject infinite p[xy] values as well.

pointCrossingsForQuadback to summary
public static int pointCrossingsForQuad(double px, double py, double x0, double y0, double xc, double yc, double x1, double y1, int level)

Calculates the number of times the quad from (x0,y0) to (x1,y1) crosses the ray extending to the right from (px,py). If the point lies on a part of the curve, then no crossings are counted for that intersection. the level parameter should be 0 at the top-level call and will count up for each recursion level to prevent infinite recursion +1 is added for each crossing where the Y coordinate is increasing -1 is added for each crossing where the Y coordinate is decreasing

prevback to summary
public static double prev(double v)
rectCrossingsForCubicback to summary
public static int rectCrossingsForCubic(int crossings, double rxmin, double rymin, double rxmax, double rymax, double x0, double y0, double xc0, double yc0, double xc1, double yc1, double x1, double y1, int level)

Accumulate the number of times the cubic crosses the shadow extending to the right of the rectangle. See the comment for the RECT_INTERSECTS constant for more complete details.

rectCrossingsForLineback to summary
public static int rectCrossingsForLine(int crossings, double rxmin, double rymin, double rxmax, double rymax, double x0, double y0, double x1, double y1)

Accumulate the number of times the line crosses the shadow extending to the right of the rectangle. See the comment for the RECT_INTERSECTS constant for more complete details.

rectCrossingsForPathback to summary
public static int rectCrossingsForPath(PathIterator pi, double rxmin, double rymin, double rxmax, double rymax)

Accumulate the number of times the path crosses the shadow extending to the right of the rectangle. See the comment for the RECT_INTERSECTS constant for more complete details. The return value is the sum of all crossings for both the top and bottom of the shadow for every segment in the path, or the special value RECT_INTERSECTS if the path ever enters the interior of the rectangle. The path must start with a SEG_MOVETO, otherwise an exception is thrown. The caller must check r[xy]{min,max} for NaN values.

rectCrossingsForQuadback to summary
public static int rectCrossingsForQuad(int crossings, double rxmin, double rymin, double rxmax, double rymax, double x0, double y0, double xc, double yc, double x1, double y1, int level)

Accumulate the number of times the quad crosses the shadow extending to the right of the rectangle. See the comment for the RECT_INTERSECTS constant for more complete details.

refineTforYback to summary
public double refineTforY(double t0, double yt0, double y0)
roundback to summary
public static double round(double v)
signeddiffbitsback to summary
public static long signeddiffbits(double y1, double y2)
TforYback to summary
public abstract double TforY(double y)
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

XforTback to summary
public abstract double XforT(double t)
XforYback to summary
public abstract double XforY(double y)
YforTback to summary
public abstract double YforT(double t)