Example usage for android.graphics PointF equals

List of usage examples for android.graphics PointF equals

Introduction

In this page you can find the example usage for android.graphics PointF equals.

Prototype

@Override
    public boolean equals(Object o) 

Source Link

Usage

From source file:Main.java

public static void addBezierArcToPath(@NonNull Path path, @NonNull PointF center, @NonNull PointF start,
        @NonNull PointF end, boolean moveToStart) {
    if (moveToStart) {
        path.moveTo(start.x, start.y);/*w  w  w.j  a v  a 2  s  . com*/
    }
    if (start.equals(end)) {
        return;
    }

    final double ax = start.x - center.x;
    final double ay = start.y - center.y;
    final double bx = end.x - center.x;
    final double by = end.y - center.y;
    final double q1 = ax * ax + ay * ay;
    final double q2 = q1 + ax * bx + ay * by;
    final double k2 = 4d / 3d * (sqrt(2d * q1 * q2) - q2) / (ax * by - ay * bx);
    final float x2 = (float) (center.x + ax - k2 * ay);
    final float y2 = (float) (center.y + ay + k2 * ax);
    final float x3 = (float) (center.x + bx + k2 * by);
    final float y3 = (float) (center.y + by - k2 * bx);

    path.cubicTo(x2, y2, x3, y3, end.x, end.y);
}