Example usage for java.awt.geom CubicCurve2D solveCubic

List of usage examples for java.awt.geom CubicCurve2D solveCubic

Introduction

In this page you can find the example usage for java.awt.geom CubicCurve2D solveCubic.

Prototype

public static int solveCubic(double[] eqn, double[] res) 

Source Link

Document

Solve the cubic whose coefficients are in the eqn array and place the non-complex roots into the res array, returning the number of roots.

Usage

From source file:Cubic.java

protected int findRoots(double y, double[] roots) {
    double[] eqn = { p1.y - y, 3 * (p2.y - p1.y), 3 * (p1.y - 2 * p2.y + p3.y),
            3 * p2.y - p1.y + p4.y - 3 * p3.y };
    return CubicCurve2D.solveCubic(eqn, roots);
    // return solveCubic(eqn[3], eqn[2], eqn[1], eqn[0], roots);
}