Top Description Fields Constructors Methods
com.sun.javafx.geom

public Class QuadCurve2D

extends Shape
Class Inheritance
Imports
com.sun.javafx.geom.transform.BaseTransform

The QuadCurve2D class defines a quadratic parametric curve segment in (x,y) coordinate space.

This class is only the abstract superclass for all objects that store a 2D quadratic curve segment. The actual storage representation of the coordinates is left to the subclass.

Version
1.40, 05/05/07

Field Summary

Modifier and TypeField and Description
private static final int
private static final int
public float
ctrlx

The X coordinate of the control point of the quadratic curve segment.

public float
ctrly

The Y coordinate of the control point of the quadratic curve segment.

private static final int
private static final int
private static final int
public float
x1

The X coordinate of the start point of the quadratic curve segment.

public float
x2

The X coordinate of the end point of the quadratic curve segment.

public float
y1

The Y coordinate of the start point of the quadratic curve segment.

public float
y2

The Y coordinate of the end point of the quadratic curve segment.

Inherited from com.sun.javafx.geom.Shape:
OUT_BOTTOMOUT_LEFTOUT_RIGHTOUT_TOPRECT_INTERSECTS

Constructor Summary

AccessConstructor and Description
public
QuadCurve2D()

Constructs and initializes a QuadCurve2D with coordinates (0, 0, 0, 0, 0, 0).

public
QuadCurve2D(float
the X coordinate of the start point
x1
,
float
the Y coordinate of the start point
y1
,
float
the X coordinate of the control point
ctrlx
,
float
the Y coordinate of the control point
ctrly
,
float
the X coordinate of the end point
x2
,
float
the Y coordinate of the end point
y2
)

Constructs and initializes a QuadCurve2D from the specified float coordinates.

Method Summary

Modifier and TypeMethod and Description
public boolean
contains(float
the specified X coordinate to be tested
x
,
float
the specified Y coordinate to be tested
y
)

Implements abstract com.sun.javafx.geom.Shape.contains.

Tests if the specified coordinates are inside the boundary of the Shape.

public boolean
contains(Point2D
the specified Point2D to be tested
p
)

Overrides com.sun.javafx.geom.Shape.contains.

Tests if a specified Point2D is inside the boundary of the Shape.

public boolean
contains(float
the X coordinate of the upper-left corner of the specified rectangular area
x
,
float
the Y coordinate of the upper-left corner of the specified rectangular area
y
,
float
the width of the specified rectangular area
w
,
float
the height of the specified rectangular area
h
)

Implements abstract com.sun.javafx.geom.Shape.contains.

Tests if the interior of the Shape entirely contains the specified rectangular area.

public QuadCurve2D
copy()

Implements abstract com.sun.javafx.geom.Shape.copy.

Returns a new copy of this Shape instance.

public boolean
equals(Object
the reference object with which to compare.
obj
)

Overrides java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

private static int
evalQuadratic(float[] vals, int num, boolean include0, boolean include1, float[] inflect, float c1, float ctrl, float c2)

Evaluate the t values in the first num slots of the vals[] array and place the evaluated values back into the same array.

private static void
fillEqn(float[] eqn, float val, float c1, float cp, float c2)

Fill an array with the coefficients of the parametric equation in t, ready for solving against val with solveQuadratic.

public RectBounds
getBounds()

Implements abstract com.sun.javafx.geom.Shape.getBounds.

Note that there is no guarantee that the returned RectBounds is the smallest bounding box that encloses the Shape, only that the Shape lies entirely within the indicated RectBounds.

public static float

Returns:

the flatness of the quadratic curve defined by the specified coordinates.
getFlatness
(float
the X coordinate of the start point
x1
,
float
the Y coordinate of the start point
y1
,
float
the X coordinate of the control point
ctrlx
,
float
the Y coordinate of the control point
ctrly
,
float
the X coordinate of the end point
x2
,
float
the Y coordinate of the end point
y2
)

Returns the flatness, or maximum distance of a control point from the line connecting the end points, of the quadratic curve specified by the indicated control points.

