chromium/ui/gfx/geometry/vector2d_f.h

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

// Defines a simple float vector class.  This class is used to indicate a
// distance in two dimensions between two points. Subtracting two points should
// produce a vector, and adding a vector to a point produces the point at the
// vector's distance from the original point.

#ifndef UI_GFX_GEOMETRY_VECTOR2D_F_H_
#define UI_GFX_GEOMETRY_VECTOR2D_F_H_

#include <iosfwd>
#include <string>

#include "ui/gfx/geometry/geometry_export.h"

namespace perfetto {
class TracedValue;
}
namespace gfx {

class GEOMETRY_EXPORT Vector2dF {};

inline constexpr bool operator==(const Vector2dF& lhs, const Vector2dF& rhs) {}

inline constexpr bool operator!=(const Vector2dF& lhs, const Vector2dF& rhs) {}

inline constexpr Vector2dF operator-(const Vector2dF& v) {}

inline Vector2dF operator+(const Vector2dF& lhs, const Vector2dF& rhs) {}

inline Vector2dF operator-(const Vector2dF& lhs, const Vector2dF& rhs) {}

// Return the cross product of two vectors, i.e. the determinant.
GEOMETRY_EXPORT double CrossProduct(const Vector2dF& lhs, const Vector2dF& rhs);

// Return the dot product of two vectors.
GEOMETRY_EXPORT double DotProduct(const Vector2dF& lhs, const Vector2dF& rhs);

// Return a vector that is |v| scaled by the given scale factors along each
// axis.
GEOMETRY_EXPORT Vector2dF ScaleVector2d(const Vector2dF& v,
                                        float x_scale,
                                        float y_scale);

// Return a vector that is |v| scaled by the given scale factor.
inline Vector2dF ScaleVector2d(const Vector2dF& v, float scale) {}

inline Vector2dF TransposeVector2d(const Vector2dF& v) {}

// This is declared here for use in gtest-based unit tests but is defined in
// the //ui/gfx:test_support target. Depend on that to use this in your unit
// test. This should not be used in production code - call ToString() instead.
void PrintTo(const Vector2dF& vector, ::std::ostream* os);

}  // namespace gfx

#endif // UI_GFX_GEOMETRY_VECTOR2D_F_H_