Example usage for android.graphics PointF PointF

List of usage examples for android.graphics PointF PointF

Introduction

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

Prototype

public PointF(float x, float y) 

Source Link

Usage

From source file:Main.java

private static PointF catmull_rom_spline_tangent(PointF p0, PointF p1) {
    return new PointF((p0.x - p1.x) / 2, (p0.y - p1.y) / 2);
}

From source file:Main.java

public static PointF midPoint(PointF p1, PointF p2) {
    return new PointF((p1.x + p2.x) / 2, (p1.y + p2.y) / 2);
}

From source file:Main.java

static public PointF getPosition(View v) {
    return new PointF(v.getLeft(), v.getTop());
}

From source file:Main.java

public static boolean withPointRadius(int x, int y, PointF target, float radius) {
    PointF cur = new PointF(x, y);
    return withPointRadius(cur, target, radius);
}

From source file:Main.java

public static PointF mapDisplayPointTo(PointF p, Point center) {
    return new PointF(p.x - center.x, center.y - p.y);
}

From source file:Main.java

public static PointF normalizedSensorCoordsForNormalizedDisplayCoords(float nx, float ny,
        int sensorOrientation) {
    switch (sensorOrientation) {
    case 0:/*w  ww.  ja v a  2  s .c  om*/
        return new PointF(nx, ny);
    case 90:
        return new PointF(ny, 1.0f - nx);
    case 180:
        return new PointF(1.0f - nx, 1.0f - ny);
    case 270:
        return new PointF(1.0f - ny, nx);
    default:
        return null;
    }
}

From source file:Main.java

public static PointF mapDisplayPointTo(Point p, PointF center) {
    return new PointF(p.x - center.x, center.y - p.y);
}

From source file:Main.java

public static PointF centroidForPoly(PointF[] points) {
    float centroidX = 0, centroidY = 0;

    for (PointF point : points) {
        centroidX += point.x / points.length;
        centroidY += point.y / points.length;
    }/* w  w w.  j  av a2  s.  c om*/
    return new PointF(centroidX, centroidY);
}

From source file:Main.java

public static PointF convertedPositionForDescendant(ViewGroup parent, View descendant) {
    Rect rect = convertedRectForDescendant(parent, descendant);
    return new PointF(rect.left, rect.top);
}

From source file:Main.java

public static PointF percent(PointF p1, float percent1, PointF p2, float percent2) {
    float x = (p2.x - p1.x) * percent1 + p1.x;
    float y = (p2.y - p1.y) * percent2 + p1.y;
    return new PointF(x, y);
}