Calculates the y-coordinate of the bottom edge given the other sides of the rectangle and an aspect ratio. - Android Graphics

Android examples for Graphics:Rectangle

Description

Calculates the y-coordinate of the bottom edge given the other sides of the rectangle and an aspect ratio.

Demo Code

//package com.java2s;

public class Main {
    /**/*from ww  w.ja  v a2s  . co  m*/
     * Calculates the y-coordinate of the bottom edge given the other sides of
     * the rectangle and an aspect ratio.
     */
    public static float calculateBottom(float left, float top, float right,
            float targetAspectRatio) {

        final float width = right - left;

        final float bottom = (width / targetAspectRatio) + top;

        return bottom;
    }
}

Related Tutorials