< prev index next >

src/java.desktop/share/classes/java/awt/geom/CubicCurve2D.java

Print this page

        

*** 1,7 **** /* ! * Copyright (c) 1997, 2011, 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
*** 858,868 **** * @return the square of the flatness of the {@code CubicCurve2D} * specified by the coordinates in {@code coords} at * the specified offset. * @since 1.2 */ ! public static double getFlatnessSq(double coords[], int offset) { return getFlatnessSq(coords[offset + 0], coords[offset + 1], coords[offset + 2], coords[offset + 3], coords[offset + 4], coords[offset + 5], coords[offset + 6], coords[offset + 7]); } --- 858,868 ---- * @return the square of the flatness of the {@code CubicCurve2D} * specified by the coordinates in {@code coords} at * the specified offset. * @since 1.2 */ ! public static double getFlatnessSq(double[] coords, int offset) { return getFlatnessSq(coords[offset + 0], coords[offset + 1], coords[offset + 2], coords[offset + 3], coords[offset + 4], coords[offset + 5], coords[offset + 6], coords[offset + 7]); }
*** 878,888 **** * @return the flatness of the {@code CubicCurve2D} * specified by the coordinates in {@code coords} at * the specified offset. * @since 1.2 */ ! public static double getFlatness(double coords[], int offset) { return getFlatness(coords[offset + 0], coords[offset + 1], coords[offset + 2], coords[offset + 3], coords[offset + 4], coords[offset + 5], coords[offset + 6], coords[offset + 7]); } --- 878,888 ---- * @return the flatness of the {@code CubicCurve2D} * specified by the coordinates in {@code coords} at * the specified offset. * @since 1.2 */ ! public static double getFlatness(double[] coords, int offset) { return getFlatness(coords[offset + 0], coords[offset + 1], coords[offset + 2], coords[offset + 3], coords[offset + 4], coords[offset + 5], coords[offset + 6], coords[offset + 7]); }
*** 998,1010 **** * 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 ctrlx1 = src[srcoff + 2]; double ctrly1 = src[srcoff + 3]; double ctrlx2 = src[srcoff + 4]; --- 998,1010 ---- * 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 ctrlx1 = src[srcoff + 2]; double ctrly1 = src[srcoff + 3]; double ctrlx2 = src[srcoff + 4];
*** 1063,1073 **** * zeroes. * @param eqn an array containing coefficients for a cubic * @return the number of roots, or -1 if the equation is a constant. * @since 1.2 */ ! public static int solveCubic(double eqn[]) { return solveCubic(eqn, eqn); } /** * Solve the cubic whose coefficients are in the {@code eqn} --- 1063,1073 ---- * zeroes. * @param eqn an array containing coefficients for a cubic * @return the number of roots, or -1 if the equation is a constant. * @since 1.2 */ ! public static int solveCubic(double[] eqn) { return solveCubic(eqn, eqn); } /** * Solve the cubic whose coefficients are in the {@code eqn}
*** 1084,1094 **** * @param res the array that contains the non-complex roots * resulting from the solution of the cubic equation * @return the number of roots, or -1 if the equation is a constant * @since 1.3 */ ! public static int solveCubic(double eqn[], double res[]) { // From Graphics Gems: // http://tog.acm.org/resources/GraphicsGems/gems/Roots3And4.c final double d = eqn[3]; if (d == 0) { return QuadCurve2D.solveQuadratic(eqn, res); --- 1084,1094 ---- * @param res the array that contains the non-complex roots * resulting from the solution of the cubic equation * @return the number of roots, or -1 if the equation is a constant * @since 1.3 */ ! public static int solveCubic(double[] eqn, double[] res) { // From Graphics Gems: // http://tog.acm.org/resources/GraphicsGems/gems/Roots3And4.c final double d = eqn[3]; if (d == 0) { return QuadCurve2D.solveQuadratic(eqn, res);
*** 1367,1377 **** private static boolean oppositeSigns(double x1, double x2) { return (x1 < 0 && x2 > 0) || (x1 > 0 && x2 < 0); } ! private static double solveEqn(double eqn[], int order, double t) { double v = eqn[order]; while (--order >= 0) { v = v * t + eqn[order]; } return v; --- 1367,1377 ---- private static boolean oppositeSigns(double x1, double x2) { return (x1 < 0 && x2 > 0) || (x1 > 0 && x2 < 0); } ! private static double solveEqn(double[] eqn, int order, double t) { double v = eqn[order]; while (--order >= 0) { v = v * t + eqn[order]; } return v;
< prev index next >