get a point between two other points given a decimal percentage i.e. - Java 2D Graphics

Java examples for 2D Graphics:Dimension

Description

get a point between two other points given a decimal percentage i.e.

Demo Code


//package com.java2s;

public class Main {
    /**/*from   ww w .  j a  va  2  s  . com*/
     * get a point between two other points given a decimal percentage
     * i.e. 0.5 will be half way between the two
     *
     * @param xStart
     * @param xEnd
     * @param percentDecimal
     * @return
     */
    public static float getPointBetweenTwoPoints(float xStart, float xEnd,
            double percentDecimal) {
        return (float) (xStart + percentDecimal * (xEnd - xStart));
    }
}

Related Tutorials