< prev index next >
src/java.desktop/share/classes/java/awt/geom/QuadCurve2D.java
Print this page
*** 1,7 ****
/*
! * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
--- 1,7 ----
/*
! * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
*** 662,672 ****
* to start getting the values from the array
* @return the flatness of the quadratic curve that is defined by the
* values in the specified array at the specified index.
* @since 1.2
*/
! public static double getFlatnessSq(double coords[], int offset) {
return Line2D.ptSegDistSq(coords[offset + 0], coords[offset + 1],
coords[offset + 4], coords[offset + 5],
coords[offset + 2], coords[offset + 3]);
}
--- 662,672 ----
* to start getting the values from the array
* @return the flatness of the quadratic curve that is defined by the
* values in the specified array at the specified index.
* @since 1.2
*/
! public static double getFlatnessSq(double[] coords, int offset) {
return Line2D.ptSegDistSq(coords[offset + 0], coords[offset + 1],
coords[offset + 4], coords[offset + 5],
coords[offset + 2], coords[offset + 3]);
}
*** 680,690 ****
* start getting the coordinate values
* @return the flatness of a quadratic curve defined by the
* specified array at the specified offset.
* @since 1.2
*/
! public static double getFlatness(double coords[], int offset) {
return Line2D.ptSegDist(coords[offset + 0], coords[offset + 1],
coords[offset + 4], coords[offset + 5],
coords[offset + 2], coords[offset + 3]);
}
--- 680,690 ----
* start getting the coordinate values
* @return the flatness of a quadratic curve defined by the
* specified array at the specified offset.
* @since 1.2
*/
! public static double getFlatness(double[] coords, int offset) {
return Line2D.ptSegDist(coords[offset + 0], coords[offset + 1],
coords[offset + 4], coords[offset + 5],
coords[offset + 2], coords[offset + 3]);
}
*** 795,807 ****
* half of the subdivided curve
* @param rightoff the offset into the array of the beginning of the
* the 6 right coordinates
* @since 1.2
*/
! public static void subdivide(double src[], int srcoff,
! double left[], int leftoff,
! double right[], int rightoff) {
double x1 = src[srcoff + 0];
double y1 = src[srcoff + 1];
double ctrlx = src[srcoff + 2];
double ctrly = src[srcoff + 3];
double x2 = src[srcoff + 4];
--- 795,807 ----
* half of the subdivided curve
* @param rightoff the offset into the array of the beginning of the
* the 6 right coordinates
* @since 1.2
*/
! public static void subdivide(double[] src, int srcoff,
! double[] left, int leftoff,
! double[] right, int rightoff) {
double x1 = src[srcoff + 0];
double y1 = src[srcoff + 1];
double ctrlx = src[srcoff + 2];
double ctrly = src[srcoff + 3];
double x2 = src[srcoff + 4];
*** 849,859 ****
* @param eqn the array that contains the quadratic coefficients
* @return the number of roots, or {@code -1} if the equation is
* a constant
* @since 1.2
*/
! public static int solveQuadratic(double eqn[]) {
return solveQuadratic(eqn, eqn);
}
/**
* Solves the quadratic whose coefficients are in the {@code eqn}
--- 849,859 ----
* @param eqn the array that contains the quadratic coefficients
* @return the number of roots, or {@code -1} if the equation is
* a constant
* @since 1.2
*/
! public static int solveQuadratic(double[] eqn) {
return solveQuadratic(eqn, eqn);
}
/**
* Solves the quadratic whose coefficients are in the {@code eqn}
*** 873,883 ****
* resulting from the solution of the quadratic equation
* @return the number of roots, or {@code -1} if the equation is
* a constant.
* @since 1.3
*/
! public static int solveQuadratic(double eqn[], double res[]) {
double a = eqn[2];
double b = eqn[1];
double c = eqn[0];
int roots = 0;
if (a == 0.0) {
--- 873,883 ----
* resulting from the solution of the quadratic equation
* @return the number of roots, or {@code -1} if the equation is
* a constant.
* @since 1.3
*/
! public static int solveQuadratic(double[] eqn, double[] res) {
double a = eqn[2];
double b = eqn[1];
double c = eqn[0];
int roots = 0;
if (a == 0.0) {
*** 1034,1044 ****
* 0 = C + Bt + At^2
* C = C1 - val
* B = 2*CP - 2*C1
* A = C1 - 2*CP + C2
*/
! private static void fillEqn(double eqn[], double val,
double c1, double cp, double c2) {
eqn[0] = c1 - val;
eqn[1] = cp + cp - c1 - c1;
eqn[2] = c1 - cp - cp + c2;
return;
--- 1034,1044 ----
* 0 = C + Bt + At^2
* C = C1 - val
* B = 2*CP - 2*C1
* A = C1 - 2*CP + C2
*/
! private static void fillEqn(double[] eqn, double val,
double c1, double cp, double c2) {
eqn[0] = c1 - val;
eqn[1] = cp + cp - c1 - c1;
eqn[2] = c1 - cp - cp + c2;
return;
*** 1051,1064 ****
* 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.
*/
! private static int evalQuadratic(double vals[], int num,
boolean include0,
boolean include1,
! double inflect[],
double c1, double ctrl, double c2) {
int j = 0;
for (int i = 0; i < num; i++) {
double t = vals[i];
if ((include0 ? t >= 0 : t > 0) &&
--- 1051,1064 ----
* 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.
*/
! private static int evalQuadratic(double[] vals, int num,
boolean include0,
boolean include1,
! double[] inflect,
double c1, double ctrl, double c2) {
int j = 0;
for (int i = 0; i < num; i++) {
double t = vals[i];
if ((include0 ? t >= 0 : t > 0) &&
< prev index next >