public static float

Returns:

the flatness of a quadratic curve defined by the specified array at the specified offset.
getFlatness
(float[]
an array containing coordinate values
coords
,
int
the index into coords from which to start getting the coordinate values
offset
)

Returns the flatness, or maximum distance of a control point from the line connecting the end points, of the quadratic curve specified by the control points stored in the indicated array at the indicated index.

public float

Returns:

the flatness of this QuadCurve2D.
getFlatness
()

Returns the flatness, or maximum distance of a control point from the line connecting the end points, of this QuadCurve2D.

public static float

Returns:

the square of the flatness of the quadratic curve defined by the specified coordinates.
getFlatnessSq
(float
the X coordinate of the start point
x1
,
float
the Y coordinate of the start point
y1
,
float
the X coordinate of the control point
ctrlx
,
float
the Y coordinate of the control point
ctrly
,
float
the X coordinate of the end point
x2
,
float
the Y coordinate of the end point
y2
)

Returns the square of the flatness, or maximum distance of a control point from the line connecting the end points, of the quadratic curve specified by the indicated control points.

public static float

Returns:

the flatness of the quadratic curve that is defined by the values in the specified array at the specified index.
getFlatnessSq
(float[]
an array containing coordinate values
coords
,
int
the index into coords from which to to start getting the values from the array
offset
)

Returns the square of the flatness, or maximum distance of a control point from the line connecting the end points, of the quadratic curve specified by the control points stored in the indicated array at the indicated index.

public float

Returns:

the square of the flatness of this QuadCurve2D.
getFlatnessSq
()

Returns the square of the flatness, or maximum distance of a control point from the line connecting the end points, of this QuadCurve2D.

public PathIterator

Returns:

a PathIterator object that defines the boundary of the shape.
getPathIterator
(BaseTransform
an optional BaseTransform to apply to the shape boundary
tx
)

Implements abstract com.sun.javafx.geom.Shape.getPathIterator.

Returns an iteration object that defines the boundary of the shape of this QuadCurve2D.

public PathIterator

Returns:

a PathIterator object that defines the flattened boundary of the shape.
getPathIterator
(BaseTransform
an optional BaseTransform to apply to the boundary of the shape
tx
,
float
the maximum distance that the control points for a subdivided curve can be with respect to a line connecting the end points of this curve before this curve is replaced by a straight line connecting the end points.
flatness
)

Implements abstract com.sun.javafx.geom.Shape.getPathIterator.

Returns an iteration object that defines the boundary of the flattened shape of this QuadCurve2D.

private static int
getTag(float coord, float low, float high)

Determine where coord lies with respect to the range from low to high.

public int
hashCode()

Overrides java.lang.Object.hashCode.

Returns a hash code value for this object.

public boolean
intersects(float
the X coordinate of the upper-left corner of the specified rectangular area
x
,
float
the Y coordinate of the upper-left corner of the specified rectangular area
y
,
float
the width of the specified rectangular area
w
,
float
the height of the specified rectangular area
h
)

Implements abstract com.sun.javafx.geom.Shape.intersects.

Tests if the interior of the Shape intersects the interior of a specified rectangular area.

private static boolean
inwards(int pttag, int opt1tag, int opt2tag)

Determine if the pttag represents a coordinate that is already in its test range, or is on the border with either of the two opttags representing another coordinate that is "towards the inside" of that test range.

public void
setCurve(float
the X coordinate of the start point
x1
,
float
the Y coordinate of the start point
y1
,
float
the X coordinate of the control point
ctrlx
,
float
the Y coordinate of the control point
ctrly
,
float
the X coordinate of the end point
x2
,
float
the Y coordinate of the end point
y2
)

Sets the location of the end points and control point of this curve to the specified float coordinates.

public void
setCurve(float[]
the array containing coordinate values
coords
,
int
the index into the array from which to start getting the coordinate values and assigning them to this QuadCurve2D
offset
)

Sets the location of the end points and control points of this QuadCurve2D to the double coordinates at the specified offset in the specified array.

