1/*
2 * Copyright (C) 2014 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package com.android.camera.ui.motion;
18
19/**
20 * Simple functions that produce values along a curve for any given input and can compute input
21 * times for a given output value.
22 */
23public interface UnitCurve {
24
25    /**
26     * Produce a unit value of this curve at time t. The function should always return a valid
27     * return value for any valid t input.
28     *
29     * @param t ratio of time passed from (0..1)
30     * @return the unit value at t.
31     */
32    float valueAt(float t);
33
34    /**
35     * If possible, find a value for t such that valueAt(t) == value or best guess.
36     *
37     * @param value to match to the output of valueAt(t)
38     * @return t where valueAt(t) == value or throw.
39     */
40    float tAt(float value);
41}
42