Computes the aspect ratio of a given rect. - Android java.lang

Android examples for java.lang:Math Geometry

Description

Computes the aspect ratio of a given rect.

Demo Code


//package com.java2s;
import android.graphics.RectF;

public class Main {
    /**//from   w ww  .j a  va2  s. co  m
     * Computes the aspect ratio of a given rect.
     * @param rect the rect to have its aspect ratio computed.
     * @return the rect aspect ratio.
     */
    public static float getRectRatio(RectF rect) {
        return rect.width() / rect.height();
    }
}

Related Tutorials