public void
setCurve(Point2D
the start point
p1
,
Point2D
the control point
cp
,
Point2D
the end point
p2
)

Sets the location of the end points and control point of this QuadCurve2D to the specified Point2D coordinates.

public void
setCurve(Point2D[]
an array containing Point2D that define coordinate values
pts
,
int
the index into pts from which to start getting the coordinate values and assigning them to this QuadCurve2D
offset
)

Sets the location of the end points and control points of this QuadCurve2D to the coordinates of the Point2D objects at the specified offset in the specified array.

public void
setCurve(QuadCurve2D
the specified QuadCurve2D
c
)

Sets the location of the end points and control point of this QuadCurve2D to the same as those in the specified QuadCurve2D.

public static int

Returns:

the number of roots, or -1 if the equation is a constant
solveQuadratic
(float[]
the array that contains the quadratic coefficients
eqn
)

Solves the quadratic whose coefficients are in the eqn array and places the non-complex roots back into the same array, returning the number of roots.

public static int

Returns:

the number of roots, or -1 if the equation is a constant.
solveQuadratic
(float[]
the specified array of coefficients to use to solve the quadratic equation
eqn
,
float[]
the array that contains the non-complex roots resulting from the solution of the quadratic equation
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.

public void
subdivide(QuadCurve2D
the QuadCurve2D object for storing the left or first half of the subdivided curve
left
,
QuadCurve2D
the QuadCurve2D object for storing the right or second half of the subdivided curve
right
)

Subdivides this QuadCurve2D and stores the resulting two subdivided curves into the left and right curve parameters.

public static void
subdivide(QuadCurve2D
the quadratic curve to be subdivided
src
,
QuadCurve2D
the QuadCurve2D object for storing the left or first half of the subdivided curve
left
,
QuadCurve2D
the QuadCurve2D object for storing the right or second half of the subdivided curve
right
)

Subdivides the quadratic curve specified by the src parameter and stores the resulting two subdivided curves into the left and right curve parameters.

public static void
subdivide(float[]
the array holding the coordinates for the source curve
src
,
int
the offset into the array of the beginning of the the 6 source coordinates
srcoff
,
float[]
the array for storing the coordinates for the first half of the subdivided curve
left
,
int
the offset into the array of the beginning of the the 6 left coordinates
leftoff
,
float[]
the array for storing the coordinates for the second half of the subdivided curve
right
,
int
the offset into the array of the beginning of the the 6 right coordinates
rightoff
)

Subdivides the quadratic curve specified by the coordinates stored in the src array at indices srcoff through srcoff + 5 and stores the resulting two subdivided curves into the two result arrays at the corresponding indices.

public CubicCurve2D
Inherited from com.sun.javafx.geom.Shape:
accumulateaccumulateCubicaccumulateCubicaccumulateQuadcontainsintersectsintersectsLineoutcodepointCrossingsForCubicpointCrossingsForLinepointCrossingsForPathpointCrossingsForQuadrectCrossingsForCubicrectCrossingsForLinerectCrossingsForPathrectCrossingsForQuad

Field Detail

ABOVEback to summary
private static final int ABOVE
BELOWback to summary
private static final int BELOW
ctrlxback to summary
public float ctrlx

The X coordinate of the control point of the quadratic curve segment.

ctrlyback to summary
public float ctrly

The Y coordinate of the control point of the quadratic curve segment.

HIGHEDGEback to summary
private static final int HIGHEDGE
INSIDEback to summary
private static final int INSIDE
LOWEDGEback to summary
private static final int LOWEDGE
x1back to summary
public float x1

The X coordinate of the start point of the quadratic curve segment.

x2back to summary
public float x2

The X coordinate of the end point of the quadratic curve segment.

y1back to summary
public float y1

The Y coordinate of the start point of the quadratic curve segment.

y2back to summary
public float y2

The Y coordinate of the end point of the quadratic curve segment.

Constructor Detail

QuadCurve2Dback to summary
public QuadCurve2D()

Constructs and initializes a QuadCurve2D with coordinates (0, 0, 0, 0, 0, 0).

QuadCurve2Dback to summary
public QuadCurve2D(float x1, float y1, float ctrlx, float ctrly, float x2, float y2)

Constructs and initializes a QuadCurve2D from the specified float coordinates.

Parameters
x1:float

the X coordinate of the start point

y1:float

the Y coordinate of the start point

ctrlx:float

the X coordinate of the control point

ctrly:float

the Y coordinate of the control point

x2:float

the X coordinate of the end point

y2:float

the Y coordinate of the end point

Method Detail

containsback to summary
public boolean contains(float x, float y)

Implements abstract com.sun.javafx.geom.Shape.contains.

Doc from com.sun.javafx.geom.Shape.contains.

Tests if the specified coordinates are inside the boundary of the Shape.

Parameters
x:float

the specified X coordinate to be tested

y:float

the specified Y coordinate to be tested

Returns:boolean

true if the specified coordinates are inside the Shape boundary; false otherwise.

Annotations
@Override
containsback to summary
public boolean contains(Point2D p)

Overrides com.sun.javafx.geom.Shape.contains.

Doc from com.sun.javafx.geom.Shape.contains.

Tests if a specified Point2D is inside the boundary of the Shape.

Parameters
p:Point2D

the specified Point2D to be tested

Returns:boolean

true if the specified Point2D is inside the boundary of the Shape; false otherwise.

Annotations
@Override
containsback to summary
public boolean contains(float x, float y, float w, float h)

Implements abstract com.sun.javafx.geom.Shape.contains.

Doc from com.sun.javafx.geom.Shape.contains.

Tests if the interior of the Shape entirely contains the specified rectangular area. All coordinates that lie inside the rectangular area must lie within the Shape for the entire rectanglar area to be considered contained within the Shape.

The Shape.contains() method allows a Shape implementation to conservatively return false when:

  • the intersect method returns true and
  • the calculations to determine whether or not the Shape entirely contains the rectangular area are prohibitively expensive.
This means that for some Shapes this method might return false even though the Shape contains the rectangular area. The Area class performs more accurate geometric computations than most Shape objects and therefore can be used if a more precise answer is required.
Parameters
x:float

the X coordinate of the upper-left corner of the specified rectangular area

y:float

the Y coordinate of the upper-left corner of the specified rectangular area

w:float

the width of the specified rectangular area

h:float

the height of the specified rectangular area

Returns:boolean

true if the interior of the Shape entirely contains the specified rectangular area; false otherwise or, if the Shape contains the rectangular area and the intersects method returns true and the containment calculations would be too expensive to perform.

Annotations
@Override
copyback to summary
public QuadCurve2D copy()

Implements abstract com.sun.javafx.geom.Shape.copy.

Doc from com.sun.javafx.geom.Shape.copy.

Returns a new copy of this Shape instance.

Returns:QuadCurve2D

a copy of this shape

Annotations
@Override
equalsback to summary
public boolean equals(Object obj)

Overrides java.lang.Object.equals.

Doc from java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

The equals method implements an equivalence relation on non-null object references:

  • It is reflexive: for any non-null reference value x, x.equals(x) should return true.
  • It is symmetric: for any non-null reference values x and y, x.equals(y) should return true if and only if y.equals(x) returns true.
  • It is transitive: for any non-null reference values x, y, and z, if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) should return true.
  • It is consistent: for any non-null reference values x and y, multiple invocations of x.equals(y) consistently return true or consistently return false, provided no information used in equals comparisons on the objects is modified.
  • For any non-null reference value x, x.equals(null) should return false.

