Java String Ellipse ellipseCircum(double a, double b)

Here you can find the source of ellipseCircum(double a, double b)

Description

Returns the approximate circumference of the ellipse defined by the specified minor and major axes.

License

Open Source License

Declaration

public static double ellipseCircum(double a, double b) 

Method Source Code

//package com.java2s;
// under the terms of the GNU Lesser General Public License as published

public class Main {
    /**//from   w  w  w  .  ja  v a2 s.  co m
     * Returns the approximate circumference of the ellipse defined by the
     * specified minor and major axes. The formula used (due to Ramanujan,
     * via a paper of his entitled "Modular Equations and Approximations
     * to Pi"), is <code>Pi(3a + 3b - sqrt[(a+3b)(b+3a)])</code>.
     */
    public static double ellipseCircum(double a, double b) {
        return Math.PI * (3 * a + 3 * b - Math.sqrt((a + 3 * b) * (b + 3 * a)));
    }
}

Related

  1. ellipseCircumference(double a, double b)
  2. ellipseString(StringBuilder builder, int maxLength)
  3. ellipsify(String message)
  4. ellipsis(final String text, final int length)