Android examples for java.lang:Math Geometry
get Symmetry Point
//package com.java2s; import android.graphics.PointF; public class Main { public static PointF getSymmetryPoint(PointF result, float x1, float y1, float a, float b, float c, float lineX) { float x2; float y2; if (a == 0 && b == 0) { y2 = y1;/* w w w .j a v a 2 s. c o m*/ x2 = lineX * 2 - x1; } else { float aa = a * a; float bb = b * b; float ab2 = 2 * a * b; float aa_bb = aa + bb; x2 = ((bb - aa) * x1 - ab2 * y1 - 2 * a * c) / aa_bb; y2 = ((aa - bb) * y1 - ab2 * x1 - 2 * b * c) / aa_bb; } result.set(x2, y2); return result; } }