chromium/ui/gfx/geometry/vector3d_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_VECTOR3D_F_H_
#define UI_GFX_GEOMETRY_VECTOR3D_F_H_

#include <iosfwd>
#include <string>

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

namespace gfx {

class GEOMETRY_EXPORT Vector3dF {};

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

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

inline Vector3dF operator-(const Vector3dF& v) {}

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

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

// Return the cross product of two vectors.
inline Vector3dF CrossProduct(const Vector3dF& lhs, const Vector3dF& rhs) {}

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

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

// Return a vector that is |v| scaled by the components of |s|
inline Vector3dF ScaleVector3d(const Vector3dF& v, const Vector3dF& s) {}

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

// Returns the angle between |base| and |other| in degrees.
GEOMETRY_EXPORT float AngleBetweenVectorsInDegrees(const gfx::Vector3dF& base,
                                                   const gfx::Vector3dF& other);

// Returns the clockwise angle between |base| and |other| where |normal| is the
// normal of the virtual surface to measure clockwise according to.
GEOMETRY_EXPORT float ClockwiseAngleBetweenVectorsInDegrees(
    const gfx::Vector3dF& base,
    const gfx::Vector3dF& other,
    const gfx::Vector3dF& normal);

// 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 Vector3dF& vector, ::std::ostream* os);

}  // namespace gfx

#endif // UI_GFX_GEOMETRY_VECTOR3D_F_H_