Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(654)

Side by Side Diff: device/vr/vr_math.h

Issue 2795793002: Implementation of elbow model for the controller position and rotation. (Closed)
Patch Set: nit Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/browser/android/vr_shell/vr_shell_renderer.cc ('k') | device/vr/vr_math.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef DEVICE_VR_VR_MATH_H_ 5 #ifndef DEVICE_VR_VR_MATH_H_
6 #define DEVICE_VR_VR_MATH_H_ 6 #define DEVICE_VR_VR_MATH_H_
7 7
8 #include "device/vr/vr_export.h" 8 #include "device/vr/vr_export.h"
9 #include "device/vr/vr_types.h" 9 #include "device/vr/vr_types.h"
10 10
(...skipping 15 matching lines...) Expand all
26 const Mat4f& matrix2, 26 const Mat4f& matrix2,
27 Mat4f* out); 27 Mat4f* out);
28 28
29 // Provides the direction the head is looking towards as a 3x1 unit vector. 29 // Provides the direction the head is looking towards as a 3x1 unit vector.
30 gfx::Vector3dF DEVICE_VR_EXPORT GetForwardVector(const Mat4f& matrix); 30 gfx::Vector3dF DEVICE_VR_EXPORT GetForwardVector(const Mat4f& matrix);
31 31
32 gfx::Vector3dF DEVICE_VR_EXPORT GetTranslation(const Mat4f& matrix); 32 gfx::Vector3dF DEVICE_VR_EXPORT GetTranslation(const Mat4f& matrix);
33 33
34 void DEVICE_VR_EXPORT QuatToMatrix(const Quatf& quat, Mat4f* out); 34 void DEVICE_VR_EXPORT QuatToMatrix(const Quatf& quat, Mat4f* out);
35 35
36 // Creates a rotation which rotates `from` vector to `to`.
37 vr::Quatf DEVICE_VR_EXPORT GetVectorRotation(const gfx::Vector3dF& from,
38 const gfx::Vector3dF& to);
39
40 vr::Quatf DEVICE_VR_EXPORT QuatSum(const vr::Quatf& a, const vr::Quatf& b);
41 vr::Quatf DEVICE_VR_EXPORT QuatProduct(const vr::Quatf& a, const vr::Quatf& b);
42 vr::Quatf DEVICE_VR_EXPORT ScaleQuat(const vr::Quatf& q, float s);
43
44 vr::Quatf DEVICE_VR_EXPORT InvertQuat(const vr::Quatf& quat);
45
46 float DEVICE_VR_EXPORT QuatAngleDegrees(const vr::Quatf& a, const vr::Quatf& b);
47
48 vr::Quatf DEVICE_VR_EXPORT QuatLerp(const vr::Quatf& a,
49 const vr::Quatf& b,
50 float t);
51
52 // Spherical linear interpolation.
53 gfx::Vector3dF DEVICE_VR_EXPORT QuatSlerp(const gfx::Vector3dF& v_start,
54 const gfx::Vector3dF& v_end,
55 float percent);
56
36 // Normalize a vector, and return its original length. 57 // Normalize a vector, and return its original length.
37 float DEVICE_VR_EXPORT NormalizeVector(gfx::Vector3dF* vec); 58 float DEVICE_VR_EXPORT NormalizeVector(gfx::Vector3dF* vec);
38 59
39 void DEVICE_VR_EXPORT NormalizeQuat(Quatf* quat); 60 void DEVICE_VR_EXPORT NormalizeQuat(Quatf* quat);
40 61
41 Quatf DEVICE_VR_EXPORT QuatFromAxisAngle(const RotationAxisAngle& axis_angle); 62 Quatf DEVICE_VR_EXPORT QuatFromAxisAngle(const RotationAxisAngle& axis_angle);
42 63
43 gfx::Point3F DEVICE_VR_EXPORT GetRayPoint(const gfx::Point3F& rayOrigin, 64 gfx::Point3F DEVICE_VR_EXPORT GetRayPoint(const gfx::Point3F& rayOrigin,
44 const gfx::Vector3dF& rayVector, 65 const gfx::Vector3dF& rayVector,
45 float scale); 66 float scale);
46 67
47 // Angle between the vectors' projections to the XZ plane. 68 // Angle between the vectors' projections to the XZ plane.
48 bool DEVICE_VR_EXPORT XZAngle(const gfx::Vector3dF& vec1, 69 bool DEVICE_VR_EXPORT XZAngle(const gfx::Vector3dF& vec1,
49 const gfx::Vector3dF& vec2, 70 const gfx::Vector3dF& vec2,
50 float* angle); 71 float* angle);
51 72
73 gfx::Vector3dF DEVICE_VR_EXPORT ToVector(const gfx::Point3F& p);
74
75 gfx::Point3F DEVICE_VR_EXPORT ToPoint(const gfx::Vector3dF& p);
76
77 // Scale components of the point by the components of the vector.
78 gfx::Point3F DEVICE_VR_EXPORT ScalePoint(const gfx::Point3F& p,
79 const gfx::Vector3dF& s);
80
81 // Scale components of a vector by the components of another.
82 gfx::Vector3dF DEVICE_VR_EXPORT ScaleVector(const gfx::Vector3dF& p,
83 const gfx::Vector3dF& s);
84
85 float DEVICE_VR_EXPORT Clampf(float value, float min, float max);
86
52 } // namespace vr 87 } // namespace vr
53 88
54 #endif // DEVICE_VR_VR_MATH_H_ 89 #endif // DEVICE_VR_VR_MATH_H_
OLDNEW
« no previous file with comments | « chrome/browser/android/vr_shell/vr_shell_renderer.cc ('k') | device/vr/vr_math.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698