An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes.

Parameters
obj:Object

the reference object with which to compare.

Returns:boolean

true if this object is the same as the obj argument; false otherwise.

Annotations
@Override
evalQuadraticback to summary
private static int evalQuadratic(float[] vals, int num, boolean include0, boolean include1, float[] inflect, float c1, float ctrl, float c2)

Evaluate the t values in the first num slots of the vals[] array and place the evaluated values back into the same array. Only evaluate t values that are within the range <0, 1>, including the 0 and 1 ends of the range iff the include0 or include1 booleans are true. If an "inflection" equation is handed in, then any points which represent a point of inflection for that quadratic equation are also ignored.

fillEqnback to summary
private static void fillEqn(float[] eqn, float val, float c1, float cp, float c2)

Fill an array with the coefficients of the parametric equation in t, ready for solving against val with solveQuadratic. We currently have: val = Py(t) = C1*(1-t)^2 + 2*CP*t*(1-t) + C2*t^2 = C1 - 2*C1*t + C1*t^2 + 2*CP*t - 2*CP*t^2 + C2*t^2 = C1 + (2*CP - 2*C1)*t + (C1 - 2*CP + C2)*t^2 0 = (C1 - val) + (2*CP - 2*C1)*t + (C1 - 2*CP + C2)*t^2 0 = C + Bt + At^2 C = C1 - val B = 2*CP - 2*C1 A = C1 - 2*CP + C2

