Example usage for java.awt.geom QuadCurve2D solveQuadratic

List of usage examples for java.awt.geom QuadCurve2D solveQuadratic

Introduction

In this page you can find the example usage for java.awt.geom QuadCurve2D solveQuadratic.

Prototype

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

Source Link

Document

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.

Usage

From source file:Quadradic.java

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