chromium/ui/events/gestures/physics_based_fling_curve.cc

// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "ui/events/gestures/physics_based_fling_curve.h"

#include <algorithm>
#include <cmath>

#include "base/check.h"

namespace {

// These constants are defined based on UX experiment.
const float kDefaultP1X =;
const float kDefaultP1Y =;
const float kDefaultP2X =;
const float kDefaultP2Y =;
const float kDefaultPixelDeceleration =;
const float kMaxCurveDurationForFling =;
const float kDefaultPhysicalDeceleration =;  // inch/ms^2.

inline gfx::Vector2dF GetPositionAtValue(const gfx::Vector2dF& end_point,
                                         double progress) {}

inline gfx::Vector2dF GetVelocityAtTime(const gfx::Vector2dF& current_offset,
                                        const gfx::Vector2dF& prev_offset,
                                        base::TimeDelta delta) {}

float GetOffset(float velocity, float deceleration, float duration) {}

gfx::Vector2dF GetDecelerationInPixelsPerMs2(
    const gfx::Vector2dF& pixels_per_inch) {}

gfx::Vector2dF GetDuration(const gfx::Vector2dF& velocity,
                           const gfx::Vector2dF& deceleration) {}

// Calculates the |distance_| based on the fling velocity. It utilizes
// following equation for |distance_| calculation. d = v*t - 0.5*a*t^2 where d
// = distance, v = initial velocity, a = acceleration and time = duration before
// it reaches zero velocity. time = final velocity(0) - initial velocity(v) /
// acceleration (a) This |distance_| is later used by PhysicsBasedFlingCurve to
// generate fling animation curve.
gfx::Vector2dF CalculateEndPoint(const gfx::Vector2dF& pixels_per_inch,
                                 const gfx::Vector2dF& velocity_pixels_per_ms,
                                 const gfx::Size& bounding_size) {}

}  // namespace

namespace ui {

PhysicsBasedFlingCurve::PhysicsBasedFlingCurve(
    const gfx::Vector2dF& velocity,
    base::TimeTicks start_timestamp,
    const gfx::Vector2dF& pixels_per_inch,
    const float boost_multiplier,
    const gfx::Size& bounding_size)
    :{}

PhysicsBasedFlingCurve::~PhysicsBasedFlingCurve() = default;

bool PhysicsBasedFlingCurve::ComputeScrollOffset(base::TimeTicks time,
                                                 gfx::Vector2dF* offset,
                                                 gfx::Vector2dF* velocity) {}

base::TimeDelta
PhysicsBasedFlingCurve::CalculateDurationAndConfigureControlPoints(
    const gfx::Vector2dF& velocity) {}
}  // namespace ui