getBoundsback to summary
public RectBounds getBounds()

Implements abstract com.sun.javafx.geom.Shape.getBounds.

Doc from com.sun.javafx.geom.Shape.getBounds.

Note that there is no guarantee that the returned RectBounds is the smallest bounding box that encloses the Shape, only that the Shape lies entirely within the indicated RectBounds.

Returns:RectBounds

an instance of RectBounds

Annotations
@Override
getFlatnessback to summary
public static float getFlatness(float x1, float y1, float ctrlx, float ctrly, float x2, float y2)

Returns the flatness, or maximum distance of a control point from the line connecting the end points, of the quadratic curve specified by the indicated control points.

Parameters
x1:float

the X coordinate of the start point

y1:float

the Y coordinate of the start point

ctrlx:float

the X coordinate of the control point

ctrly:float

the Y coordinate of the control point

x2:float

the X coordinate of the end point

y2:float

the Y coordinate of the end point

Returns:float

the flatness of the quadratic curve defined by the specified coordinates.

getFlatnessback to summary
public static float getFlatness(float[] coords, int offset)

Returns the flatness, or maximum distance of a control point from the line connecting the end points, of the quadratic curve specified by the control points stored in the indicated array at the indicated index.

Parameters
coords:float[]

an array containing coordinate values

offset:int

the index into coords from which to start getting the coordinate values

Returns:float

the flatness of a quadratic curve defined by the specified array at the specified offset.

getFlatnessback to summary
public float getFlatness()

Returns the flatness, or maximum distance of a control point from the line connecting the end points, of this QuadCurve2D.

Returns:float

the flatness of this QuadCurve2D.

getFlatnessSqback to summary
public static float getFlatnessSq(float x1, float y1, float ctrlx, float ctrly, float x2, float y2)

Returns the square of the flatness, or maximum distance of a control point from the line connecting the end points, of the quadratic curve specified by the indicated control points.

Parameters
x1:float

the X coordinate of the start point

y1:float

the Y coordinate of the start point

ctrlx:float

the X coordinate of the control point

ctrly:float

the Y coordinate of the control point

x2:float

the X coordinate of the end point

y2:float

the Y coordinate of the end point

Returns:float

the square of the flatness of the quadratic curve defined by the specified coordinates.

getFlatnessSqback to summary
public static float getFlatnessSq(float[] coords, int offset)

Returns the square of the flatness, or maximum distance of a control point from the line connecting the end points, of the quadratic curve specified by the control points stored in the indicated array at the indicated index.

Parameters
coords:float[]

an array containing coordinate values

offset:int

the index into coords from which to to start getting the values from the array

Returns:float

the flatness of the quadratic curve that is defined by the values in the specified array at the specified index.

getFlatnessSqback to summary
public float getFlatnessSq()

Returns the square of the flatness, or maximum distance of a control point from the line connecting the end points, of this QuadCurve2D.

Returns:float

the square of the flatness of this QuadCurve2D.

getPathIteratorback to summary
public PathIterator getPathIterator(BaseTransform tx)

Implements abstract com.sun.javafx.geom.Shape.getPathIterator.

