Package snap.geom
Class Quad
java.lang.Object
snap.geom.Shape
snap.geom.Segment
snap.geom.Quad
A Segment representing a Quadratic curve.
-
Field Summary
Fields inherited from class snap.geom.Shape
_bounds, WIND_EVEN_ODD, WIND_NON_ZERO
-
Constructor Summary
ConstructorDescriptionQuad
(double aX0, double aY0, double aCPX, double aCPY, double aX1, double aY1) Creates a new Quad. -
Method Summary
Modifier and TypeMethodDescriptionCreates and returns the reverse of this segement.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.boolean
Standard equals implementation.protected double
Calculates and returns length of this segment.static Rect
Returns the bounds for given quad points.static Rect
getBounds2
(double x0, double y0, double x1, double y1, double x2, double y2, Rect aRect) Returns the bounds of the give quadratic.protected Rect
Returns the bounds.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.double[]
getEndCoords
(double[] coords) Returns the point coords.Returns the hit for given segment.getPathIter
(Transform aT) Returns a path iterator.Point[]
Returns the points.double
getX
(double aLoc) Returns the x value at given parametric location.double
getY
(double aLoc) Returns the y value at given parametric location.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.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.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.boolean
Returns whether quad is equal to another, regardless of direction.void
setPoints
(double aX0, double aY0, double aCPX, double aCPY, double aX1, double aY1) Sets the quad points.split
(double aLoc) Splits this Quad at given parametric location and return the remainder.Methods inherited from class snap.geom.Segment
containsSeg, crossesSeg, equals, getArcLength, getHitPoint, getPointAndAngle, getX0, getX1, getY0, getY1, intersectsSeg, newSegmentForSegAndPoints
Methods inherited from class snap.geom.Shape
addShapes, contains, contains, contains, contains, copyFor, copyFor, copyForBounds, getBounds, getCrossings, getDistance, getFlattenedShape, getFlattenedShape, getHeight, getNotSelfIntersectingShape, getSvgString, getWidth, getX, getY, intersectShapes, intersectsShape, intersectsShape, intersectsXY, isClosed, isFlat, isMultiCycle, isSelfIntersecting, isSingleCycle, shapeChanged, subtractShapes, toString
-
Constructor Details
-
Quad
public Quad(double aX0, double aY0, double aCPX, double aCPY, double aX1, double aY1) Creates a new Quad.
-
-
Method Details
-
getPoints
Returns the points. -
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 classSegment
-
getArcLengthImpl
protected double getArcLengthImpl()Calculates and returns length of this segment.- Specified by:
getArcLengthImpl
in classSegment
-
getBoundsImpl
Returns the bounds.- Overrides:
getBoundsImpl
in classShape
-
getPathIter
Returns a path iterator.- Specified by:
getPathIter
in classShape
-
getX
public double getX(double aLoc) Returns the x value at given parametric location. -
getY
public double getY(double aLoc) Returns the y value at given parametric location. -
split
Splits this Quad at given parametric location and return the remainder. -
createReverse
Creates and returns the reverse of this segement.- Specified by:
createReverse
in classSegment
-
equals
Standard equals implementation. -
matches
Returns whether quad is equal to another, regardless of direction. -
getHit
Returns the hit for given 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.
-