Class Curve

java.lang.Object
sec.sun.awt.geom.Curve

public final class Curve extends Object
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
     
    static final int
     
    static final int
    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 final double
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static long
    diffbits(double y1, double y2)
     
    static boolean
    fairlyClose(double v1, double v2)
     
    static void
    insertCubic(Vector curves, double x0, double y0, double[] coords)
     
    static void
    insertLine(Vector curves, double x0, double y0, double x1, double y1)
     
    static void
    insertMove(Vector curves, double x, double y)
     
    static void
    insertQuad(Vector curves, double x0, double y0, double[] coords)
     
    static double
    next(double v)
     
    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(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(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.
    static double
    round(double v)
     
    static long
    signeddiffbits(double y1, double y2)
     
    static int
    solveQuadratic(double[] eqn, double[] res)
    Solves the quadratic whose coefficients are in the eqn array and places the non-complex roots into the res array, returning the number of roots.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • INCREASING

      public static final int INCREASING
      See Also:
    • DECREASING

      public static final int DECREASING
      See Also:
    • 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:
    • TMIN

      public static final double TMIN
      See Also:
  • Constructor Details

  • Method Details

    • insertMove

      public static void insertMove(Vector curves, double x, double y)
    • insertLine

      public static void insertLine(Vector curves, double x0, double y0, double x1, double y1)
    • insertQuad

      public static void insertQuad(Vector curves, double x0, double y0, double[] coords)
    • insertCubic

      public static void insertCubic(Vector curves, double x0, double y0, double[] coords)
    • pointCrossingsForPath

      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.
    • 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(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.
    • 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)
    • fairlyClose

      public static boolean fairlyClose(double v1, double v2)
    • solveQuadratic

      public static int solveQuadratic(double[] eqn, double[] res)
      Solves the quadratic whose coefficients are in the eqn array and places the non-complex roots into the res array, returning the number of roots. The quadratic solved is represented by the equation:
           eqn = {C, B, A};
           ax^2 + bx + c = 0
       
      A return value of -1 is used to distinguish a constant equation, which might be always 0 or never 0, from an equation that has no zeroes.
      Parameters:
      eqn - the specified array of coefficients to use to solve the quadratic equation
      res - the array that contains the non-complex roots resulting from the solution of the quadratic equation
      Returns:
      the number of roots, or -1 if the equation is a constant.
      Since:
      1.3