Returns an iteration object that defines the boundary of the shape of this QuadCurve2D. The iterator for this class is not multi-threaded safe, which means that this QuadCurve2D class does not guarantee that modifications to the geometry of this QuadCurve2D object do not affect any iterations of that geometry that are already in process.

Parameters
tx:BaseTransform

an optional BaseTransform to apply to the shape boundary

Returns:PathIterator

a PathIterator object that defines the boundary of the shape.

Annotations
@Override
getPathIteratorback to summary
public PathIterator getPathIterator(BaseTransform tx, float flatness)

Implements abstract com.sun.javafx.geom.Shape.getPathIterator.

Returns an iteration object that defines the boundary of the flattened shape of this QuadCurve2D. The iterator for this class is not multi-threaded safe, which means that this QuadCurve2D class does not guarantee that modifications to the geometry of this QuadCurve2D object do not affect any iterations of that geometry that are already in process.

Parameters
tx:BaseTransform

an optional BaseTransform to apply to the boundary of the shape

flatness:float

the maximum distance that the control points for a subdivided curve can be with respect to a line connecting the end points of this curve before this curve is replaced by a straight line connecting the end points.

Returns:PathIterator

a PathIterator object that defines the flattened boundary of the shape.

Annotations
@Override
getTagback to summary
private static int getTag(float coord, float low, float high)

Determine where coord lies with respect to the range from low to high. It is assumed that low <= high. The return value is one of the 5 values BELOW, LOWEDGE, INSIDE, HIGHEDGE, or ABOVE.

hashCodeback to summary
public int hashCode()

Overrides java.lang.Object.hashCode.

Doc from java.lang.Object.hashCode.

Returns a hash code value for this object. This method is supported for the benefit of hash tables such as those provided by java.util.HashMap.

The general contract of hashCode is:

  • Whenever it is invoked on the same object more than once during an execution of a Java application, the hashCode method must consistently return the same integer, provided no information used in equals comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
  • If two objects are equal according to the equals method, then calling the hashCode method on each of the two objects must produce the same integer result.
  • It is not required that if two objects are unequal according to the equals method, then calling the hashCode method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.
Returns:int

a hash code value for this object

Annotations
@Override
intersectsback to summary
public boolean intersects(float x, float y, float w, float h)

Implements abstract com.sun.javafx.geom.Shape.intersects.

Doc from com.sun.javafx.geom.Shape.intersects.

Tests if the interior of the Shape intersects the interior of a specified rectangular area. The rectangular area is considered to intersect the Shape if any point is contained in both the interior of the Shape and the specified rectangular area.

The Shape.intersects() method allows a Shape implementation to conservatively return true when:

  • there is a high probability that the rectangular area and the Shape intersect, but
  • the calculations to accurately determine this intersection are prohibitively expensive.
This means that for some Shapes this method might return true even though the rectangular area does not intersect the Shape. The Area class performs more accurate computations of geometric intersection than most Shape objects and therefore can be used if a more precise answer is required.
Parameters
x:float

the X coordinate of the upper-left corner of the specified rectangular area

y:float

the Y coordinate of the upper-left corner of the specified rectangular area

w:float

the width of the specified rectangular area

h:float

the height of the specified rectangular area

Returns:boolean

true if the interior of the Shape and the interior of the rectangular area intersect, or are both highly likely to intersect and intersection calculations would be too expensive to perform; false otherwise.

Annotations
@Override
inwardsback to summary
private static boolean inwards(int pttag, int opt1tag, int opt2tag)

Determine if the pttag represents a coordinate that is already in its test range, or is on the border with either of the two opttags representing another coordinate that is "towards the inside" of that test range. In other words, are either of the two "opt" points "drawing the pt inward"?

setCurveback to summary
public void setCurve(float x1, float y1, float ctrlx, float ctrly, float x2, float y2)

Sets the location of the end points and control point of this curve to the specified float coordinates.

Parameters
x1:float

the X coordinate of the start point

y1:float

the Y coordinate of the start point

ctrlx:float

the X coordinate of the control point

ctrly:float

the Y coordinate of the control point

