Android examples for android.graphics:PointF
Calculate middle Point
import android.graphics.PointF; public class Main { public static PointF middlePoint(final PointF one, final PointF two, final PointF resultHolder) { return middlePoint(one.x, two.x, one.y, two.y, resultHolder); }// w w w . ja v a 2s . co m public static PointF middlePoint(final float x1, final float x2, final float y1, final float y2, PointF resultHolder) { final float x = x1 + x2; final float y = y1 + y2; final PointF toret = resultHolder != null ? resultHolder : new PointF(); toret.set(x / 2, y / 2); return toret; } }