Package snap.geom

Class Quad


public class Quad extends Segment
A Segment representing a Quadratic curve.
  • Constructor Details

    • Quad

      public Quad(double aX0, double aY0, double aCPX, double aCPY, double aX1, double aY1)
      Creates a new Quad.
  • Method Details

    • getPoints

      public Point[] getPoints()
      Returns the points.
      Overrides:
      getPoints in class Segment
    • setPoints

      public void setPoints(double aX0, double aY0, double aCPX, double aCPY, double aX1, double aY1)
      Sets the quad points.
    • getEndCoords

      public double[] getEndCoords(double[] coords)
      Returns the point coords.
      Overrides:
      getEndCoords in class Segment
    • getArcLengthImpl

      protected double getArcLengthImpl()
      Calculates and returns length of this segment.
      Specified by:
      getArcLengthImpl in class Segment
    • getBoundsImpl

      protected Rect getBoundsImpl()
      Returns the bounds.
      Overrides:
      getBoundsImpl in class Shape
    • getPathIter

      public PathIter getPathIter(Transform aT)
      Returns a path iterator.
      Specified by:
      getPathIter in class Shape
    • getX

      public double getX(double aLoc)
      Returns the x value at given parametric location.
      Specified by:
      getX in class Segment
    • getY

      public double getY(double aLoc)
      Returns the y value at given parametric location.
      Specified by:
      getY in class Segment
    • split

      public Quad split(double aLoc)
      Splits this Quad at given parametric location and return the remainder.
      Specified by:
      split in class Segment
    • createReverse

      public Quad createReverse()
      Creates and returns the reverse of this segement.
      Specified by:
      createReverse in class Segment
    • equals

      public boolean equals(Object anObj)
      Standard equals implementation.
      Overrides:
      equals in class Object
    • matches

      public boolean matches(Object anObj)
      Returns whether quad is equal to another, regardless of direction.
      Specified by:
      matches in class Segment
    • getHit

      public SegHit getHit(Segment aSeg)
      Returns the hit for given segment.
      Overrides:
      getHit in class Segment
    • getBounds

      public static Rect getBounds(double x0, double y0, double xc0, double yc0, double x1, double y1, Rect aRect)
      Returns the bounds for given quad points.
    • getBounds2

      public static Rect getBounds2(double x0, double y0, double x1, double y1, double x2, double y2, Rect aRect)
      Returns the bounds of the give quadratic.
    • getDistanceSquared

      public static double getDistanceSquared(double x0, double y0, double xc0, double yc0, double x1, double y1, double aX, double aY)
      Returns the minimum distance from the given point to the curve.
    • crossings

      public static int crossings(double x0, double y0, double xc, double yc, double x1, double y1, double px, double py, int level)
      Returns the number of crossings for the ray from given point extending to the right.
    • isLine

      public static boolean isLine(double x0, double y0, double xc0, double yc0, double x1, double y1)
      Returns whether Quad for given points is effectively a line.
    • intersectsLine

      public static boolean intersectsLine(double x0, double y0, double xc0, double yc0, double x1, double y1, double px0, double py0, double px1, double py1)
      Returns whether Quad for given points is intersected by line with given points.
    • intersectsQuad

      public static boolean intersectsQuad(double x0, double y0, double xc0, double yc0, double x1, double y1, double px0, double py0, double pxc0, double pyc0, double px1, double py1)
      Returns whether Quad for given points is intersected by Quad with given points.