x2:float

the X coordinate of the end point

y2:float

the Y coordinate of the end point

setCurveback to summary
public void setCurve(float[] coords, int offset)

Sets the location of the end points and control points of this QuadCurve2D to the double coordinates at the specified offset in the specified array.

Parameters
coords:float[]

the array containing coordinate values

offset:int

the index into the array from which to start getting the coordinate values and assigning them to this QuadCurve2D

setCurveback to summary
public void setCurve(Point2D p1, Point2D cp, Point2D p2)

Sets the location of the end points and control point of this QuadCurve2D to the specified Point2D coordinates.

Parameters
p1:Point2D

the start point

cp:Point2D

the control point

p2:Point2D

the end point

setCurveback to summary
public void setCurve(Point2D[] pts, int offset)

Sets the location of the end points and control points of this QuadCurve2D to the coordinates of the Point2D objects at the specified offset in the specified array.

Parameters
pts:Point2D[]

an array containing Point2D that define coordinate values

offset:int

the index into pts from which to start getting the coordinate values and assigning them to this QuadCurve2D

setCurveback to summary
public void setCurve(QuadCurve2D c)

Sets the location of the end points and control point of this QuadCurve2D to the same as those in the specified QuadCurve2D.

Parameters
c:QuadCurve2D

the specified QuadCurve2D

solveQuadraticback to summary
public static int solveQuadratic(float[] eqn)

Solves the quadratic whose coefficients are in the eqn array and places the non-complex roots back into the same 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:float[]

the array that contains the quadratic coefficients

Returns:int

the number of roots, or -1 if the equation is a constant

solveQuadraticback to summary
public static int solveQuadratic(float[] eqn, float[] 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:float[]

the specified array of coefficients to use to solve the quadratic equation

res:float[]

the array that contains the non-complex roots resulting from the solution of the quadratic equation

Returns:int

the number of roots, or -1 if the equation is a constant.

subdivideback to summary
public void subdivide(QuadCurve2D left, QuadCurve2D right)

Subdivides this QuadCurve2D and stores the resulting two subdivided curves into the left and right curve parameters. Either or both of the left and right objects can be the same as this QuadCurve2D or null.

Parameters
left:QuadCurve2D

the QuadCurve2D object for storing the left or first half of the subdivided curve

right:QuadCurve2D

the QuadCurve2D object for storing the right or second half of the subdivided curve

subdivideback to summary
public static void subdivide(QuadCurve2D src, QuadCurve2D left, QuadCurve2D right)

Subdivides the quadratic curve specified by the src parameter and stores the resulting two subdivided curves into the left and right curve parameters. Either or both of the left and right objects can be the same as the src object or null.

Parameters
src:QuadCurve2D

the quadratic curve to be subdivided

left:QuadCurve2D

the QuadCurve2D object for storing the left or first half of the subdivided curve

right:QuadCurve2D

the QuadCurve2D object for storing the right or second half of the subdivided curve

subdivideback to summary
public static void subdivide(float[] src, int srcoff, float[] left, int leftoff, float[] right, int rightoff)

Subdivides the quadratic curve specified by the coordinates stored in the src array at indices srcoff through srcoff + 5 and stores the resulting two subdivided curves into the two result arrays at the corresponding indices. Either or both of the left and right arrays can be null or a reference to the same array and offset as the src array. Note that the last point in the first subdivided curve is the same as the first point in the second subdivided curve. Thus, it is possible to pass the same array for left and right and to use offsets such that rightoff equals leftoff + 4 in order to avoid allocating extra storage for this common point.

Parameters
src:float[]

the array holding the coordinates for the source curve

srcoff:int

the offset into the array of the beginning of the the 6 source coordinates

left:float[]

the array for storing the coordinates for the first half of the subdivided curve

leftoff:int

the offset into the array of the beginning of the the 6 left coordinates

right:float[]

the array for storing the coordinates for the second half of the subdivided curve

rightoff:int

the offset into the array of the beginning of the the 6 right coordinates

toCubicback to summary
public CubicCurve2D toCubic()