sun.awt.geom
Class Curve

java.lang.Object
  extended by sun.awt.geom.Curve

public abstract class Curve
extends java.lang.Object


Field Summary
static int DECREASING
           
static int INCREASING
           
static 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).
static double TMIN
           
 
Constructor Summary
Curve(int direction)
           
 
Method Summary
 boolean accumulateCrossings(sun.awt.geom.Crossings c)
           
 int compareTo(Curve that, double[] yrange)
           
 java.lang.String controlPointString()
           
 int crossingsFor(double x, double y)
           
static long diffbits(double y1, double y2)
           
abstract  double dXforT(double t, int deriv)
           
abstract  double dYforT(double t, int deriv)
           
abstract  void enlarge(java.awt.geom.Rectangle2D r)
           
 boolean fairlyClose(double v1, double v2)
           
 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)
           
 int getDirection()
           
abstract  int getOrder()
           
abstract  Curve getReversedCurve()
           
abstract  int getSegment(double[] coords)
           
 Curve getSubCurve(double ystart, double yend)
           
abstract  Curve getSubCurve(double ystart, double yend, int dir)
           
 Curve getWithDirection(int direction)
           
abstract  double getX0()
           
abstract  double getX1()
           
abstract  double getXBot()
           
abstract  double getXMax()
           
abstract  double getXMin()
           
abstract  double getXTop()
           
abstract  double getY0()
           
abstract  double getY1()
           
abstract  double getYBot()
           
abstract  double getYTop()
           
static void insertCubic(java.util.Vector curves, double x0, double y0, double[] coords)
           
static void insertLine(java.util.Vector curves, double x0, double y0, double x1, double y1)
           
static void insertMove(java.util.Vector curves, double x, double y)
           
static void insertQuad(java.util.Vector curves, double x0, double y0, double[] coords)
           
static double next(double v)
           
abstract  double nextVertical(double t0, double t1)
           
static int orderof(double x1, double x2)
           
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).
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).
static int pointCrossingsForPath(java.awt.geom.PathIterator pi, double px, double py)
          Calculates the number of times the given path crosses the ray extending to the right from (px,py).
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).
static double prev(double v)
           
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.
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.
static int rectCrossingsForPath(java.awt.geom.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.
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.
 double refineTforY(double t0, double yt0, double y0)
           
static double round(double v)
           
static long signeddiffbits(double y1, double y2)
           
abstract  double TforY(double y)
           
 java.lang.String toString()
           
abstract  double XforT(double t)
           
abstract  double XforY(double y)
           
abstract  double YforT(double t)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

INCREASING

public static final int INCREASING
See Also:
Constant Field Values

DECREASING

public static final int DECREASING
See Also:
Constant Field Values

RECT_INTERSECTS

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.

See Also:
Constant Field Values

TMIN

public static final double TMIN
See Also:
Constant Field Values
Constructor Detail

Curve

public Curve(int direction)
Method Detail

insertMove

public static void insertMove(java.util.Vector curves,
                              double x,
                              double y)

insertLine

public static void insertLine(java.util.Vector curves,
                              double x0,
                              double y0,
                              double x1,
                              double y1)

insertQuad

public static void insertQuad(java.util.Vector curves,
                              double x0,
                              double y0,
                              double[] coords)

insertCubic

public static void insertCubic(java.util.Vector curves,
                               double x0,
                               double y0,
                               double[] coords)

pointCrossingsForPath

public static int pointCrossingsForPath(java.awt.geom.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.


pointCrossingsForLine

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


pointCrossingsForQuad

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


pointCrossingsForCubic

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


rectCrossingsForPath

public static int rectCrossingsForPath(java.awt.geom.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.


rectCrossingsForLine

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.


rectCrossingsForQuad

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.


rectCrossingsForCubic

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.


getDirection

public final int getDirection()

getWithDirection

public final Curve getWithDirection(int direction)

round

public static double round(double v)

orderof

public static int orderof(double x1,
                          double x2)

signeddiffbits

public static long signeddiffbits(double y1,
                                  double y2)

diffbits

public static long diffbits(double y1,
                            double y2)

prev

public static double prev(double v)

next

public static double next(double v)

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

controlPointString

public java.lang.String controlPointString()

getOrder

public abstract int getOrder()

getXTop

public abstract double getXTop()

getYTop

public abstract double getYTop()

getXBot

public abstract double getXBot()

getYBot

public abstract double getYBot()

getXMin

public abstract double getXMin()

getXMax

public abstract double getXMax()

getX0

public abstract double getX0()

getY0

public abstract double getY0()

getX1

public abstract double getX1()

getY1

public abstract double getY1()

XforY

public abstract double XforY(double y)

TforY

public abstract double TforY(double y)

XforT

public abstract double XforT(double t)

YforT

public abstract double YforT(double t)

dXforT

public abstract double dXforT(double t,
                              int deriv)

dYforT

public abstract double dYforT(double t,
                              int deriv)

nextVertical

public abstract double nextVertical(double t0,
                                    double t1)

crossingsFor

public int crossingsFor(double x,
                        double y)

accumulateCrossings

public boolean accumulateCrossings(sun.awt.geom.Crossings c)

enlarge

public abstract void enlarge(java.awt.geom.Rectangle2D r)

getSubCurve

public Curve getSubCurve(double ystart,
                         double yend)

getReversedCurve

public abstract Curve getReversedCurve()

getSubCurve

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

compareTo

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

findIntersect

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)

refineTforY

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

fairlyClose

public boolean fairlyClose(double v1,
                           double v2)

getSegment

public abstract int getSegment(double[] coords)