Example usage for android.util FloatMath floor

List of usage examples for android.util FloatMath floor

Introduction

In this page you can find the example usage for android.util FloatMath floor.

Prototype

public static float floor(float value) 

Source Link

Document

Returns the float conversion of the most positive (i.e.

Usage

From source file:com.actionbarsherlock.internal.nineoldandroids.view.animation.AnimatorProxy.java

private void invalidateAfterUpdate() {
    View view = mView.get();/*w ww. jav a  2  s .  c om*/
    if (view == null) {
        return;
    }
    View parent = (View) view.getParent();
    if (parent == null) {
        return;
    }

    view.setAnimation(this);

    final RectF after = mAfter;
    computeRect(after, view);
    after.union(mBefore);

    parent.invalidate((int) FloatMath.floor(after.left), (int) FloatMath.floor(after.top),
            (int) FloatMath.ceil(after.right), (int) FloatMath.ceil(after.bottom));
}

From source file:com.example.mapdemo.StreetViewPanoramaNavigationDemoActivity.java

public static float findNormalizedDifference(float a, float b) {
    float diff = a - b;
    float normalizedDiff = diff - (360.0f * FloatMath.floor(diff / 360.0f));
    return (normalizedDiff < 180.0f) ? normalizedDiff : 360.0f - normalizedDiff;
}

From source file:com.android.fastergallery.ui.TileImageView.java

private void getRange(Rect out, int cX, int cY, int level, float scale, int rotation) {

    double radians = Math.toRadians(-rotation);
    double w = getWidth();
    double h = getHeight();

    double cos = Math.cos(radians);
    double sin = Math.sin(radians);
    int width = (int) Math.ceil(Math.max(Math.abs(cos * w - sin * h), Math.abs(cos * w + sin * h)));
    int height = (int) Math.ceil(Math.max(Math.abs(sin * w + cos * h), Math.abs(sin * w - cos * h)));

    int left = (int) FloatMath.floor(cX - width / (2f * scale));
    int top = (int) FloatMath.floor(cY - height / (2f * scale));
    int right = (int) FloatMath.ceil(left + width / scale);
    int bottom = (int) FloatMath.ceil(top + height / scale);

    // align the rectangle to tile boundary
    int size = sTileSize << level;
    left = Math.max(0, size * (left / size));
    top = Math.max(0, size * (top / size));
    right = Math.min(mImageWidth, right);
    bottom = Math.min(mImageHeight, bottom);

    out.set(left, top, right, bottom);/*from   w  w  w . j  a va  2 s  .  co  m*/
}

From source file:com.c4mprod.utils.ImageManager.java

private static void computeRatio(int width, int height, BitmapFactory.Options bmpFactoryOptions) {
    int heightRatio;
    int widthRatio;
    if (bmpFactoryOptions.outHeight > bmpFactoryOptions.outWidth) {
        heightRatio = (int) FloatMath.floor(bmpFactoryOptions.outHeight / (float) width);
        widthRatio = (int) FloatMath.floor(bmpFactoryOptions.outWidth / (float) height);
    } else {// w ww  .j av  a2s. co m
        heightRatio = (int) FloatMath.floor(bmpFactoryOptions.outHeight / (float) height);
        widthRatio = (int) FloatMath.floor(bmpFactoryOptions.outWidth / (float) width);
    }

    if (heightRatio > 1 || widthRatio > 1) {
        if (heightRatio < widthRatio) {
            bmpFactoryOptions.inSampleSize = widthRatio;
        } else {
            bmpFactoryOptions.inSampleSize = heightRatio;
        }
    } else {
        bmpFactoryOptions.inSampleSize = 1;
    }
}