complete Primary Diagonal Line from Point - Android java.lang

Android examples for java.lang:Math Geometry

Description

complete Primary Diagonal Line from Point

Demo Code


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

public class Main {
    public static Point completePrimaryDiagonalLine(Point one, Point two) {
        Point three = null;//from   w w w  . j  av a2  s. co  m
        if (one.x == one.y && two.x == two.y) {
            int r = getThirdValue(one.x, two.x);
            three = new Point(r, r);
        }
        return three;
    }

    private static int getThirdValue(int one, int two) {
        if (one == 1 && two == 2)
            return 3;
        else if (one == 1 && two == 3)
            return 2;
        else
            return 1;
    }
}

Related Tutorials